0

I'm kinda new to cpp and I'm trying to compile a code making use of cuba library and quadmath as well. Since Apple gcc doesn't recognise __float128 I needed to use my brew-installed gcc while compiling:

/usr/local/bin/gcc-11 ...

then I add

... -lstdc++ ...

for the code I need to compile is a .cpp and finally I include the libraries and includes I need. So the compiler is called with

/usr/local/bin/gcc-11 -o test sigmavT.cpp ./lib/*.a -I./include -lstdc++

problem is I'm obtaining the following message:

    ld: warning: ignoring file ./lib/libcuba.a, building for macOS-x86_64 but     attempting to link with file built for macOS-arm64
  Undefined symbols for architecture x86_64:
  "_llVegas", referenced from:
      _main in ccQTpUvC.o
  "_powq", referenced from:
      __ZL10IntegrandEPKiPKdS0_PdPv in ccQTpUvC.o
  "_quadmath_snprintf", referenced from:
      __ZN12_GLOBAL__N_1lsERSoRKg in ccQTpUvC.o
  "_sqrtq", referenced from:
      __ZL10IntegrandEPKiPKdS0_PdPv in ccQTpUvC.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

Which I'm guessing is a sort of incompatibility between cuba library and the gcc compiler.

Thanks for your time!

edit. Searching a bit more I've noticed that there's no libquadmath in arm64 gcc. is that solved?

Fredrigo6
  • 1
  • 4
  • Just FYI, "Apple `gcc`" isn't actually GCC at all on modern MacOS, it's just Apple Clang installed at that command name for compatibility with Makefiles and other things that use `gcc` instead of `cc`. – Peter Cordes May 10 '22 at 10:21
  • Anyway, if you're on an M1 mac, make sure you install arm64 GCC, not x86-64, if you want to make native executables and use arm64 libraries. – Peter Cordes May 10 '22 at 10:23
  • @PeterCordes, thanks! I didn't know the first answer! (and yes, I'm on M1) I'm so confused about this. libquadmath doesn't support ARM and Cuba library (http://www.feynarts.de/cuba/) compiles with gcc and my code is a cpp. Given the fact I'm new to cpp coding you may imagine I'm a bit messed up – Fredrigo6 May 10 '22 at 10:34

0 Answers0