-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add quick and dirty support for specifying desired linking mode #6
base: master
Are you sure you want to change the base?
Conversation
if test -z "$default_mode"; then | ||
echo "Something is wrong with the llvm-config command provided." | ||
exit 1 | ||
fi | ||
|
||
base_cflags=$(llvm_config --cflags) | ||
ldflags="$(llvm_config --ldflags) -lstdc++" | ||
ldflags="$(pkg-config --libs-only-L libzstd) $(llvm_config --ldflags) -lstdc++" |
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.
This seems unrelated, but I needed it for linking to libllvm in static mode to succeed.
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.
Is this a LLVM 16 thing? Wouldn't llvm-config --system-libs
work here instead?
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.
llvm-config --link-static --system-libs
does include zstd, giving -lm -lz -lzstd -lcurses -lxml2
, so that looks like the way to go when I get back to this.
CC @alan-j-hu just FYI |
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.
This should work just fine and it looks like it returns something sensible with LLVM-17
|
||
if llvm_config --link-shared --libs; then | ||
default_mode=shared | ||
default_mode=${default_mode:=shared} |
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.
default_mode=${default_mode:=shared} |
support_shared_mode=true | ||
fi | ||
|
||
if llvm_config --link-static --libs; then | ||
default_mode=${default_mode:=static} |
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.
default_mode=${default_mode:=static} |
if test -z "$default_mode"; then | ||
echo "Something is wrong with the llvm-config command provided." | ||
exit 1 | ||
fi | ||
|
||
base_cflags=$(llvm_config --cflags) | ||
ldflags="$(llvm_config --ldflags) -lstdc++" | ||
ldflags="$(pkg-config --libs-only-L libzstd) $(llvm_config --ldflags) -lstdc++" |
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.
ldflags="$(pkg-config --libs-only-L libzstd) $(llvm_config --ldflags) -lstdc++" | |
ldflags="$(llvm_config --link-static --system-libs --ldflags) -lstdc++" |
if test -z "$default_mode"; then | ||
echo "Something is wrong with the llvm-config command provided." | ||
exit 1 | ||
fi |
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.
if test -z "$default_mode"; then | |
echo "Something is wrong with the llvm-config command provided." | |
exit 1 | |
fi | |
if test "(" "${default_mode}" = static -a "${support_static_mode}" = false ")" -o \ | |
"(" "${default_mode}" = shared -a "${support_shared_mode}" = false ")" ; then | |
echo "Mode '${default_mode}' unsupported." | |
exit 1 | |
fi |
This is not worked through diligently enough to merge in its current
state, I'm just sending this PR to share an idea of how to let client
projects specify the desired linking mode to use.