[petsc-dev] libpetsc.so: undefined references

Satish Balay balay at mcs.anl.gov
Sat Oct 2 10:48:15 CDT 2021


 --with-clib-autodetect=0 --with-fortranlib-autodetect=0 --with-cxxlib-autodetect=0
 --CC_LINKER_FLAGS="-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 "
 --FC_LINKER_FLAGS="-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -lgfortran" 


Since autodetect is disabled - its expected the required compiler libraries are passed in via LIBS or in this case CC_LINKER_FLAGS, FC_LINKER_FLAGS

i.e add -lstdc++ to both.

I'm surprised that you didn't need -lgfortran with CC_LINKER_FLAGS in there as well - but get [as libpetsc.so is built with CLINKER]

>       libgfortran.so.5 => /lib64/libgfortran.so.5 (0x00007f00d9dde000)



Satish

On Sat, 2 Oct 2021, Antonio T. sagitter wrote:

> Hi all.
> 
> In PETSc-3.16.0, the linker is not working because of these undefined
> references (see https://pastebin.com/izGTfmMp):
> 
> /usr/bin/ld: x86_64/lib/libpetsc.so: undefined reference to `operator
> delete(void*, unsigned long)'
> 
> /usr/bin/ld: x86_64/lib/libpetsc.so: undefined reference to `__cxa_rethrow'
> 
> /usr/bin/ld: x86_64/lib/libpetsc.so: undefined reference to
> `__gxx_personality_v0'
> 
> /usr/bin/ld: x86_64/lib/libpetsc.so: undefined reference to `operator
> new(unsigned long)'
> 
> /usr/bin/ld: x86_64/lib/libpetsc.so: undefined reference to
> `std::__throw_bad_alloc()'
> 
> /usr/bin/ld: x86_64/lib/libpetsc.so: undefined reference to `std::terminate()'
> 
> /usr/bin/ld: x86_64/lib/libpetsc.so: undefined reference to
> `std::__throw_bad_array_new_length()'
> 
> /usr/bin/ld: x86_64/lib/libpetsc.so: undefined reference to `typeinfo for
> std::exception'
> 
> /usr/bin/ld: x86_64/lib/libpetsc.so: undefined reference to
> `__cxa_begin_catch'
> 
> /usr/bin/ld: x86_64/lib/libpetsc.so: undefined reference to `__cxa_end_catch'
> 
> /usr/bin/ld: x86_64/lib/libpetsc.so: undefined reference to
> `std::__throw_length_error(char const*)'
> 
> collect2: error: ld returned 1 exit status
> 
> There are also
> 
> $ ldd -r build/BUILD/petsc-3.16.0/petsc-3.16.0/x86_64/lib/libpetsc.so'
> Start: shell
> 
> 	linux-vdso.so.1 (0x00007fffbf347000)
> 
> 	libsuperlu.so.5.2 => /lib64/libsuperlu.so.5.2 (0x00007f00dad0c000)
> 
> 	libflexiblas.so.3 => /lib64/libflexiblas.so.3 (0x00007f00da95a000)
> 
> 	libcgns.so.4.2 => /lib64/libcgns.so.4.2 (0x00007f00da873000)
> 
> 	libhdf5.so.103 => /lib64/libhdf5.so.103 (0x00007f00da4d8000)
> 
> 	libm.so.6 => /lib64/libm.so.6 (0x00007f00da3f8000)
> 
> 	libX11.so.6 => /lib64/libX11.so.6 (0x00007f00da2ae000)
> 
> 	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f00da294000)
> 
> 	libc.so.6 => /lib64/libc.so.6 (0x00007f00da08b000)
> 
> 	libgfortran.so.5 => /lib64/libgfortran.so.5 (0x00007f00d9dde000)
> 
> 	libquadmath.so.0 => /lib64/libquadmath.so.0 (0x00007f00d9d94000)
> 
> 	/lib64/ld-linux-x86-64.so.2 (0x00007f00dc18b000)
> 
> 	libsz.so.2 => /lib64/libsz.so.2 (0x00007f00d9d8a000)
> 
> 	libz.so.1 => /lib64/libz.so.1 (0x00007f00d9d6e000)
> 
> 	libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f00d9d43000)
> 
> 	libXau.so.6 => /lib64/libXau.so.6 (0x00007f00d9d3d000)
> 
> undefined symbol: _ZTISt9exception
> (build/BUILD/petsc-3.16.0/petsc-3.16.0/x86_64/lib/libpetsc.so)
> 
> undefined symbol: __gxx_personality_v0
> (build/BUILD/petsc-3.16.0/petsc-3.16.0/x86_64/lib/libpetsc.so)
> 
> undefined symbol: _ZdlPvm
> (build/BUILD/petsc-3.16.0/petsc-3.16.0/x86_64/lib/libpetsc.so)
> 
> undefined symbol: __cxa_rethrow
> (build/BUILD/petsc-3.16.0/petsc-3.16.0/x86_64/lib/libpetsc.so)
> 
> undefined symbol: _Znwm
> (build/BUILD/petsc-3.16.0/petsc-3.16.0/x86_64/lib/libpetsc.so)
> 
> undefined symbol: _ZSt17__throw_bad_allocv
> (build/BUILD/petsc-3.16.0/petsc-3.16.0/x86_64/lib/libpetsc.so)
> 
> undefined symbol: _ZSt9terminatev
> (build/BUILD/petsc-3.16.0/petsc-3.16.0/x86_64/lib/libpetsc.so)
> 
> undefined symbol: _ZSt28__throw_bad_array_new_lengthv
> (build/BUILD/petsc-3.16.0/petsc-3.16.0/x86_64/lib/libpetsc.so)
> 
> undefined symbol: __cxa_begin_catch
> (build/BUILD/petsc-3.16.0/petsc-3.16.0/x86_64/lib/libpetsc.so)
> 
> undefined symbol: __cxa_end_catch
> (build/BUILD/petsc-3.16.0/petsc-3.16.0/x86_64/lib/libpetsc.so)
> 
> undefined symbol: _ZSt20__throw_length_errorPKc
> (build/BUILD/petsc-3.16.0/petsc-3.16.0/x86_64/lib/libpetsc.so)
> 
> 
> 
> I'm attaching configure.log and make.log
> 
> --
> ---
> Antonio Trande
> Fedora Project
> mailto: sagitter at fedoraproject.org
> GPG key: 0x29FBC85D7A51CC2F
> GPG key server: https://keyserver1.pgp.com/
> 
> 



More information about the petsc-dev mailing list