[cfe-dev] Shared Debug Builds MSYS2 MinGW-w64 constant Link Error

Michael Kruse via cfe-dev cfe-dev at lists.llvm.org
Wed May 12 20:10:45 PDT 2021


BUILD_SHARED_LIBS=ON is an unsupported configuration, only used by
developers who want to keep the link times down. DLL builds on Windows
generally is unsupported because imported symbols needs to specify the
library filename that exports it, and there is a limit of 2^16
exported symbols which unfortunately LLVM exceeds.

Michael

Am Mi., 12. Mai 2021 um 00:07 Uhr schrieb Oliver Niebuhr (2nd Account)
via cfe-dev <cfe-dev at lists.llvm.org>:
>
> Hello.
>
> As Static Debug Builds only work with MSVC, I am forced to use Shared-Libs with GCC on MSYS2.
>
> The Problem is, it always Fails at this exact stage:
>
> FAILED: bin/BugpointPasses.dll
> cmd.exe /C "cd . && C:\Dev\msys64\mingw64\bin\g++.exe -Wa,-mbig-obj -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -fasynchronous-unwind-tables -finput-charset=utf-8 -fno-lto -fno-omit-frame-pointer -grecord-gcc-switches -pthread -Og -g1 -ggdb -pipe -Wall -Wl,-Og -Wl,--allow-multiple-definition -Wl,--build-id=sha1 -Wl,--dynamicbase -Wl,--enable-auto-image-base -Wl,-fno-lto -Wl,--high-entropy-va -Wl,--nxcompat -Wa,-mbig-obj -Wl,-Bdynamic C:/Dev/Builds/LLVMx64DebugSrc/tools/bugpoint-passes/BugpointPasses.def -shared -o bin\BugpointPasses.dll -Wl,--major-image-version,0,--minor-image-version,0 tools/bugpoint-passes/CMakeFiles/BugpointPasses.dir/TestPasses.cpp.obj lib/libLLVMCore.dll.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
> C:/Dev/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tools/bugpoint-passes/CMakeFiles/BugpointPasses.dir/TestPasses.cpp.obj: in function `llvm::CallBase::getNumSubclassExtraOperands() const':
> C:/Dev/GitRepos/llvm-project/llvm/include/llvm/IR/InstrTypes.h:1198: undefined reference to `llvm::llvm_unreachable_internal(char const*, char const*, unsigned int)'
> collect2.exe: error: ld returned 1 exit status
>
> Sys Config:
> * Windows 10 21H1, x86_64
> * MSYS2, MinGW-w64, 10.3.0, x86_64
> * CMake 3.20.2 MinGW-w64 prebuilt, x86_64
> * Ninja 1.10.2 MinGW-w64 prebuilt, x86_64
> * LLVM 12.x Git Source
> * Building from MSYS2 MinGW64 Shell
> * Static Release Builds of LLVM/Clang for x86 and x86_64 are working just fine
>
> Latest CMake Config Flags tested:
> cmake ${SYSTEMDRIVE}/Dev/GitRepos/llvm-project/llvm/ ${SYSTEMDRIVE}/Dev/Builds/LLVMx64DebugSrc/ -G'Ninja' -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_C_FLAGS_DEBUG='-fasynchronous-unwind-tables -finput-charset=utf-8 -fno-lto -fno-omit-frame-pointer -grecord-gcc-switches -pthread -Og -g1 -ggdb -pipe -Wall -Wl,-Og -Wl,--allow-multiple-definition -Wl,--build-id=sha1-Wl,--dynamicbase -Wl,--enable-auto-image-base -Wl,-fno-lto -Wl,--high-entropy-va -Wl,--nxcompat -Wa,-mbig-obj -Wl,-Bdynamic' -DCMAKE_CXX_FLAGS_DEBUG='-fasynchronous-unwind-tables -finput-charset=utf-8 -fno-lto -fno-omit-frame-pointer -grecord-gcc-switches -pthread -Og -g1 -ggdb -pipe -Wall -Wl,-Og -Wl,--allow-multiple-definition -Wl,--build-id=sha1 -Wl,--default-image-base-high -Wl,--dynamicbase -Wl,--enable-auto-image-base -Wl,-fno-lto -Wl,--high-entropy-va -Wl,--nxcompat -Wa,-mbig-obj -Wl,-Bdynamic' -DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;compiler-rt;lld;lldb;llvm' -DCMAKE_CXX_STANDARD=17 -DCMAKE_INSTALL_PREFIX=${SYSTEMDRIVE}/Dev/Binaries/LLVMx64Debug/ -DCMAKE_BUILD_TYPE='Debug' -DLLVM_TARGETS_TO_BUILD='X86' -DBUILD_SHARED_LIBS='ON' -DLLVM_INCLUDE_EXAMPLES='OFF' -DLLVM_INCLUDE_TESTS='OFF' -DLLVM_INCLUDE_DOCS='OFF' -DLLVM_PARALLEL_COMPILE_JOBS=$(nproc) -DLLVM_PARALLEL_LINK_JOBS=$(nproc) -DLLVM_ENABLE_EH='OFF' -DLLVM_ENABLE_RTTI='OFF' -DLLVM_ENABLE_DIA_SDK='OFF'
>
> But that does only partially matter(?), because even with the DEFAULT FLAGS IT FAILS at this stage. So it seems I am missing something else. Another Compiler Flag? Another Linker Flag? General incompatibility?
>
> Thanks in advance!
> Olli
> cfe-users mailing list
> cfe-users at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
> --
> Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
> --
> Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


More information about the cfe-dev mailing list