Skip to content
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 necessary libraries to static executable #27

Merged
merged 1 commit into from
Feb 1, 2021

Conversation

lanza
Copy link
Contributor

@lanza lanza commented Jan 26, 2021

If you link against a dylib build (e.g. when building in debug mode)
you'll need these.

If you link against a dylib build (e.g. when building in debug mode)
you'll need these.
@banach-space
Copy link
Owner

Thank you for this patch, it addresses an import issue! Interestingly, similar problem was recently raised in clang-tutor.

This looks good to me, but I have a small suggestion:

include(AddLLVM)

set(LLVM_LINK_COMPONENTS
LLVMCore
LLVMIRReader
LLVMSupport
LLVMPasses
)

add_llvm_tool(static
 StaticMain.cpp
 ../lib/StaticCallCounter.cpp
 )

This should work 🤞🏻and would be more canonical. Would you be able to try that? Thank you!

@banach-space
Copy link
Owner

As there's been no traffic here, merging as is. Thank you for contributing @lanza !

@banach-space banach-space merged commit ed05298 into banach-space:master Feb 1, 2021
@lanza
Copy link
Contributor Author

lanza commented Feb 1, 2021

Sorry, this got lost in my inbox. But I'm note sure add_llvm_tool is the right thing here. I know recently, for example, yaml2obj stopped working as a distribution target due to changes to add_llvm_tool. I think the rationale is that an llvm_tool is something used for working on llvm as an llvm developer. A tool like this static is one to be used by developers to run optimizations on their code. So something suitable for distribution.

On top of that, add_llvm_such_and_such is a damn minefield of cmake. And I'd definitely slot it in the old-cmake style and not "modern cmake" with it's implicit dependencies on local variables via macros. If it's not needed for a tool to work properly then I'm a fan of avoiding it.

@lanza lanza deleted the static branch February 1, 2021 19:36
@lanza lanza restored the static branch February 1, 2021 19:36
@lanza lanza deleted the static branch February 1, 2021 19:36
@banach-space
Copy link
Owner

Yeah, I don't understand the rationale behind various LLVM's CMake APIs. And there isn't much documentation.

add_llvm_tool is not needed here, but it's a different story in clang-tutor. I'm slowly digging into it. I also don't want to use it blindly without understanding exactly why it's needed.

Cheers for all the input!

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.

2 participants