FS#62624 - clang package is using BUILD_SHARED_LIBS=ON but this is an unsupported configuration
Attached to Project:
Arch Linux
Opened by Wink Saville (winksaville) - Monday, 13 May 2019, 19:35 GMT
Last edited by Evangelos Foutras (foutrelis) - Friday, 24 May 2019, 09:23 GMT
Opened by Wink Saville (winksaville) - Monday, 13 May 2019, 19:35 GMT
Last edited by Evangelos Foutras (foutrelis) - Friday, 24 May 2019, 09:23 GMT
|
Details
Description:
I was unable to build Zig (https://ziglang.org) unless I built llvm and clang myself. The reason is that the only supported clang configuration is statically linking with libclang*.a files. Using BUILD_SHARED_LIBS=ON is not a supported configuration for any of the llvm tools as stated in [building LLVM with CMake](https://llvm.org/docs/CMake.html): ``` BUILD_SHARED_LIBS is only recommended for use by LLVM developers. If you want to build LLVM as a shared library, you should use the LLVM_BUILD_LLVM_DYLIB option. ``` So Zig needs the libclang*.a files to build, but those aren't available in the clang package: ``` $ ls /usr/lib/libclang*.a ls: cannot access '/usr/lib/libclang*.a': No such file or directory ``` Only the libclang*.so files are available ``` $ ls /usr/lib/libclang*.so /usr/lib/libclangAnalysis.so /usr/lib/libclangFrontendTool.so /usr/lib/libclangStaticAnalyzerCheckers.so /usr/lib/libclangTidyObjCModule.so /usr/lib/libclangApplyReplacements.so /usr/lib/libclangHandleCXX.so /usr/lib/libclangStaticAnalyzerCore.so /usr/lib/libclangTidyPerformanceModule.so /usr/lib/libclangARCMigrate.so /usr/lib/libclangHandleLLVM.so /usr/lib/libclangStaticAnalyzerFrontend.so /usr/lib/libclangTidyPlugin.so /usr/lib/libclangASTMatchers.so /usr/lib/libclangIncludeFixerPlugin.so /usr/lib/libclangTidyAbseilModule.so /usr/lib/libclangTidyPortabilityModule.so /usr/lib/libclangAST.so /usr/lib/libclangIncludeFixer.so /usr/lib/libclangTidyAndroidModule.so /usr/lib/libclangTidyReadabilityModule.so /usr/lib/libclangBasic.so /usr/lib/libclangIndex.so /usr/lib/libclangTidyBoostModule.so /usr/lib/libclangTidy.so /usr/lib/libclangChangeNamespace.so /usr/lib/libclangLex.so /usr/lib/libclangTidyBugproneModule.so /usr/lib/libclangTidyUtils.so /usr/lib/libclangCodeGen.so /usr/lib/libclangMove.so /usr/lib/libclangTidyCERTModule.so /usr/lib/libclangTidyZirconModule.so /usr/lib/libclangCrossTU.so /usr/lib/libclangParse.so /usr/lib/libclangTidyCppCoreGuidelinesModule.so /usr/lib/libclangToolingASTDiff.so /usr/lib/libclangDaemon.so /usr/lib/libclangQuery.so /usr/lib/libclangTidyFuchsiaModule.so /usr/lib/libclangToolingCore.so /usr/lib/libclangDoc.so /usr/lib/libclangReorderFields.so /usr/lib/libclangTidyGoogleModule.so /usr/lib/libclangToolingInclusions.so /usr/lib/libclangDriver.so /usr/lib/libclangRewriteFrontend.so /usr/lib/libclangTidyHICPPModule.so /usr/lib/libclangToolingRefactor.so /usr/lib/libclangDynamicASTMatchers.so /usr/lib/libclangRewrite.so /usr/lib/libclangTidyLLVMModule.so /usr/lib/libclangTooling.so /usr/lib/libclangEdit.so /usr/lib/libclangSema.so /usr/lib/libclangTidyMiscModule.so /usr/lib/libclangFormat.so /usr/lib/libclangSerialization.so /usr/lib/libclangTidyModernizeModule.so /usr/lib/libclangFrontend.so /usr/lib/libclang.so /usr/lib/libclangTidyMPIModule.so ``` Additional info: * package version(s): A quick look at the history of PKGBUILD, this has been the case at least since clang was split from llvm in March 2018 with change ca81062dc3ce320dfd7ff52bd40d56ebc304d698. * link to upstream: See [D61804](https://reviews.llvm.org/D61804) where I'm investigating a solution which both static and shared libs can be built. Steps to reproduce: Install clang with pacman and try to build a program that needs libclang*.a, such as Zig. |
This task depends upon
Closed by Evangelos Foutras (foutrelis)
Friday, 24 May 2019, 09:23 GMT
Reason for closing: Deferred
Additional comments about closing: Will revisit this when clang 9 is out.
Friday, 24 May 2019, 09:23 GMT
Reason for closing: Deferred
Additional comments about closing: Will revisit this when clang 9 is out.
Of course, if CLANG_LINK_CLANG_DYLIB is introduced upstream in clang 9, I'll switch to that.
And I think this turns off creating a stage2 compiler: https://git.archlinux.org/svntogit/community.git/tree/trunk/no_stage2_artifacts.patch?h=packages/zig.
Not a great solution.
@foutrelis, have you had time to look at the new documentation being prepared (https://reviews.llvm.org/D62040),
it would be great to get your perspective?
Without BUILD_SHARED_LIBS=ON the clang package (which includes clang-tools-extra to address
FS#50865) would grow to about 770 MiB which is too large.Also note that the patch to avoid "--link-static" is for linking to libLLVM.so. Zig finds the shared clang libraries without modification, though it likely fails to run when mixing those with static LLVM libraries.
I'll close this if you don't mind, with the intention of transitioning to CLANG_LINK_CLANG_DYLIB if it becomes available in clang 9.
[1] https://reviews.llvm.org/D61909#1501733