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

Compile a static executable program #159

Open
yumi-di opened this issue Aug 29, 2023 · 5 comments
Open

Compile a static executable program #159

yumi-di opened this issue Aug 29, 2023 · 5 comments

Comments

@yumi-di
Copy link

yumi-di commented Aug 29, 2023

Hi,
I am trying to compile a static executable program that can run in different Linux environments,
However, I found it difficult to compile static programs because of the TBB library.
Is there a method for compiling static programs? Or is there any suggestion to run the program in different environments.

thanks!

@yumi-di yumi-di changed the title CCompile a static executable program Compile a static executable program Aug 29, 2023
@larsgottesbueren
Copy link
Member

Hi,

Currently there is no method to compile our code to a static binary. It seems that the TBB developers strongly advise against it and do not offer a static library themselves. You can try to roll your own with the steps outlined in https://stackoverflow.com/questions/638278/how-to-statically-link-to-tbb. But I'm guessing you found that link and the associated caveats already. This seems to be the easiest option to run in different environments. We're not planning to move away from TBB any time soon.

Best,
Lars

@uulm-janbaudisch
Copy link
Contributor

Hi,
linking libmtkahypar statically should work though. I tried it by modifying lib/CMakeLists.txt to build a static version of libmtkahypar and linking it to my executable, but still linking TBB dynamically.
Would it be acceptable for this project to include the possibility for a static library?

@larsgottesbueren
Copy link
Member

I think that should be fine. We're happy to take contributions.

@uulm-janbaudisch
Copy link
Contributor

Implemented in #161.

@uulm-janbaudisch
Copy link
Contributor

uulm-janbaudisch commented Oct 17, 2023

Assuming #161 is implemented correctly, it currently leads to the following behaviour:

The dynamic version (BUILD_SHARED_LIBS=ON) works fine (tested with lib/examples/partition_graph.cc), but using the static version (BUILD_SHARED_LIBS=OFF), which builds correctly, it exits with the following error message:

Could not load mt_kahypar::CoarseningAlgorithm :  multilevel_coarsener

So basically the same code behaves differently when used as a shared or static library.

I am not familiar enough with this project to pin down the issue and I understand that supporting a static version of the library interface is not a priority but maybe someone has an idea on what the issue could be.

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

No branches or pull requests

3 participants