Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#17925 closed defect (fixed)

recode +universal: Undefined symbols _libintl_bindtextdomain _libintl_gettext _libintl_textdomain

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 1.7.0
Keywords: Cc: lanceboyle@…
Port: recode, gettext

Description

Trying to install recode @3.6_3+universal fails with messages that gettext-related symbols could not be found, even though gettext @0.17_3+universal is installed:

/bin/sh ../libtool --mode=link /usr/bin/gcc-4.0  -O2 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 -L/opt/local/lib -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 -o recode  main.o freeze.o mixed.o librecode.la ../lib/libreco.a
/usr/bin/gcc-4.0 -O2 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 -L/opt/local/lib -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 -o recode main.o freeze.o mixed.o .libs/librecode.a ../lib/libreco.a
/usr/bin/ld: for architecture i386
/usr/bin/ld: Undefined symbols:
_libintl_bindtextdomain
_libintl_gettext
_libintl_textdomain
collect2: ld returned 1 exit status
/usr/bin/ld: for architecture ppc
/usr/bin/ld: Undefined symbols:
_libintl_bindtextdomain
_libintl_gettext
_libintl_textdomain
collect2: ld returned 1 exit status
lipo: can't open input file: /var/tmp//ccYkcFNd.out (No such file or directory)
make[2]: *** [recode] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive-am] Error 2

This was originally reported on macports-users by Jerry.

Change History (7)

comment:1 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

When not building universal, recode's configure script finds gettext and therefore adds -lintl to the build commands and it works. But when building universal, recode's configure script doesn't find gettext so it doesn't add -lintl to the build commands so it fails. Now we need to examine why recode's configure script behaves like that, or perhaps, we just need to autoreconf recode.

comment:2 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

See also #18276 for similar problems with wget +universal.

comment:3 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

I tried using the muniversal portgroup; no change.

I tried using autoreconf; that causes configure to fail:

checking whether ln -s works... yes
loading cache /dev/null within ltconfig
ltconfig: you must specify a host type if you use `--no-verify'
Try `ltconfig --help' for more information.
configure: error: libtool configure failed

Googling that error message reveals that this was fixed in libtool 1.4; based on recode's README, it seems to include libtool 1.3.4. Maybe if we can make it use the immensely newer libtool in the libtool port we can get further.

comment:4 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

It looks like this is specific to Tiger; it builds fine universal on Leopard.

comment:5 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: newclosed

I finally tried to compile a simple gettext example program I found:

#include <libintl.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
int main(void) {
	setlocale(LC_ALL, "");
	bindtextdomain("hello", "/opt/local/share/locale");
	textdomain("hello");
	printf(gettext("Hello, world!\n"));
	exit(0);
}

It builds with:

gcc -I/opt/local/include -L/opt/local/lib -lintl -o hello hello.c

Then I tried to build universal:

gcc -I/opt/local/include -L/opt/local/lib -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 -lintl -o hello hello.c

It fails when trying to find libiconv, which gettext uses:

/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: for architecture i386
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning can't open dynamic library: /Developer/SDKs/MacOSX10.4u.sdk/opt/local/lib/libiconv.2.dylib referenced from: /opt/local/lib/libintl.dylib (checking for undefined symbols may be affected) (No such file or directory, errno = 2)
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols:
_libiconv referenced from libintl expected to be defined in /opt/local/lib/libiconv.2.dylib
_libiconv_open referenced from libintl expected to be defined in /opt/local/lib/libiconv.2.dylib
_libiconv_set_relocation_prefix referenced from libintl expected to be defined in /opt/local/lib/libiconv.2.dylib
collect2: ld returned 1 exit status

Because I specified -isysroot but not -liconv it thinks it's supposed to look for libiconv in the MacPorts prefix inside the sysroot -- inside /Developer/SDKs/MacOSX10.4u.sdk -- but of course there isn't any MacPorts prefix inside the SDK. If I add -liconv it knows not to prepend the sysroot and works fine:

gcc -I/opt/local/include -L/opt/local/lib -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 -lintl -liconv -o hello hello.c

So I imagine that the configure script is doing the same thing, is not using -liconv, and when the program fails to compile, it assumes this is because gettext doesn't exist.

The easy fix is to add -liconv to the configure.ldflags which I did in r46175.

comment:6 in reply to:  5 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to ryandesign@…:

The easy fix is to add -liconv to the configure.ldflags which I did in r46175.

Which is the same fix that was done for dcraw in #13575.

comment:7 Changed 15 years ago by (none)

Milestone: Port Bugs

Milestone Port Bugs deleted

Note: See TracTickets for help on using tickets.