0

I would like to use the GiNaC library within a Code::Blocks C++ project, but encounter the following errors during project build:

../../ginac/lib/libginac.so: undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()@GLIBCXX_3.4.26'

../../ginac/lib/libginac.so: undefined reference to `std::__throw_bad_array_new_length()@GLIBCXX_3.4.29'

collect2: error: ld returned 1 exit status

I assume the errors have something to do with incompatibility between the g++ compiler version and the stdc++ library version, but I don't know how to resolve this issue due to lack of experience.

Since I'm on a cluster and don't have root permissions, I installed the necessary prerequisite libraries GMP-6.2.1 and CLN-1.3.6 and of course GiNaC itself GiNaC-1.8.5 with the following commands into a non-default location PATH_TO_XXX, where XXX is GMP, CLN and GiNaC, respectively:

LDFLAGS="-lstdc++" ./configure --prefix=PATH_TO_XXX
make
make check
make install prefix=PATH_TO_XXX

For GMP --enable-cxx option was added to configure. For CLN --with-gmp=PATH_TO_GMP option was added to configure. The resulting build log gives the following entry before the errors:

g++ -L../../ginac/lib -L../../ginac/cln/lib -L../../ginac/cln/gmp/lib -L../../../../../../../../lib64 -o bin/Release/LB_COL_jetInSquareDuct_solver obj/Release/Control.o obj/Release/GridCoupling.o obj/Release/Lattice.o obj/Release/main.o obj/Release/Node.o  -O2 -s -lstdc++ -lcln -lgmp -lgmpxx  /lib64/libstdc++.so.6 /lib64/libgomp.so.1 ../../ginac/lib/libginac.so ../../ginac/cln/lib/libcln.so ../../ginac/cln/gmp/lib/libgmp.so ../../ginac/cln/gmp/lib/libgmpxx.so
TooTone
  • 7,129
  • 5
  • 34
  • 60
messier87
  • 1
  • 1
  • 1
    Its unclear from the description whether the additional packages that were installed are binary packages, or were compiled from source. If they were binary packages they are incompatible, wrong version, and there's nothing that can be done to remedy that or work around it. – Sam Varshavchik Feb 03 '23 at 13:38
  • Thank you for your comment @SamVarshavchik. I thought the make commands meant that I was compiling from source? Correct me, if I'm wrong. – messier87 Feb 03 '23 at 13:54
  • The statement "I installed the necessary prerequisite libraries GMP-6.2.1 and CLN-1.3.6" could be interpreted either way. – Sam Varshavchik Feb 03 '23 at 14:00
  • "I installed the necessary prerequisite libraries GMP-6.2.1 and CLN-1.3.6 and of course GiNaC itself GiNaC-1.8.5 with the following commands ... LDFLAGS="-lstdc++" ./configure --prefix=PATH_TO_XXX make make check make install prefix=PATH_TO_XXX" I thought this was unequivocal. – messier87 Feb 03 '23 at 14:05
  • see gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html for GCC versions <-> @GLIBCXX_x.y.z. – TooTone Apr 03 '23 at 15:40

1 Answers1

0

I was able to solve the problem. It simply arose from using different compiler versions when compiling GMP, CLN and GiNaC libraries (compiled with gcc 12.2.0) and the Code::Blocks project itself (compiled with gcc 7.1.0), which can be found in the project settings under "Settings -> Compiler -> Toolchain executables". By adding a new compiler with the correct version there, it then appears in the project build options for selection.

messier87
  • 1
  • 1