1

Context

I am trying to use the OpenPGP C++ library on a MacOS machine.

Issue

I am following the instruction to build the library:

mkdir build
cd build
cmake ..
make
<make test>
make install

I manage to run the cmake. When passing to the step of make it returns an error:

[...]
[ 54%] Linking CXX shared library libOpenPGP.dylib
ld: library not found for -lgmpxx
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libOpenPGP.dylib] Error 1
make[1]: *** [CMakeFiles/OpenPGP_shared.dir/all] Error 2
make: *** [all] Error 2

What I tried

After reading online I found that could have been an issue of not properly run the cmake command.

  • I re-runned the cmake command (deleting the build folder content first)
  • I re-cloned the repository
  • The error message is "library not found for -lgmpxx". Why do you use **meaningless** "linker command failed with exit code 1" in the title? – Tsyvarev May 21 '21 at 13:01
  • @Tsyvarev thanks for the suggestion, I am trying to better understand this error to move forward in using the library – Alessandro Candeloro May 21 '21 at 13:39
  • In their [CMakeLists.txt](https://github.com/calccrypto/OpenPGP/blob/master/CMakeLists.txt#L65) there is `link_libraries (${GMP_LIBRARIES} gmpxx)`. Probably, aside from GMP library you need also install gmpxx. – Tsyvarev May 21 '21 at 13:46
  • @Tsyvarev I did install GMP as per requirement, that's why I'm confused about the error – Alessandro Candeloro May 21 '21 at 14:37
  • gmpxx is NOT a GMP. So, have you installed gmpxx? – Tsyvarev May 21 '21 at 14:43
  • @Tsyvarev looking on the internet is bringing me always to the GMP installation. I did try to install it with brew `brew install gmpxx` yet it did not find the package for the installation. Do you know where can I find more info about it? – Alessandro Candeloro May 21 '21 at 15:23
  • Hmm, it actually seems that gmp and gmpxx are provided in the same package. The problem of line `link_libraries (${GMP_LIBRARIES} gmpxx)` is that it allows to specify path to `gmp` library (variable `GMP_LIBRARIES` contains absolute path to the library) but `gmpxx` should be in the search paths for the linker. Report the problem to the developers. – Tsyvarev May 21 '21 at 16:26

0 Answers0