How do you install library "iberty" for MacOS?

Viewed 379

Trying to compile backward-cpp https://github.com/bombela/backward-cpp for MacOS Mojave, and getting this:

ld: library not found for -liberty

Which is straighforward in and of itself, but I can't seem to find how to install it?

https://unix.stackexchange.com/questions/160517/configuration-error-iberty-library-not-found

says to install binutils unfortunately installing it using brew brew install binutils does not include the iberty library. It seems libiberty is included in the gcc compiler (https://github.com/gcc-mirror/gcc/tree/master/libiberty), but I use clang by default. Is it not possible to use libiberty if using clang?

I've tried using latest gcc

gcc --version
gcc (Homebrew GCC 9.3.0_1) 9.3.0
cmake .. -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/gcc

But to no avail, same issue unfortunately. Does anyone know how to solve this?

1 Answers

You can use Homebrew for that. First add --enable-install-libiberty to the configure option of binutils using:

brew edit binutils

then reinstall it using:

brew reinstall -s binutils
Related