Cygwin shares the same limitations as traditional Windows executables for dynamic library loading, so disable building the dynamic library on Cygwin targets.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I don't see how PIC is related to anything; can you fix the commit message to explain this is a Windows (PE/COFF) issue?
Well, I configured the sources with:
cmake ../llvm-project/llvm -G Ninja -DCMAKE_BUILD_TYPE=Release -Wno-dev -DBUILD_SHARED_LIBS=ON -DLLVM_ENABLE_PROJECTS="polly"
When linking the last file, which is lib/LLVMPolly.dll, the build process stops with thousands of error messages saying "undefined reference to xxx".
I found two solutions for this problem:
(1) I did the same change it has been done for WIN32 into those CMakeLists.txt files.
It won't emit errors, but lib/LLVMPolly.dll is not built anymore.
That's why it works.
I don't know why it has been done for WIN32, but perhaps this is the expected behaviour.
(2) first, I executed:
ninja -j1 -v
and I grabbed the command line that it is used for linking lib/LLVMPolly.dll.
It is interesting to notice that there are not additional libraries as dependecy on this command line, just object files.
Then, I copied and pasted that command line and I added these libraries at the bottom:
lib/libLLVMCore.dll.a lib/libLLVMSupport.dll.a lib/libLLVMAnalysis.dll.a lib/libLLVMTransformUtils.dll.a lib/libLLVMPasses.dll.a lib/libLLVMScalarOpts.dll.a lib/libLLVMPasses.dll.a lib/libLLVMInstCombine.dll.a lib/libLLVMipo.dll.a lib/libLLVMTarget.dll.a lib/libLLVMTargetParser.dll.a
By doing so, lib/LLVMPolly.dll is linked successfully.
Actually, I have choosen the fastest solution to be used as a patch, because, as it is written, this is done also on WIN32, although the second one would be prefered.
Perhaps, the choice to avoid the final linking had some reasons, but I don't know what they are or if there is a bug hidden somewhere into the cmake scripts or elsewhere, sorry.
I attempted to fix the commit message for you; let me know if it makes sense to you.
Otherwise LGTM; how do you want to be credited in the git "author" line?
The title looks good to me.
Otherwise LGTM; how do you want to be credited in the git "author" line?
real name: Carlo Bramini
email address: carlo_bramini@users.sourceforge.net