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

build: versioned libm - symlink libpthread - fix symlinks #45918

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

t-bltg
Copy link
Contributor

@t-bltg t-bltg commented Jul 3, 2022

a) There is no apparent reason to use an unversioned libm.so when setting USE_SYSTEM_LIBM = 1, and on some distributions, libm.so is a valid linker script thus failing julia at runtime with the following error:

  could not load library "libm"
  /lib/x86_64-linux-gnu/libm.so: invalid ELF header

E.g. on ubuntu 22.04:

$ cat /lib/x86_64-linux-gnu/libm.so
/* GNU ld script
*/
OUTPUT_FORMAT(elf64-x86-64)
GROUP ( /lib/x86_64-linux-gnu/libm.so.6  AS_NEEDED ( /lib/x86_64-linux-gnu/libmvec.so.1 ) )

We already use versioned compiler support libraries (CSL), so versioning libm makes it consistent with CSL.
When using glibc, try to detect the ABI version in Makefile as it is currently done for libgfortran, falling back to version 6 (unchanged since 1997) if needed.

b) When setting USE_SYSTEM_CSL = 1, also try to symlink libpthread as it is listed in the private libs. Is there a reason not to do this ?

c) Also, prevent nesting symlinks resulting in a copy error on make install when the destination already exists and multiple make commands have been thrown before.

Tested locally using USE_SYSTEM_LIBM = 1 and USE_SYSTEM_CSL = 1: test suite is green.

@vchuravy vchuravy requested a review from staticfloat July 3, 2022 18:06
@t-bltg t-bltg force-pushed the libm branch 3 times, most recently from a32d6f4 to e2e14cb Compare July 3, 2022 20:37
@inkydragon inkydragon added the domain:building Build system, or building Julia or its dependencies label Jul 4, 2022
base/Makefile Outdated Show resolved Hide resolved
Make.inc Show resolved Hide resolved
@t-bltg t-bltg force-pushed the libm branch 5 times, most recently from 0fbe162 to 733bfee Compare July 7, 2022 06:26
base/Makefile Show resolved Hide resolved
@t-bltg t-bltg force-pushed the libm branch 2 times, most recently from 1d8554f to f62a681 Compare July 13, 2022 16:34
@t-bltg t-bltg force-pushed the libm branch 3 times, most recently from 746ff90 to 787e2a6 Compare August 8, 2022 08:32
@t-bltg
Copy link
Contributor Author

t-bltg commented Dec 24, 2022

@staticfloat or @vtjnash: is there any objection for this PR to go in ?

@ViralBShah
Copy link
Member

Is this good to merge?

@t-bltg
Copy link
Contributor Author

t-bltg commented Feb 18, 2023

It's ready on my side (I've been using this PR in my builds since at least a year on ubuntu).
But it still needs review and approval from core devs / contributors.

@ViralBShah
Copy link
Member

After #42299, perhaps we won't need libm linking at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:building Build system, or building Julia or its dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants