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

"fixed" static linking of libllvm and julia #41276

Merged
merged 1 commit into from
Aug 24, 2021
Merged

Conversation

vogt31337
Copy link
Contributor

Hi,

I'm not a professional make file creator, so this will be a not optimal solution. But it worked in my case: I had the problem running julia together with python + numba. Which always died with a seg fault. Since julia's version of llvm isn't compatible with the versions of numba (llvmlite); Even when you use the exact same versions, at least on linux.
I tested: numba 0.53 + llvmlite 0.36 (libllvm10) and julia 1.6.1 -> seg fault.
Next try: numba 0.50.1 + llvmlite 0.33 (libllvm9 9.0.1) and julia 1.5.4 (libllvm9 9.0.1jl) -> seg fault.

Only solution, static compilation of julia 1.5.4 which is broken, but this pr fixed it for my setup (similar to #32665).

BR

@friederikemeier
Copy link

Thank you so much for this fix!

@ViralBShah ViralBShah added the building Build system, or building Julia or its dependencies label Jun 27, 2021
@ViralBShah
Copy link
Member

I believe we want this perhaps to be controlled by a build flag and not change this globally for everyone.

cc @staticfloat @vchuravy

@vchuravy
Copy link
Member

This will break quite a few Julia packages such as LLVM.jl and it's dependent's. Can I ask where you got Julia from/how you built it? We are using symbol versioning to prevent Julia's LLVM to conflict with a system LLVM, but I have seen other build configurations ignoring the necessary flags.

Copy link
Member

@vchuravy vchuravy left a comment

Choose a reason for hiding this comment

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

There a users who depend on the dynamic library built so I don't think we can do this generally.

@vchuravy
Copy link
Member

In particular see #39390

@ViralBShah ViralBShah added the DO NOT MERGE Do not merge this PR! label Jun 27, 2021
@ViralBShah
Copy link
Member

Just adding a Do Not Merge label to caution against merging until the issues are discussed and sorted.

@yuyichao
Copy link
Contributor

I believe we want this perhaps to be controlled by a build flag and not change this globally for everyone.

But this doesn't change things globally and only for USE_LLVM_SHLIB=0??

@staticfloat
Copy link
Member

If USE_LLVM_SHLIB=0 is set, linking things as statically as possible makes sense to me. I am curious as to why the symbol versioning didn't work though, as if we can retain linking dynamically, that will help with JLLs that expect libLLVM.so to exist.

@vogt31337
Copy link
Contributor Author

This will break quite a few Julia packages such as LLVM.jl and it's dependent's. Can I ask where you got Julia from/how you built it? We are using symbol versioning to prevent Julia's LLVM to conflict with a system LLVM, but I have seen other build configurations ignoring the necessary flags.

I've downloaded the versions from the homepage. Building I've done like described on the webpage / README files.
Regarding symboling I thought this would be the case, but It wasn't. It simply seg faulted on starting.

There a users who depend on the dynamic library built so I don't think we can do this generally.

Then trying USE_LLVM_SHLIB=0 didn't work because of errors in the makefiles, hence this Merge request. I tried making it, so that this flag works again (so that it won't statically link generally). As stated earlier I'm no expert in make files. But these fixes worked for me and everything started without seg faulting.

I've used the quite old version 1.5.4 since our stuff is tested on this version. I think this should also work with the most recent version.

@vogt31337 vogt31337 requested a review from vchuravy July 7, 2021 12:00
@vchuravy
Copy link
Member

vchuravy commented Jul 7, 2021

I've downloaded the versions from the homepage. Building I've done like described on the webpage / README files.
Regarding symboling I thought this would be the case, but It wasn't. It simply seg faulted on starting.

Did you only try 1.5 or also 1.6? Can you post the seqfault?

@vchuravy vchuravy requested review from staticfloat and removed request for vchuravy July 7, 2021 12:32
@vchuravy vchuravy removed the DO NOT MERGE Do not merge this PR! label Jul 7, 2021
Copy link
Member

@vchuravy vchuravy left a comment

Choose a reason for hiding this comment

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

Does llvm-config --system-libs not include pthread?

@vchuravy vchuravy dismissed their stale review July 7, 2021 12:36

withdrawn

@staticfloat
Copy link
Member

Does llvm-config --system-libs not include pthread?

With the default BB build, it does not. With this branch and USE_LLVM_SHLIB=0 USE_BINARYBUILDER_LLVM=0, I get the following:

$ ./usr/tools/llvm-config --system-libs
-lrt -ldl -lpthread -lm

@vtjnash vtjnash closed this Aug 24, 2021
@vtjnash
Copy link
Member

vtjnash commented Aug 24, 2021

-pthreads is not needed on most platforms / compilers, though for some it is required

@vtjnash vtjnash reopened this Aug 24, 2021
@vtjnash vtjnash merged commit 47c5d62 into JuliaLang:master Aug 24, 2021
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Feb 22, 2022
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
building Build system, or building Julia or its dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants