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

when LLVM is dynamically linked, Julia is broken when the runtime LLVM is not the same than the one used for building #2494

Closed
svillemot opened this issue Mar 7, 2013 · 24 comments
Labels
kind:bug Indicates an unexpected problem or unintended behavior
Milestone

Comments

@svillemot
Copy link
Contributor

As of today, the Julia package in Ubuntu (version 0.1) exhibits the following:

julia> 1
000000000000000001

When I first uploaded julia 0.1 into Ubuntu, the problem was not present. But later on, Ubuntu updated their LLVM 3.2 package (with a minor patch), and this problem appeared. I experienced the same issue some time ago in Debian.

The problem is going to disappear temporarily if I manage to upload 0.1.1 into Ubuntu 13.04, but it may reappear if there is another update to LLVM 3.2.

In short, there seems to be a coupling problem between Julia and the system-wide LLVM. Note that the julia binary is linked against shared libraries of LLVM, via the following patch:
http:https://anonscm.debian.org/gitweb/?p=pkg-julia/julia.git;a=blob;f=debian/patches/use-shared-llvm.patch
Statically linking LLVM into Julia is not a reasonable option for a distribution, for various well-known reasons.

Any clues?

In order to debug this, a first step would probably to try to reproduce it outside the Debian/Ubuntu packaging.

@ViralBShah
Copy link
Member

This ought to be some weird bug, and perhaps is a manifestation of some other bug. Julia's behaviour should not change based on whether LLVM is statically or dynamically linked, so long as it is the correct version of LLVM.

@JeffBezanson
Copy link
Sponsor Member

It looks like part of the purpose of the llvm patch was to change the library name from LLVM-3.2svn to LLVM-3.2 :)

There is probably no reliable way to fix this within a day. Does this happen on both 32-bit and 64-bit?

@svillemot
Copy link
Contributor Author

Yes this happens on both 32- and 64-bit.

Since a new binary for LLVM 3.2 has just been uploaded to Debian, the Julia package there is now affected again by the issue.

For me this issue is fairly severe, because it makes Julia distribution-unfriendly. Don't hesitate to ask if I can be of any help to solve it.

@ViralBShah
Copy link
Member

I will see if I can use your patch and create a dynamically linked julia. Our rpath stuff is pretty good now, and it may be ok for us to link dynamically with LLVM.

@svillemot
Copy link
Contributor Author

Actually the problem is more severe than that. For example I sometimes get MemoryError when assigning an element to a dictionary. As a consequence, I have retitled the bug to reflect its wider impact.

Since the bug is making the Debian package unusable, I have decided to statically link LLVM in the Debian package. This is clearly substandard, so I hope we can solve this issue so that I can revert to dynamic linking.

@ViralBShah
Copy link
Member

Would you be able to add an option for USE_LLVM_SHAREDLIBS to the julia build? This should help recreate the error, and also you will not need to maintain it as a separate patch going forward.

Also cc: @staticfloat

@StefanKarpinski
Copy link
Sponsor Member

This is a somewhat unusual case because LLVM isn't really a shared library in the regular sense. It's fundamentally part of the language infrastructure and slight changes in LLVM mess everything up. This seems like a case where static linking might actually be warranted.

@JeffBezanson
Copy link
Sponsor Member

We do certainly require a specific version of llvm at any given time, but it ought to work when dynamically linked. I still have no idea what the problem is here.

@staticfloat
Copy link
Sponsor Member

I'll try reproducing this in the near future.

@ViralBShah
Copy link
Member

While that may be the case, LLVM provides a shared library with a well defined interface. Also, how come the static library works fine but the shared one does not?

Are we the only language with this issue in debian?

@StefanKarpinski
Copy link
Sponsor Member

My understanding was that the issue occurs when the Julia package is compiled using one version of LLVM and then another version of LLVM is used when Julia is run.

@svillemot
Copy link
Contributor Author

Indeed the problem occurs when the version of LLVM is changed, but the strange thing is that it occurs even if the change is minimal (i.e. a small patch clearly not affecting ABI compatibility).

@Keno
Copy link
Member

Keno commented Oct 7, 2013

Is this still an issue? LLVM makes no guarantees whatsoever on ABI stability. Now that we are not compiling LLVM while WHOLE_ARCHIVE anymore, I would still like to add the option to link to the dynamic library instead.

@ViralBShah
Copy link
Member

Does this work now with llvm 3.3? Now that 0.2-rc1 build has gone through unstable, it is worth revisiting this.

@ViralBShah
Copy link
Member

I am temporarily marking this as 0.2.

@JeffBezanson
Copy link
Sponsor Member

I would certainly love to have this fixed, but AFAIK we still have no idea what is going on here.

@ViralBShah
Copy link
Member

Perhaps we just try it out again and see if it works this time?

@ViralBShah
Copy link
Member

@sebastien-villemot Is this still an issue?

@svillemot
Copy link
Contributor Author

Sorry, I've been busy recently so I could not test it so far. I'll come back to you soon.

@ViralBShah
Copy link
Member

I have provided a build option to make this easier. I will move this to 0.3 for now, and perhaps we can even close it, if it doesn't reoccur.

@svillemot
Copy link
Contributor Author

I have retested this with Julia 0.2.0-rc2 and LLVM 3.3 and the problem seems to be now gone. Closing.

BTW, thanks for the new build option, it makes the thing easier.

@ViralBShah
Copy link
Member

That is great. Don't we have to wait for a new llvm package to appear in unstable and then see if this still works?

@svillemot
Copy link
Contributor Author

I made a test: I compiled julia against llvm-3.3-dev from version 3.3-9, then I upgraded llvm-3.3-dev to 3.3-10 without recompiling, and julia did not break.. So I am fairly confident (though not certain) that this issue is fixed.

@ViralBShah
Copy link
Member

This is such a relief!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

6 participants