-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Properly lookup .lib files on command line on MS/Windows. #11906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
assigned to @Bigcheese |
FYI, mingw-gcc can accept foo.lib as -lfoo |
Hello Michael and Nakamura, I'am new to llvm/clang and I have the same issue. I have recently compiled the llvm/clang source with vc++, and try to do I use the linker from vc, and I have the issue with libcmt and kernel32. For now I do clang -c t.c/link -out:t.exe -defaultlib:libcmt -nologo /LIBPATH: /LIBPATH: t.o I saw two options with clang, to pass argument to the linker, but it seem that doesn't work (or maybe just for gcc ?), what does this two options must be do ? |
Clang does -defaultlib:libcmt, which is enough for hello world.
They don't work because I never hooked them up. See https://github.com/Bigcheese/clang/blob/cmake-revision/lib/Driver/Tools.cpp#L5373 for where that needs to be added. |
Ok, thank you I didn't know.
Ok, I will see this file, and the clang technical documentation, to see how I can add this new feature. Thank you |
clang -target "x86_64-pc-win32" doesn't even find the right libcmt.lib, because %LIBPATH% points to C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib where the 32-bit libs are. The correct libcmt.lib is C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib\amd64\libcmt.lib If running inside "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64\vcvars64.bat", which sets the right %LIBPATH%, it works fine (minus exception handling). Note that also the path to link.exe should change to "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64\link.exe" and add /MACHINE:X64 to the cmdline. But within vcvars64.bat, it works either way. Therefore one idea is to setup the environment using vcvars*.bat instead that clang finds the correct parameters itself. |
Shouldn't this bug be closed? clang-cl already handles .lib files. |
Yep. |
mentioned in issue llvm/llvm-bugzilla-archive#13707 |
Extended Description
Given:
$clang++ file.cpp kernel32.lib
Clang currently prints:
clang++: error: no such file or directory: 'kernel32.lib'
It should look up the library in the same manner as cl.exe.
The text was updated successfully, but these errors were encountered: