[PATCH] D155796: [polly] CYGWIN: fix build error about PIC code.
Carlo Bramini via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 1 05:58:21 PDT 2023
carlo-bramini added a comment.
In D155796#4621721 <https://reviews.llvm.org/D155796#4621721>, @efriedma wrote:
> 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.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155796/new/
https://reviews.llvm.org/D155796
More information about the llvm-commits
mailing list