1

While trying to build the latest GnuPG (2.1.1 modern), my build fails when trying to link t-stringhelp. make outputs:

ld: warning: ignoring file libcommon.a, file was built for archive which is not the architecture being linked (x86_64): libcommon.a
Undefined symbols for architecture x86_64:
  "_compare_filenames", referenced from:
      _main in t-stringhelp.o
  "_make_absfilename_try", referenced from:
      _main in t-stringhelp.o
  "_make_filename_try", referenced from:
      _main in t-stringhelp.o
  "_percent_escape", referenced from:
      _main in t-stringhelp.o
  "_strconcat", referenced from:
      _main in t-stringhelp.o
  "_xstrconcat", referenced from:
      _main in t-stringhelp.o

I don't know how to fix this as libcommon is part of the source, so it should build fine. When building with CFLAGS="-m64" (-arch x86_64 does nothing), I get this:

ld: warning: ignoring file ../common/libgpgrl.a, file was built for archive which is not the architecture being linked (x86_64): ../common/libgpgrl.a
Undefined symbols for architecture x86_64:
  "_gnupg_rl_initialize", referenced from:
      _main in gpg.o

I've also rebuilt all the depandancies (as I built them on Mavericks), except pinentry, as it can't find libiconv which is also installed. My configure outputs that its target is Darwin (x86_64-apple-darwin14.0.0), so this should work. I have also got all the latest prerequisites, tried to install everything in its own directory (--prefix=/usr/local/gnupg-2.1.1), build all the dependancies and GnuPG as 32 bits (again, fails on same error), created a separate build folder and tried to build in there, but only one thing so far has solved the error: looking at how libgpgrl.a is being built - it's only component is common/gpgrlhelp.c - so I cd'ed into g10 and tried to build gpg2, replacing ../common/libgpgrl.a with ../common/gpgrlhelp.o, the lib common.a with all of its object files, for all the libraries that didn't work. Then some programs weren't linking to libksba libgcrypt and libassuan, so I changed the Makefiles, so that they could link. I can now compile all the code well, I installed everything, but I get a new error, when I try to run gpg2:

dyld: lazy symbol binding failed: Symbol not found: __gcry_mpi_init
  Referenced from: /usr/local/gnupg-2.1.1/lib/libgcrypt.20.dylib
  Expected in: flat namespace

dyld: Symbol not found: __gcry_mpi_init
  Referenced from: /usr/local/gnupg-2.1.1/lib/libgcrypt.20.dylib
  Expected in: flat namespace

I have everything in my path, which is:

/usr/local/gnupg-2.1.1/bin:/usr/local/gnupg-2.1.1/lib:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin

I could compile GnuPG-2.0.22 on Mavericks, but no version of GnuPG builds on Yosemite.

Please help, I'm really confused.

3 Answers 3

3

I’ve been running GnuPG 2.1 on Yosemite 10.10.2 (the latest public beta of as of this writing) for about a week and it’s been fine.

You can follow these directions for using brew tap or you can use the raw URL: brew install https://github.com/mtigas/homebrew-gpg21/raw/master/Formula/gnupg2.rb.

Note this formula installs GnuPG 2.1; not GnuPG 2.1.1, the version originally asked about. I can confirm this bug where gpg2 --refresh-keys fails with some keyservers using 2.1 (apparently fixed in 2.1.1) but it’ll get you 90% there.

It shouldn’t be hard to update the formula to install 2.1.1.

Update Someone submitted a pull request for GNuPG 2.1.1 support—I just tried it and it worked great. Short answer: brew install https://raw.githubusercontent.com/calebthompson/homebrew-gpg21/2.1.1/Formula/gnupg2.rb.

1
  • Thank you for your detailed response, I've just worked out that I had a ranlib in /usr/local/bin/ranlib, which was broken. I renamed it to /usr/local/bin/ranlib_old, the running make clean then make works fine, but I the same errors as I have described above (to do with dyld, but I'm planning to rebuild all the dependancies with /usr/bin/ranlib). Thank you for answering, I will add further details soon.
    – Python Kid
    Dec 30, 2014 at 20:26
1

Personally, I would install homebrew, which is a one-liner pasted from their website (http://brew.sh) then do

brew install gnupg

If therw are any problems, run

brew doctor

and heed the good doctor's advice.

3
  • Thank you for the reply, I was hoping to get GnuPG built myself, so that I can fix similar future errors and use homebrew as a last resort.
    – Python Kid
    Dec 1, 2014 at 20:59
  • 1
    You can always take a look at the formula in homebrew to see how they are building it and then adapt as needed to your own needs.
    – macshome
    Dec 10, 2014 at 22:44
  • I did take a look at homebrew's formula for GnuPG, but unfortunately they are using an older version of GnuPG, which I have also attempted to build, but with no success.
    – Python Kid
    Dec 19, 2014 at 10:26
1

Turns out I had a ranlib in /usr/local/bin/ranlib. It was broken, I don't know how it got there (I did try to build gcc at some point, it doesn't support make uninstall, so that's probably why). I just ran:

sudo mv /usr/local/ranlib /usr/local/ranlib_old

Then I just rebuilt all the dependancies, and it worked!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.