[Top][All Lists]

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

Possible problem with gettext.m4 for binutils

From: Stephen Casner
Subject: Possible problem with gettext.m4 for binutils
Date: Sun, 7 Feb 2021 22:40:05 -0800 (PST)
User-agent: Alpine 2.21.9999 (OSX 301 2018-08-15)

When building a native binutils on macOS [1] I get unresolved
references to libiconv.  Nick Alcock helped investigate this and
concluded that the root of the problem lies in gettext.m4, so he
suggested that I send this email to bug-gettext.  Specifically, the
problem may be that when gettext decides that -liconv must be included
it does not also include -L to make sure the loaded library is the one
that it has chosen.

On many systems this may not be a problem because there is only one
libiconv.  However, in my macOS the system /usr/lib/libiconf.dylib is
an older version that defines _iconv, _iconv_close, _iconv_open.  That
system version is protected so I can't change it.  But some of the
binutils code requires a newer libiconv that defines _libiconv,
_libiconv_close, _libiconv_open.  I have installed that library using
MacPorts as /opt/local/lib/libiconv.{a,dylib}.

In order to build gdb, I also need libgmp, libmpc, libmpfr, so I have
also installed those with MacPorts into /opt/local/lib.  In order to
include them in the build, I need to include the configure option
--with-libgmp-prefix=/opt/local which causes -I/opt/local/include and
-L/opt/local/lib to be included in the compile and link commands for
the gdb files.  Therefore those files expect the _libiconv symbols.

However, libintl is also included in the gdb link, but its configure
tests find the system libiconv so I get unresolved _iconv symbols from
dcigettext.o and loadmsgcat.o.

There is a --with-libiconv-prefix option for gdb that also applies to
intl, but when I include that it causes -I./../intl to be removed from
the compile commands for bfd, so those fail.  An alternative of
specifying LDFLAGS=-L/opt/local/lib on the binutils configure causes
the same bfd compilation failure.

My workaround has been to hack the Makefile for gdb so that both
libiconv libraries are included explicitly, but I would like to be
able to fix this properly.  Any insight you can provide would be much

                                                        -- Steve

[1] I'm running macOS Mojave (10.14.6) rather than the newer Catalina
or Big Sur because Mojave is the last one that still supports 32-bit
executables, some of which I need to use.  I don't know if the system
libiconv would be sufficient on the later macOS releases.

reply via email to

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