Opened 3 years ago

Closed 3 years ago

#28406 closed defect (worksforme)

barvinok fails to build on Arch with system's NTL

Reported by: vdelecroix Owned by:
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: packages: optional Keywords:
Cc: dimpase, arojas Merged in:
Authors: Reviewers: Dima Pasechnik
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by vdelecroix)

On my machine where the system NTL is used, the optional package barvinok fails to build (Sage version 8.9.beta8). The relevant

Attachments (3)

config.log (147.6 KB) - added by vdelecroix 3 years ago.
barvinok-0.41.1.log (9.0 KB) - added by vdelecroix 3 years ago.
barvinok-config.log (84.8 KB) - added by vdelecroix 3 years ago.

Download all attachments as: .zip

Change History (16)

Changed 3 years ago by vdelecroix

Changed 3 years ago by vdelecroix

Changed 3 years ago by vdelecroix

comment:1 Changed 3 years ago by vdelecroix

  • Description modified (diff)

comment:2 Changed 3 years ago by dimpase

  • Cc dimpase added

comment:3 follow-up: Changed 3 years ago by dimpase

ok, so in barvinok-config one sees

2415	configure:14457: gcc -o conftest -g -O2    -L/opt/sage/local/lib -Wl,-rpath,/opt/sage/local/lib  conftest.c -lntl  -lgmp  >&5
2416	/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../lib/libntl.so: undefined reference to `pthread_key_create'
2417	/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../lib/libntl.so: undefined reference to `pthread_setspecific'
2418	collect2: error: ld returned 1 exit status

which is why it does not build.

Could you post the output of

ldd /usr/lib/libntl.so

it seems it's multi-threaded on Arch?

Without barvinok, did you run tests for this installation of Sage? If everything works (I hope so), we should fix the configure of barvinok, or perhaps just its spkg-install. (It seems it needs to be linked with -lpthread as well).

It could also be that libntl is underlinked on Arch...

comment:4 Changed 3 years ago by dimpase

  • Cc arojas added

comment:5 Changed 3 years ago by dimpase

  • Summary changed from barvinok fails to build to barvinok fails to build on Arch with system's NTL

comment:6 Changed 3 years ago by arojas

Yes, this is a bug in ntl, which fails to link to libpthread when built with multi-thread support. It is caused by them using libtool as the build command, which adds -nostdlib to the gcc flags, which in turn overrides the -pthread flag.

I reported this to Victor a long time ago (by private mail since he doesn't use a bug tracker) but hasn't been fixed yet. For a while I was linking it manually as a workaround but I stopped doing it a few releases ago since all official Arch packages that link to ntl were working fine - but this seems to be simply because they link to libpthread themselves so the issue was just being masked.

I've restored the workaroung for now, so this should be fixed on Arch with ntl 11.3.2-2. But it will affect all distros that build ntl multi-threaded unless they apply a similar workaround.

comment:7 in reply to: ↑ 3 Changed 3 years ago by vdelecroix

Replying to dimpase:

Could you post the output of

ldd /usr/lib/libntl.so

it seems it's multi-threaded on Arch?

$ ldd /usr/lib/libntl.so
	linux-vdso.so.1 (0x00007ffd54c8b000)
	libgmp.so.10 => /usr/lib/libgmp.so.10 (0x00007fb2c0643000)
	libgf2x.so.1 => /usr/lib/libgf2x.so.1 (0x00007fb2c0626000)
	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fb2c043e000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007fb2c02f8000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007fb2c0135000)
	/usr/lib64/ld-linux-x86-64.so.2 (0x00007fb2c09aa000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fb2c011b000)

comment:8 follow-up: Changed 3 years ago by dimpase

If I read comment:6 correctly, you should be able to install an update to NTL that fixes the issue.

comment:9 in reply to: ↑ 8 Changed 3 years ago by vdelecroix

Replying to dimpase:

If I read comment:6 correctly, you should be able to install an update to NTL that fixes the issue.

Yes, I downloaded the latest version pushed by Antonio. However, in the meantime I installed Sage NTL and I have to rebuild everything from scratch... Needs some time before I confirm that this is fixed.

comment:10 Changed 3 years ago by vdelecroix

  • Milestone changed from sage-8.9 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

This is fixed! Thanks!

comment:11 Changed 3 years ago by dimpase

  • Reviewers set to Dima Pasechnik
  • Status changed from needs_review to positive_review

comment:12 Changed 3 years ago by cremona

For what it's worth I had similar problems linking NTL into eclib. I seem to have solved it but could not possibly explain properly; but looking at eclib's configure setup might help.

comment:13 Changed 3 years ago by chapoton

  • Resolution set to worksforme
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.