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

Fedora 32: system givaro does not work with Sage #31712

Closed
dimpase opened this issue Apr 22, 2021 · 11 comments
Closed

Fedora 32: system givaro does not work with Sage #31712

dimpase opened this issue Apr 22, 2021 · 11 comments

Comments

@dimpase
Copy link
Member

dimpase commented Apr 22, 2021

Basically, Sage wants

Givaro::Integer::operator std::__cxx11::basic_string<char, std::char_traits<char>,
 std::allocator<char> >[abi:cxx11]() const

whereas the library (version 4.1.1, as in Sage) provides

Givaro::Integer::operator std::__cxx11::basic_string<char, std::char_traits<char>,
 std::allocator<char> >() const

There is no [abi:cxx11] qualifier (or whatever this is called) asked by Sage, and one gets

[dochtml]     from . import matrix_modn_sparse
[dochtml] ImportError: <SAGEROOT>/local/lib64/python3.8/site-packages/sage/matrix/matrix_modn_sparse.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZNK6Givaro7IntegercvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEB5cxx11Ev

Fedora 32 has gcc 10.2.1 - maybe this is the issue, I don't know.
How does one find out what _GLIBCXX_USE_CXX11_ABI was for the system givaro? Note, from https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html

If you get linker errors about undefined references to symbols that involve types in the std::__cxx11 namespace or the tag [abi:cxx11] then it probably indicates that you are trying to link together object files that were compiled with different values for the _GLIBCXX_USE_CXX11_ABI macro. This commonly happens when linking to a third-party library that was compiled with an older version of GCC. If the third-party library cannot be rebuilt with the new ABI then you will need to recompile your code with the old ABI.

A Fedora bug?

CC: @mkoeppe @orlitzky @kiwifb @ClementPernet

Component: build: configure

Reviewer: Dima Pasechnik

Issue created by migration from https://trac.sagemath.org/ticket/31712

@dimpase dimpase added this to the sage-9.4 milestone Apr 22, 2021
@dimpase
Copy link
Member Author

dimpase commented Apr 22, 2021

comment:1

On Gentoo [abi:cxx11] is there in givaro library, and it all works:

$ nm -D /usr/lib64/libgivaro.so.9 | c++filt | grep abi\:cxx11
0000000000017b60 T Givaro::Integer::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >[abi:cxx11]() const

well, we can include a short C++ test program in spkg-confgure.m4 of Givaro...

@dimpase
Copy link
Member Author

dimpase commented Apr 22, 2021

comment:2

I lack understanding of the origin of this operator ():

Givaro::Integer::operator std::__cxx11::basic_string<char, std::char_traits<char>, 
     std::allocator<char> >[abi:cxx11]() const

or, shortened

Givaro::Integer::operator basic_string<char, char_traits<char>, 
     allocator<char> >[abi:cxx11]() const

What are we overloading here, and how? What's basic_string doing there?

@dimpase

This comment has been minimized.

@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Aug 22, 2021
@mkoeppe
Copy link
Member

mkoeppe commented Oct 14, 2021

@dimpase
Copy link
Member Author

dimpase commented Nov 1, 2021

comment:6

Replying to @dimpase:

On Gentoo [abi:cxx11] is there in givaro library, and it all works:

$ nm -D /usr/lib64/libgivaro.so.9 | c++filt | grep abi\:cxx11
0000000000017b60 T Givaro::Integer::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >[abi:cxx11]() const

well, we can include a short C++ test program in spkg-confgure.m4 of Givaro...

Not any more, on a current Gentoo I get

$ nm -D /usr/lib64/libgivaro.so.9 | c++filt | grep abi\:cxx11

What on Earth is going on with this stupid ABI:cxx11 thing, and how to either tell Sage not to ask for it, or Gentoo to provide it?

@dimpase
Copy link
Member Author

dimpase commented Nov 1, 2021

comment:8

On Gentoo, going back to sci-libs/givaro-4.1.1-r1 fixed the issue (still all is good as in comment:1)

@orlitzky
Copy link
Contributor

orlitzky commented Nov 1, 2021

comment:9

I think the issue is that the configure scripts for both givaro and fflas-ffpack are unable to detect gcc-10, and fall back to thinking you have gcc-4. The configure script then appends -fabi-version=6 to your CXXFLAGS, thinking you have an ancient gcc.

Both configure scripts have been fixed upstream, but not in a new release. See e.g. linbox-team/givaro#163

I was able to work around the issue in Gentoo in the -r2, as part of https://bugs.gentoo.org/741434

@dimpase
Copy link
Member Author

dimpase commented Nov 1, 2021

comment:10

Replying to @orlitzky:

I think the issue is that the configure scripts for both givaro and fflas-ffpack are unable to detect gcc-10, and fall back to thinking you have gcc-4. The configure script then appends -fabi-version=6 to your CXXFLAGS, thinking you have an ancient gcc.

Ancient or not, but your "workaround" in -r2 actually caused system givaro stopping to work for me in Sage. I use gcc 8.3.1-r2 p4.

Both configure scripts have been fixed upstream, but not in a new release. See e.g. linbox-team/givaro#163

I was able to work around the issue in Gentoo in the -r2, as part of https://bugs.gentoo.org/741434

@orlitzky
Copy link
Contributor

orlitzky commented Nov 1, 2021

comment:11

Replying to @dimpase:

Ancient or not, but your "workaround" in -r2 actually caused system givaro stopping to work for me in Sage. I use gcc 8.3.1-r2 p4.

You have to update fflas-ffpack, too -- and then rebuild all of the sage packages that depend on them. It's probably easier to rebuild sage from scratch.

Those dependencies use e.g. givaro-config --cflags to determine their own CXXFLAGS, and when givaro mistakenly adds -fabi-version=6 to its CXXFLAGS, your entire build gets poisoned with it. If you later install the fixed givaro, all of the things that try to use givaro will be using the wrong ABI.

@dimpase
Copy link
Member Author

dimpase commented Nov 2, 2021

comment:12

ok, this makes sense, and works, too, thanks.

@dimpase
Copy link
Member Author

dimpase commented Nov 2, 2021

Reviewer: Dima Pasechnik

@dimpase dimpase removed this from the sage-9.5 milestone Nov 2, 2021
@mkoeppe mkoeppe closed this as completed Nov 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants