Skip to content

Allow static linking of LLVM#2270

Closed
winksaville wants to merge 1 commit intoziglang:masterfrom
winksaville:allow-static-linking-of-llvm
Closed

Allow static linking of LLVM#2270
winksaville wants to merge 1 commit intoziglang:masterfrom
winksaville:allow-static-linking-of-llvm

Conversation

@winksaville
Copy link
Contributor

Add LLVM_STATIC and update README.md.

Add LLVM_STATIC and update README.md.
And if statically linking LLVM:
```
cmake .. -DCMAKE_PREFIX_PATH=$HOME/local -DLLVM_STATIC=on
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I'm wrong but this section only applies when -DCMAKE_BUILD_TYPE=Debug is also passed? Release builds seem to link statically against llvm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@andrewrk
Copy link
Member

Can you describe what problem you are trying to solve?

@winksaville
Copy link
Contributor Author

@andrewrk, I think its a good idea that Debug and Release both be able to be statically linked. Although, as you can see here that isn't always possible.

My vote would actually be to default to statically link LLVM and allow dynamic if desired/needed.

@emekoi
Copy link
Contributor

emekoi commented Apr 16, 2019

i thought that was the status quo?

Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch @winksaville. I'm on board with this new option but I have some strong opinions about the way to expose it and the documentation - see review comments.

# git log -p -- deps/lld
option(ZIG_FORCE_EXTERNAL_LLD "If your system has the LLD patches use it instead of the embedded LLD" OFF)

set(LLVM_STATIC off CACHE BOOL "Link LLVM statically")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's put this next to the corresponding ZIG_STATIC option, rename it to ZIG_STATIC_LLVM, and improve the documentation string. "Prefer linking against static LLVM libraries".

@andrewrk
Copy link
Member

Please feel free to re-open this PR with the requested changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants