[abi:cxx11] in givaro prevents linking to system givaro on Fedora 32

218 views
Skip to first unread message

Dima Pasechnik

unread,
May 8, 2021, 7:31:12 AM5/8/21
to sage-devel
With system Givaro, one gets

[dochtml] ImportError: /home/scratch2/dimpase/sage/sage/local/lib64/python3.8/site-packages/sage/matrix/matrix_modn_sparse.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZNK6Givaro7IntegercvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEB5cxx11Ev
make[3]: *** [Makefile:2280: doc-html] Error 1

which demangled says

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

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

(no of that weird [abi:cxx11] qualifier)

Any ideas how to fix this? (besides not using system Givaro) ?

Dima

François Bissey

unread,
May 8, 2021, 7:34:11 AM5/8/21
to sage-...@googlegroups.com
What compiler and flags have used to compile fedora 32 givaro? Can we easily find out?
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/b187faf3-50c4-42c4-ae37-77c5a3902bbcn%40googlegroups.com.

François Bissey

unread,
May 8, 2021, 7:37:35 AM5/8/21
to sage-...@googlegroups.com
Interestingly on Gentoo I currently have both symbols
fbissey@moonloop ~ $ nm -D /usr/lib64/libgivaro.so.9.1.1 | grep _ZNK6Givaro7IntegercvNSt7__cxx1112basic_stringIcSt11char | c++filt -n
00000000000180b0 T Givaro::Integer::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >[abi:cxx11]() const
00000000000180b0 T Givaro::Integer::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >() const

Last compile was with gcc-11.1.0

Dima Pasechnik

unread,
May 8, 2021, 7:45:07 AM5/8/21
to sage-devel
On Saturday, May 8, 2021 at 12:34:11 PM UTC+1 François Bissey wrote:
What compiler and flags have used to compile fedora 32 givaro? Can we easily find out?

the compiler used to build Sage is g++ 10.2.1

$ g++ -v
Using built-in specs.
COLLECT_GCC=/usr/bin/g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/10/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.1 20201125 (Red Hat 10.2.1-9) (GCC) 

Dima Pasechnik

unread,
May 8, 2021, 8:01:02 AM5/8/21
to sage-devel

Matthias Koeppe

unread,
May 8, 2021, 11:54:08 AM5/8/21
to sage-devel
On Saturday, May 8, 2021 at 4:31:12 AM UTC-7 Dima Pasechnik wrote:
With system Givaro, one gets

[dochtml] ImportError: /home/scratch2/dimpase/sage/sage/local/lib64/python3.8/site-packages/sage/matrix/matrix_modn_sparse.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZNK6Givaro7IntegercvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEB5cxx11Ev
make[3]: *** [Makefile:2280: doc-html] Error 1

fedora-32-standard (https://github.com/sagemath/sage/runs/2479588038) built without errors -- what's different on your system?


Steven Trogdon

unread,
May 8, 2021, 1:01:13 PM5/8/21
to sage-devel
Building Givaro on Gentoo I have

CXXFLAGS=-O2 -pipe -march=native -O2 -pipe   -fabi-version=6   -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx

Your Redhat has

CXXFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection

Could the  abi-version=6 be the issue?

Volker Braun

unread,
May 9, 2021, 6:24:23 AM5/9/21
to sage-devel
This is c++11 dual abi, see https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html

IMHO we just shouldn't use the system version then, but building Sage with -D_GLIBCXX_USE_CXX11_ABI=0 should allow you to link with old-style abi libraries.

The default value of _GLIBCXX_USE_CXX11_ABI can be changed by the distro, which is probably what accounts for the differences seen in this thread.

Volker Braun

unread,
May 9, 2021, 6:28:30 AM5/9/21
to sage-devel
PS: Fedora 32 EOL is imminent (= 4 weeks after the just-released fedora 34), so I wouldn't worry too much about it

Dima Pasechnik

unread,
May 10, 2021, 8:27:44 AM5/10/21
to sage-devel
On Sunday, May 9, 2021 at 11:24:23 AM UTC+1 Volker Braun wrote:
This is c++11 dual abi, see https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html

IMHO we just shouldn't use the system version then, but building Sage with -D_GLIBCXX_USE_CXX11_ABI=0 should allow you to link with old-style abi libraries.

The default value of _GLIBCXX_USE_CXX11_ABI can be changed by the distro, which is probably what accounts for the differences seen in this thread.

Are you saying it's a bug in Fedora 32, they should have provided dual ABI, like Gentoo does, but they don't?
Or that they provide an old-style ABI, and we can use ` -D_GLIBCXX_USE_CXX11_ABI=0` to make this work for Sage?
Isn't c++11 "old" nowadays?

I tried to write a short C++ code do produce this error, so that we can put it into our gcc/spkg-configure.m4, but I cannot
figure it out.  

Dima Pasechnik

unread,
May 10, 2021, 8:30:45 AM5/10/21
to sage-devel
On Sunday, May 9, 2021 at 11:28:30 AM UTC+1 Volker Braun wrote:
PS: Fedora 32 EOL is imminent (= 4 weeks after the just-released fedora 34), so I wouldn't worry too much about it

Our IT just updated this machine for me, from a long EOLed Fedora, to Fedora 32. 
I just asked them to make me an early Fedora 34 adopter...

Volker Braun

unread,
May 10, 2021, 4:49:14 PM5/10/21
to sage-devel
"Dual" refers to libstdc++ here, i.e. you only have one standard library supporting both abi's.  

Other libraries generally are only one or the other, this is what is controlled by the -D_GLIBCXX_USE_CXX11_ABI; Theoretically you could make your own dual-abi library but you'd have to plaster __attribute__((abi_tag("cxx11"))) everywhere, so hell no.

What I'm saying is: if you provide the same value for -D_GLIBCXX_USE_CXX11_ABI as what was used for the system givaro then you should be able to link them together.

Dima Pasechnik

unread,
May 10, 2021, 5:14:09 PM5/10/21
to sage-devel


On Mon, 10 May 2021, 21:49 Volker Braun, <vbrau...@gmail.com> wrote:
"Dual" refers to libstdc++ here, i.e. you only have one standard library supporting both abi's.  

Other libraries generally are only one or the other, this is what is controlled by the -D_GLIBCXX_USE_CXX11_ABI; Theoretically you could make your own dual-abi library but you'd have to plaster __attribute__((abi_tag("cxx11"))) everywhere, so hell no.

as Francois reports above, on Gentoo he has libgivaro providing two interfaces, one with abi:c++11, and one without.

Apparently, done by by setting a gcc option, as mentioned by Steven.

Dima Pasechnik

unread,
Oct 14, 2021, 8:00:04 AM10/14/21
to sage-devel
This is now re-surfacing in Gentoo. I see sagelib using
Givaro::Integer::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >[abi:cxx11]() const

but the system Givaro only providing
Givaro::Integer::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >() const



Reply all
Reply to author
Forward
0 new messages