-
Notifications
You must be signed in to change notification settings - Fork 12.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[llvm-config] Make llvm-config --system-libs obey LLVM_USE_STATIC_ZSTD. #93754
Conversation
@llvm/pr-subscribers-llvm-support Author: Kyle Huey (khuey) ChangesLLVM's build system does the right thing but LLVM_SYSTEM_LIBS ends up containing the shared library. Emit the static library instead when appropriate. CC @MaskRay since zstd compression is relevant to his interests. Full diff: https://github.com/llvm/llvm-project/pull/93754.diff 1 Files Affected:
diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index 03e888958a071..1ab5bd370c480 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -321,8 +321,12 @@ if(LLVM_ENABLE_ZSTD)
if(NOT zstd_library)
get_property(zstd_library TARGET ${zstd_target} PROPERTY LOCATION)
endif()
- get_library_name(${zstd_library} zstd_library)
- set(llvm_system_libs ${llvm_system_libs} "${zstd_library}")
+ if (zstd_target STREQUAL zstd::libzstd_shared)
+ get_library_name(${zstd_library} zstd_library)
+ set(llvm_system_libs ${llvm_system_libs} "${zstd_library}")
+ else()
+ set(llvm_system_libs ${llvm_system_libs} "${zstd_STATIC_LIBRARY}")
+ endif()
endif()
if(LLVM_ENABLE_TERMINFO)
|
Bump. @MaskRay if you don't have time to look at this yourself can you at least refer it to someone who does? I can't set reviewers on this PR. |
Sorry. I receive a lot of review requests. When I am not added as a reviewer, I can easily miss a PR that requires my attention... Weekly ping is fine.
Can you edit the description to show I checked that this patch does change the output of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see anything wrong with it, though I really hate that we have to do things like that.
LLVM's build system does the right thing but LLVM_SYSTEM_LIBS ends up containing the shared library. Emit the static library instead when appropriate. With LLVM_USE_STATIC_ZSTD, before: khuey@zhadum:~/dev/llvm-project/build$ ./bin/llvm-config --system-libs -lrt -ldl -lm -lz -lzstd -lxml2 after: khuey@zhadum:~/dev/llvm-project/build$ ./bin/llvm-config --system-libs -lrt -ldl -lm -lz /usr/local/lib/libzstd.a -lxml2
Rebased and updated the commit message per @MaskRay's request. |
Thx. GitHub "Squash and merge" populates the default commit message with the content of the first comment. |
llvm#93754) LLVM's build system does the right thing but LLVM_SYSTEM_LIBS ends up containing the shared library. Emit the static library instead when appropriate. With LLVM_USE_STATIC_ZSTD, before: khuey@zhadum:~/dev/llvm-project/build$ ./bin/llvm-config --system-libs -lrt -ldl -lm -lz -lzstd -lxml2 after: khuey@zhadum:~/dev/llvm-project/build$ ./bin/llvm-config --system-libs -lrt -ldl -lm -lz /usr/local/lib/libzstd.a -lxml2 (cherry-picked from 0f24a46)
llvm#93754) LLVM's build system does the right thing but LLVM_SYSTEM_LIBS ends up containing the shared library. Emit the static library instead when appropriate. With LLVM_USE_STATIC_ZSTD, before: khuey@zhadum:~/dev/llvm-project/build$ ./bin/llvm-config --system-libs -lrt -ldl -lm -lz -lzstd -lxml2 after: khuey@zhadum:~/dev/llvm-project/build$ ./bin/llvm-config --system-libs -lrt -ldl -lm -lz /usr/local/lib/libzstd.a -lxml2 (cherry-picked from 0f24a46)
llvm#93754) LLVM's build system does the right thing but LLVM_SYSTEM_LIBS ends up containing the shared library. Emit the static library instead when appropriate. With LLVM_USE_STATIC_ZSTD, before: khuey@zhadum:~/dev/llvm-project/build$ ./bin/llvm-config --system-libs -lrt -ldl -lm -lz -lzstd -lxml2 after: khuey@zhadum:~/dev/llvm-project/build$ ./bin/llvm-config --system-libs -lrt -ldl -lm -lz /usr/local/lib/libzstd.a -lxml2
llvm#93754) LLVM's build system does the right thing but LLVM_SYSTEM_LIBS ends up containing the shared library. Emit the static library instead when appropriate. With LLVM_USE_STATIC_ZSTD, before: khuey@zhadum:~/dev/llvm-project/build$ ./bin/llvm-config --system-libs -lrt -ldl -lm -lz -lzstd -lxml2 after: khuey@zhadum:~/dev/llvm-project/build$ ./bin/llvm-config --system-libs -lrt -ldl -lm -lz /usr/local/lib/libzstd.a -lxml2
LLVM's build system does the right thing but LLVM_SYSTEM_LIBS ends up containing the shared library. Emit the static library instead when appropriate.
CC @MaskRay since zstd compression is relevant to his interests.