Sharpmake
Sharpmake copied to clipboard
Windows makefile library issue
trafficstars
It seems like there's some issue with library extension handling for makefile project under windows.
Some internal logic seems to append a .a like it would be done on Linux.
Setup
- OS: Window 10
- Build: Makefile with gcc and clang
- This simple project demonstrate the issue : https://github.com/sammyfreg/hello-world
- Install the Chocolatey package manager (optional)
- Using Chocolatey, install make, gcc, clang for Windows (or pick other preferred method)
- Generate makefile projects by calling
TestBuilb\Generate.bat - Compile projects, using
TestBuild\Build\MakefileBuildAll.bat - Observe the errors tied to linking with the library project
Results
- GCC:
I had to manually set the library extensions to '.a' in "TestBuild\Generate\shared.sharpmake.cs : 193".
Otherwise the linking fails with filename prefixed with a 'lib' and postfixed with a '.a'
xxx/bin/ld.exe: cannot find -l:libExampleLib_Release.lib.aThis is becauseExampleLib_Release.libis outputed, but trying to link withlibExampleLib_Release.lib.a. - CLANG
It fails even with the library extension set.
(Error example when '.a' is not assigned in 'shared.sharpmake.cs : 193')
LINK : fatal error LNK1181: cannot open input file ':libExampleLib_Retail.lib.a.lib'(Error example when '.a' is assigned in 'shared.sharpmake.cs : 193')LINK : fatal error LNK1181: cannot open input file ':ExampleLib_Release.a.lib'
Both problems seemed to be caused by the logic in Makefile::FixupLibraryNames()