Compilation crashes with `undefined symbol: _ZSt28__throw_bad_array_new_lengthv` (Fedora 34, gcc 11)

See original GitHub issue

After installing pystan and running the 8schools example, the compilation crashes with error message

ImportError: /home/solant/.cache/httpstan/4.4.2/models/sk7xw5y6/stan_services_model_sk7xw5y6.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZSt28__throw_bad_array_new_lengthv

I’m running Fedora 34, I tried both the most recent python version and 3.7.10. Any idea what’s wrong? I couldn’t find anything by googling the above error.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:21 (5 by maintainers)

github_iconTop GitHub Comments

11reactions
jjerphancommented, Jul 12, 2021

@joshua-cogliati-inl’s work around is functional.

It’s probably better to make modification in the virtual environment one is using to back-up previous shared objects:

cd $CONDA_PREFIX/envs/your_env/lib

# Verify that `_ZSt28__throw_bad_array_new_lengthv` is missing in the target shared object
objdump -T libstdc++.so.6.0.28 | grep throw_bad_array

# Back-up the target shared object
mv libstdc++.so.6.0.28 libstdc++.so.6.0.28.old

# Change the target to point on the system's 
ln -s /usr/lib64/libstdc++.so.6.0.29 libstdc++.so.6.0.28
9reactions
joshua-cogliati-inlcommented, Jun 29, 2021

I think this is the GCC commit that is causing this problem: https://github.com/gcc-mirror/gcc/commit/f92a504fdd943527687faf9557e0b39ff7fe6125

And basically, conda has libstdc++.so.6.0.28 but fedora 34 has libstdc++.so.6.0.29:

objdump -T /usr/lib64/libstdc++.so.6.0.29  | grep throw_bad_array
00000000000a423f g    DF .text  0000000000000035  GLIBCXX_3.4.29 _ZSt28__throw_bad_array_new_lengthv
00000000000a14ee g    DF .text  0000000000000035  CXXABI_1.3.8 __cxa_throw_bad_array_new_length
00000000000a13d3 g    DF .text  0000000000000033  CXXABI_1.3.8 __cxa_throw_bad_array_length

 objdump -T libstdc++.so.6.0.28 | grep throw_bad_array
00000000000a9e5d g    DF .text  000000000000002f  CXXABI_1.3.8 __cxa_throw_bad_array_new_length
00000000000a9dd0 g    DF .text  000000000000002f  CXXABI_1.3.8 __cxa_throw_bad_array_length

A temporary workaround until conda gets an updated libstdc++ is to go into your miniconda directory and force it to use the system libstdc++:

cd  ~/miniconda3/lib/
rm libstdc++.so libstdc++.so.6
ln -s /usr/lib64/libstdc++.so.6.0.29 libstdc++.so
ln -s /usr/lib64/libstdc++.so.6.0.29 libstdc++.so.6
Read more comments on GitHub >

github_iconTop Results From Across the Web

What is an undefined reference/unresolved external symbol ...
Compiling a C++ program takes place in several steps, as specified by 2.2 ... for Microsoft Visual Studio and undefined reference to symbolName...
Read more >
1849955 – After dnf install, dnf crashes with /lib64/libgomp.so.1
Bug 1849955 - After dnf install, dnf crashes with /lib64/libgomp.so.1: undefined symbol: pthread_attr_setaffinity_np, version GLIBC_2.32.
Read more >
Compile db2Ingest API C program fails with error "Undefined ...
c ld: 0711-317 ERROR: Undefined symbol: .db2Ingest ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. Cause. This is because...
Read more >
Undefined symbols while builidng OpenFoam adapter
Hi. I have issues building the OpenFOAM adapter on Fedora 34. I downloaded the 2106 compatible version. The building stops with this message:...
Read more >
100345 – gcc 11.1 build "make -n install" fails linking gcov ...
Attempting to build gcc-11.1 "make" succeeds but "make -n install" fails when it attempts to link gcov with an undefined symbol ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found