[MacPorts] #17925: recode +universal: Undefined symbols _libintl_bindtextdomain _libintl_gettext _libintl_textdomain
MacPorts
noreply at macports.org
Fri Jan 30 22:59:13 PST 2009
#17925: recode +universal: Undefined symbols _libintl_bindtextdomain
_libintl_gettext _libintl_textdomain
--------------------------------------+-------------------------------------
Reporter: ryandesign@… | Owner: ryandesign@…
Type: defect | Status: closed
Priority: Normal | Milestone: Port Bugs
Component: ports | Version: 1.7.0
Resolution: fixed | Keywords:
Port: recode, gettext |
--------------------------------------+-------------------------------------
Changes (by ryandesign@…):
* status: new => closed
* resolution: => fixed
Comment:
I finally tried to compile
[http://oriya.sarovar.org/docs/gettext_single.html 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.
--
Ticket URL: <http://trac.macports.org/ticket/17925#comment:5>
MacPorts <http://www.macports.org/>
Ports system for Mac OS
More information about the macports-tickets
mailing list