[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_LIB_HAVE_LINKFLAGS: linking with static library on macOS

From: Mohammad Akhlaghi
Subject: Re: AC_LIB_HAVE_LINKFLAGS: linking with static library on macOS
Date: Mon, 27 May 2019 00:57:19 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0

On 5/26/19 12:42 AM, Bruno Haible wrote:
archive member: .libs/libgnuastro.a(libcfitsio.a) fat file for cputype
(7) cpusubtype (3) is not an object file (bad magic number)
internal ranlib command failed

This error does not involve any GNU tools tools or libraries. It only
involves the Apple tools and /usr/local stuff (MacPorts or Homebrew?).
You find the answer on stackoverflow.com:

I think the Mac system in question uses Homebrew (its not mine!).

After some investigation, I came up with [1] which says: "The root cause
of it is what we provide static libraries on OS X only in fat(Universal
binary) format and GNU libtool does not know anything about it. Our
recommendation here is to use libtool which is provided by Apple in

It is true that the GNU build system does not support building fat
binaries. Installing the GNU binutils would not help either. You can
build fat binaries only by building one binary per arch and then
glueing them together using the Apple tool ('lipo' or some such).

The text you cited sounds like Apple libtool is a replacement for
GNU libtool. This would be nonsense. There is no need to invoke
Apple's libtool. Use GNU libtool to create shared libraries.

Indeed, I was thinking that GNU Libtool and Mac's Libtool aren't inter-changable and was a little puzzled by the text I quoted. Thanks for the confirmation.

Generally, to avoid such crashes during the build, what do you think about adding a check in `AC_LIB_HAVE_LINKFLAGS' to test this scenario (see if the used libtool can link with the found static library)? Getting a notice/warning/crash at configure time is much easier for a user than during build time.

Thanks a lot,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]