As discovered in D56774 the command line gets to long, so use a response file to give the script the libs. This change has been tested and is confirmed working for me.
Cheers, Jakob.
Differential D56781
Use response file when generating LLVM-C.dll Wallbraker on Jan 16 2019, 5:49 AM. Authored by
Details As discovered in D56774 the command line gets to long, so use a response file to give the script the libs. This change has been tested and is confirmed working for me. Cheers, Jakob.
Diff Detail Event Timeline
Comment Actions I actually tried the patch and got CMake Error at tools/llvm-shlib/CMakeLists.txt:144 (file): file failed to open for writing (Invalid argument): C:/src/llvm/build.shlib/$(Configuration)/lib/LLVMDemangle.lib since the whole purpose is to create llvm-c.dll for Windows, I image you have a Windows box somewhere to test this with :-) Comment Actions Thanks for doing that and your patience!
Well that error message is because of me missing the file argument, now I am quite worried about $(Configuration) tho where is that coming from? :(
Ugh, I guess I have to set a windows box up. I'm doing that so that I and any of the users of my projects that uses LLVM don't have to go through the quite painful procedure of building LLVM on Windows. But yeah I was hoping nothing had broken since I last tested this. Comment Actions Not tested, will address last comment and then setup something I can test this on.
Comment Actions Should address all of the comments, haven't done anything about the $(Configuration) @hans saw in the error message. Will setup something to test this. Comment Actions Have now tested this patch and confirmed that it is working for me at least. Needed to make the libs argument optional or the python script would error out and correct splitLines to splitlines. I did not see any sign of $(Configuration) in my scripts. Comment Actions @hans @serge-sans-paille So I built the package and has verified that the LLVM-C.dll is included in the package but I could not find the LLVM-C.lib file tho. After some hours of digging through the multitude of *.cmake files I have to admit defeat on how to get that in there, any pointers would be very much welcome. Comment Actions Thanks, this should fix all concerns raised, I tested this as well and seems to work. Still need help with shipping the LLVM-C.lib in the windows installer, while that isn't super necessary it will help people using it. Comment Actions I encounter similar issue, a weird $(Configuration) appears in my build folder. The source is clone from https://github.com/llvm/llvm-project Sorry for the Chinese error message. But all you should be aware are "警告" is "Warning", "错误" is "Error" and "失败" is "Failed" 28>PrepareForBuild: 正在创建目录“x64\RelWithDebInfo\LLVM-C_exports\”。 正在创建目录“x64\RelWithDebInfo\LLVM-C_exports\LLVM-C_exports.tlog\”。 InitializeBuildStatus: 正在创建“x64\RelWithDebInfo\LLVM-C_exports\LLVM-C_exports.tlog\unsuccessfulbuild”,因为已指定“AlwaysCreate”。 CustomBuild: Generating export list for LLVM-C Traceback (most recent call last): File "D:/workspaces/llvm-project/llvm/tools/llvm-shlib/gen-msvc-exports.py", line 116, in <module> main() File "D:/workspaces/llvm-project/llvm/tools/llvm-shlib/gen-msvc-exports.py", line 109, in main with open(ns.libsfile) as f: FileNotFoundError: [Errno 2] No such file or directory: 'D:/workspaces/llvm-project/build/llvm/RelWithDebInfo/ libllvm-c.args' 28>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targe ts(209,5): error MSB6006: “cmd.exe”已退出,代码为 1。 [D:\workspaces\llvm-project\build\llvm\tools\llvm-shlib\LLVM-C_exp orts.vcxproj] 28>已完成生成项目“D:\workspaces\llvm-project\build\llvm\tools\llvm-shlib\LLVM-C_exports.vcxproj”(默认目标)的操作 - 失败。 8>已完成生成项目“D:\workspaces\llvm-project\build\llvm\tools\llvm-shlib\LLVM-C.vcxproj”(默认目标)的操作 - 失败。 1>已完成生成项目“D:\workspaces\llvm-project\build\llvm\ALL_BUILD.vcxproj”(默认目标)的操作 - 失败。 生成失败。 “D:\workspaces\llvm-project\build\llvm\ALL_BUILD.vcxproj”(默认目标) (1) -> “D:\workspaces\llvm-project\build\llvm\tools\llvm-shlib\LLVM-C.vcxproj”(默认目标) (8) -> “D:\workspaces\llvm-project\build\llvm\tools\llvm-shlib\LLVM-C_exports.vcxproj”(默认目标) (28) -> “D:\workspaces\llvm-project\build\llvm\lib\DebugInfo\DWARF\LLVMDebugInfoDWARF.vcxproj”(默认目标) (56) -> (ClCompile 目标) -> D:\workspaces\llvm-project\llvm\lib\DebugInfo\DWARF\DWARFVerifier.cpp(834): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss [D:\workspaces\llvm-project\build\llvm\lib\DebugInfo\DWARF\LLVMDebugInfoDWARF.vcxproj] “D:\workspaces\llvm-project\build\llvm\ALL_BUILD.vcxproj”(默认目标) (1) -> “D:\workspaces\llvm-project\build\llvm\tools\llvm-shlib\LLVM-C.vcxproj”(默认目标) (8) -> “D:\workspaces\llvm-project\build\llvm\tools\llvm-shlib\LLVM-C_exports.vcxproj”(默认目标) (28) -> (CustomBuild 目标) -> C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.tar gets(209,5): error MSB6006: “cmd.exe”已退出,代码为 1。 [D:\workspaces\llvm-project\build\llvm\tools\llvm-shlib\LLVM-C_e xports.vcxproj] 1 个警告 1 个错误 已用时间 00:56:59.07 This line should be highlighted: FileNotFoundError: [Errno 2] No such file or directory: 'D:/workspaces/llvm-project/build/llvm/RelWithDebInfo/libllvm-c.args' The file libllvm-c.args lives in D:\workspaces\llvm-project\build\llvm\$(Configuration)\libllvm-c.args After manually copying the file to where it should be and rebuild with cmake --build . --config RelWithDebInfo -- /m 19>D:/workspaces/llvm-project/build/llvm/RelWithDebInfo/bin\llvm-nm.exe : error : D:/workspaces/llvm-project/build/ llvm/$(Configuration)/lib/LLVMDemangle.lib: no such file or directory. [D:\workspaces\llvm-project\build\llvm\to ols\llvm-shlib\LLVM-C_exports.vcxproj] FinalizeBuildStatus: 正在删除文件“opt.dir\RelWithDebInfo\opt.tlog\unsuccessfulbuild”。 正在对“opt.dir\RelWithDebInfo\opt.tlog\opt.lastbuildstate”执行 Touch 任务。 259>已完成生成项目“D:\workspaces\llvm-project\build\llvm\tools\opt\opt.vcxproj”(默认目标)的操作。 19>CustomBuild: Traceback (most recent call last): File "D:/workspaces/llvm-project/llvm/tools/llvm-shlib/gen-msvc-exports.py", line 116, in <module> main() File "D:/workspaces/llvm-project/llvm/tools/llvm-shlib/gen-msvc-exports.py", line 112, in main gen_llvm_c_export(ns.output, ns.underscore, libs, ns.nm) File "D:/workspaces/llvm-project/llvm/tools/llvm-shlib/gen-msvc-exports.py", line 72, in gen_llvm_c_export check_call([nm, '-g', lib], stdout=dumpout_f) File "C:\Users\cloud\Miniconda3\lib\subprocess.py", line 328, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['D:/workspaces/llvm-project/build/llvm/RelWithDebInfo/bin/llvm-nm', ' -g', 'D:/workspaces/llvm-project/build/llvm/$(Configuration)/lib/LLVMDemangle.lib']' returned non-zero exit st atus 1. 失败。 7>已完成生成项目“D:\workspaces\llvm-project\build\llvm\tools\llvm-shlib\LLVM-C.vcxproj”(默认目标)的操作 - 失败。 256>Link: 所有输出均为最新。 llvm-xray.vcxproj -> D:\workspaces\llvm-project\build\llvm\RelWithDebInfo\bin\llvm-xray.exe FinalizeBuildStatus: 正在删除文件“llvm-xray.dir\RelWithDebInfo\llvm-xray.tlog\unsuccessfulbuild”。 正在对“llvm-xray.dir\RelWithDebInfo\llvm-xray.tlog\llvm-xray.lastbuildstate”执行 Touch 任务。 256>已完成生成项目“D:\workspaces\llvm-project\build\llvm\tools\llvm-xray\llvm-xray.vcxproj”(默认目标)的操作。 1>已完成生成项目“D:\workspaces\llvm-project\build\llvm\ALL_BUILD.vcxproj”(默认目标)的操作 - 失败。 生成失败。 “D:\workspaces\llvm-project\build\llvm\ALL_BUILD.vcxproj”(默认目标) (1) -> “D:\workspaces\llvm-project\build\llvm\tools\llvm-shlib\LLVM-C.vcxproj”(默认目标) (7) -> “D:\workspaces\llvm-project\build\llvm\tools\llvm-shlib\LLVM-C_exports.vcxproj”(默认目标) (19) -> (CustomBuild 目标) -> D:/workspaces/llvm-project/build/llvm/RelWithDebInfo/bin\llvm-nm.exe : error : D:/workspaces/llvm-project/buil d/llvm/$(Configuration)/lib/LLVMDemangle.lib: no such file or directory. [D:\workspaces\llvm-project\build\llvm\ tools\llvm-shlib\LLVM-C_exports.vcxproj] 0 个警告 1 个错误 已用时间 00:00:40.21 I think this should be a related issue , Comment Actions This change is causing build failures on Windows when using Visual Studio as the generator. It would also cause the same failure on for any other generator that supports multiple configurations. The problem is that CMAKE_CFG_INTDIR changes value based on the tool (https://cmake.org/cmake/help/v3.13/variable/CMAKE_CFG_INTDIR.html) AND in the case of a generator that supports multiple configurations, it has a place-holder value (such as $(Configuration)) since the configuration is not known when CMake is invoked - the configuration is determined at build time. You can look at other places in LLVM (or LLDB) where CMAKE_CFG_INTDIR is used to see a couple of ways that it can be handled. For example in llvm-lit: if(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".") foreach(BUILD_MODE ${CMAKE_CONFIGURATION_TYPES}) string(REPLACE ${CMAKE_CFG_INTDIR} ${BUILD_MODE} bi ${LIT_BASE_DIR}) set(bi "${bi}/${LIT_FILE_NAME}") configure_file( llvm-lit.in ${bi} ) endforeach() else() set(BUILD_MODE .) configure_file( llvm-lit.in ${LIT_BASE_DIR}/${LIT_FILE_NAME} ) endif() I can help test a fix when you have one - in the mean time, this change should probably be reverted since multiple people are seeing the issue. Comment Actions Okay, I have updated the patch now with the suggestions from @stella.stamenova, thanks! Please try it out, I'm currently running a build myself using ninja to make sure that it still works.
Comment Actions This should fix it, doing a build now.
|
You could do the merge in the end to keep the formating stuff in a single place:
string(REPLACE ";" "\n" FILE_CONTENT "${FULL_LIB_NAMES}")