Visual Studio limitations

MySQL 5.1 is moving to a new system for building the source code on Windows, based on CMake (more on this another time).

While finishing up the last bits of this, I ran into a very annoying limitation in Visual Studio (version 7.1 I think). The library include path in Visual Studio project files (.vcproj) has a very tight limit on the maximum length, around 2000 characters it seems. Put a path longer than that in the AdditionalLibraryDirectories section, and you will not get an error but the build will fail to find required libraries. This problem is made more serious by the fact that CMake tends to use absolute paths, leading to longer paths in the project files.

Googling a bit for this problem turned up nothing, so in the end I had to resort to some extremely ugly Perl one-liner build cleanup:

perl -i.bak -pe "s/[a-z]:[^,; ]+\\\\$BUILD_DIR/../gi if /AdditionalLibraryDirectories/" sql/mysqld.vcproj

Not very nice 🙁

I think there is a lesson here: Do not put arbitrary limits into development tools. People will try to use the tools in unexpected ways, and fail.

1 comment

Leave a comment

Your email address will not be published. Required fields are marked *