Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 790362 - sci-mathematics/eclib-20190909 error adding symbols: bad value when LIBTOOL=rlibtool
Summary: sci-mathematics/eclib-20190909 error adding symbols: bad value when LIBTOOL=r...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Michael Orlitzky
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: slibtool
  Show dependency tree
 
Reported: 2021-05-15 12:39 UTC by Alessandro Barbieri
Modified: 2021-11-17 15:35 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge_info (emerge_info,42.19 KB, text/plain)
2021-05-15 12:40 UTC, Alessandro Barbieri
Details
eclib-20190909:20210515-115133.log (eclib-20190909:20210515-115133.log,253.00 KB, text/plain)
2021-05-15 12:40 UTC, Alessandro Barbieri
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alessandro Barbieri 2021-05-15 12:39:49 UTC
This package fails to compile on an unstable system. Attached relevant logs and emerge --info
Comment 1 Alessandro Barbieri 2021-05-15 12:40:04 UTC
Created attachment 708774 [details]
emerge_info

emerge --info
Comment 2 Alessandro Barbieri 2021-05-15 12:40:06 UTC
Created attachment 708777 [details]
eclib-20190909:20210515-115133.log

build log
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-05-15 12:40:55 UTC
I mean, it’s more than an “unstable system”, it’s slibtool at least.
Comment 4 Alessandro Barbieri 2021-05-15 12:57:15 UTC
I confirm that is rlibtool the issue
Comment 5 Ionen Wolkens gentoo-dev 2021-05-15 14:21:29 UTC
I can't reproduce even with rlibtool and same USE, I assume there's something more to this again.
Comment 6 Michael Orlitzky gentoo-dev 2021-05-19 22:05:37 UTC
I added eclib-20210503 a few days ago. Does it share the same problem? (If not, it may not be worth investigating the old version.)
Comment 7 Michael Orlitzky gentoo-dev 2021-11-02 15:35:07 UTC
I'm not sure who's to blame here. Part of the problem is that ax_boost_base.m4 autodetects -L/usr/lib64 as the flag that corresponds to boost's location. It then winds up in LDFLAGS, and gets passed to the build system...

  x86_64-pc-linux-gnu-g++ solve_conic.o -Os -pipe -march=native
  -fdiagnostics-color=always -fexceptions -Wformat -fstack-clash-protection
  -L/usr/lib64 -pthread -Wl,-O1 -Wl,--as-needed -Wl,--sort-common
  -L../libsrc/.libs -lec -lflint -lntl -lpari -lboost_system-mt -lboost_thread
  -lflint -lpari -lntl -lboost_system-mt -o .libs/solve_conic

pre-empting the "-L../libsrc/.libs -lec" which is supposed to link against the just-built libec, and not the previous version that is installed in /usr/lib64. When it tries to link against /usr/lib64/libec.so instead, a conflict in the underlying libflint causes this error.

This could of course be fixed by omitting -L/usr/lib64 from LDFLAGS -- arguably, ax_boost_base() should try the empty path first and do nothing if it works -- but is that truly a mistake? Or is there some other obscure defect in eclib's build system that slibtool refuses to work around? I cannot find where "-lec" comes from in the first place, which probably means that it's coming from (s)libtool.

Perhaps it would be happier if 

  LIBS = $(top_builddir)/libsrc/libec.la ...

was moved to LIBADD?
Comment 8 Michael Orlitzky gentoo-dev 2021-11-02 15:49:52 UTC
(In reply to Michael Orlitzky from comment #7)
> 
> Perhaps it would be happier if 
> 
>   LIBS = $(top_builddir)/libsrc/libec.la ...
> 
> was moved to LIBADD?

I'm seeing the exact same link command after this change, so probably not.
Comment 9 Michael Orlitzky gentoo-dev 2021-11-02 18:40:05 UTC
(In reply to Michael Orlitzky from comment #7)
> arguably, ax_boost_base() should try the empty path first and do nothing if
> it works

Incredible. The way ac_boost_base.m4 checks for boost is that it runs

  ls <dir>/libboost_*

in a bunch of random places, and adds -L<dir> the first time it works. And then ax_boost_asio.m4, ax_boost_system.m4, and ax_boost_thread.m4 all do something similar.

I'm leaning towards either disabling USE=boost or marking this CANTFIX unless someone else has an idea.
Comment 10 François Bissey 2021-11-02 18:59:50 UTC
(In reply to Michael Orlitzky from comment #9)
> (In reply to Michael Orlitzky from comment #7)
> > arguably, ax_boost_base() should try the empty path first and do nothing if
> > it works
> 
> Incredible. The way ac_boost_base.m4 checks for boost is that it runs
> 
>   ls <dir>/libboost_*
> 
> in a bunch of random places, and adds -L<dir> the first time it works. And
> then ax_boost_asio.m4, ax_boost_system.m4, and ax_boost_thread.m4 all do
> something similar.

I was going to explain that to you but you figured out yourself :)

I'll have a bit of a think about whether to disable boost.
Comment 11 Alessandro Barbieri 2021-11-02 19:04:21 UTC
It's trying to link both libflint 13 and libflint 14
Comment 12 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-11-02 19:08:06 UTC
(In reply to Michael Orlitzky from comment #9)
> (In reply to Michael Orlitzky from comment #7)
> > arguably, ax_boost_base() should try the empty path first and do nothing if
> > it works
> 
> Incredible. The way ac_boost_base.m4 checks for boost is that it runs
> 
>   ls <dir>/libboost_*
> 
> in a bunch of random places, and adds -L<dir> the first time it works. And
> then ax_boost_asio.m4, ax_boost_system.m4, and ax_boost_thread.m4 all do
> something similar.
> 
> I'm leaning towards either disabling USE=boost or marking this CANTFIX
> unless someone else has an idea.

I had issues with this recently and ended up passing --with-boost-libdir to avoid hell: https://gitweb.gentoo.org/repo/gentoo.git/tree/net-libs/libtorrent-rasterbar/libtorrent-rasterbar-1.2.14-r1.ebuild#n74.
Comment 13 Michael Orlitzky gentoo-dev 2021-11-02 19:13:50 UTC
(In reply to Sam James from comment #12)
> 
> I had issues with this recently and ended up passing --with-boost-libdir to
> avoid hell:
> https://gitweb.gentoo.org/repo/gentoo.git/tree/net-libs/libtorrent-rasterbar/
> libtorrent-rasterbar-1.2.14-r1.ebuild#n74.

I think this is a different problem, where it finds the wrong directory before it tries the right one. In our case it finds the right directory, but then it adds -L/usr/lib64 to LDFLAGS, accidentally changing its order in the search path from last to first.
Comment 14 François Bissey 2021-11-02 19:59:51 UTC
The main consumer of eclib (sage) doesn't require boost to be enabled. So I am in favor of just dropping it.
Comment 15 Alessandro Barbieri 2021-11-02 22:12:55 UTC
I've re enabled rlibtool for the latest eclib version (20210625) and it builds fine
Comment 16 Michael Orlitzky gentoo-dev 2021-11-02 22:45:38 UTC
(In reply to Alessandro Barbieri from comment #15)
> I've re enabled rlibtool for the latest eclib version (20210625) and it
> builds fine

It will only fail during specific upgrades. Flint isn't really the problem, but an old version of eclib linked to an old version of flint is involved. In your case, the existing installation of eclib was linked to libflint.so.13. During an upgrade of eclib, the lines like

  x86_64-pc-linux-gnu-g++ ... -L/usr/lib64 ... -L../libsrc/.libs -lec ... \
    -o .libs/solve_conic

are intended to link against the newly-built libec in libsrc/.libs; however, the fact that -L/usr/lib64 is added BEFORE -L../libsrc/.libs means that it's actually linking against /usr/lib64/libec. All of the new stuff is linked against libflint.so.14, but the /usr/lib64/libec being pulled in is linked against libflint.so.13. And those libraries are incompatible in a way that the linker notices.

So there is a real problem here. I'll think about it for a day or two. I spent way too much time investigating it today and now have to catch up on my real work.
Comment 17 Michael Orlitzky gentoo-dev 2021-11-02 23:04:30 UTC
BTW the same line with GNU libtool is,

  /bin/sh ../libtool  --tag=CXX   --mode=link x86_64-pc-linux-gnu-g++ ... \
    -L/usr/lib64 -o solve_conic solve_conic.o  ../libsrc/libec.la -lflint

so it's leaving the name of the la file intact, rather than trying to rewrite it to,

  -L../libsrc/.libs -lec

like rlibtool does. Certainly the boost macro could be better, but I'll have to dig into rlibtool's code to decide if it should share some of the blame, or if GNU libtool is being too generous.
Comment 18 Michael Orlitzky gentoo-dev 2021-11-17 15:35:08 UTC
This is pretty much completely debugged:

  https://dev.midipix.org/cross/slibtool/issue/47

It only happens in this case because the boost macro is doing something stupid, but the slibtool link command is subtly different from what was intended (and what GNU libtool does).

I'm going to mark this as resolved UPSTREAM, whatever that means, because it's a larger problem that will have to be addressed upstream. It would also be nice if someone rewrote AX_BOOST* to use AC_SEARCH_LIBS, but that's a separate issue -- slibtool will pick up the wrong library whenever you have other -L<path> flags taking priority over the just-built library, not just when the boost macro puts them there.