Undefined symbols when compiling X11 software

Olivier Croquette ocroquette at free.fr
Sat Sep 8 15:42:03 PDT 2007

Hi all

After having installed X11User and the X11 SDK both from Apple, I 
couldn't understand why any port of any X11 app would fail with the 
following kind of errors:

$ sudo port install whatever
--->  Building xrender with target all
Error: Target org.macports.build returned: shell command " cd 
&& make all " returned error 2
Command output: /bin/sh ./libtool --mode=link /usr/bin/gcc-4.0 
-I/opt/local/include   -I/usr/X11R6/include -DXTHREADS -O2 
-L/opt/local/lib -o libXrender.la -rpath /opt/local/lib -version-number 
1:3:0 -no-undefined AddTrap.lo Color.lo Composite.lo Cursor.lo 
FillRect.lo FillRects.lo Filter.lo Glyph.lo Picture.lo Poly.lo Trap.lo 
Tri.lo Xrender.lo -L/usr/X11R6/lib -lX11 -lX11
/usr/bin/gcc-4.0 -dynamiclib  -o .libs/libXrender.1.3.0.dylib 
.libs/AddTrap.o .libs/Color.o .libs/Composite.o .libs/Cursor.o 
.libs/FillRect.o .libs/FillRects.o .libs/Filter.o .libs/Glyph.o 
.libs/Picture.o .libs/Poly.o .libs/Trap.o .libs/Tri.o .libs/Xrender.o 
-L/opt/local/lib -L/usr/X11R6/lib -lX11 -install_name 
/opt/local/lib/libXrender.1.dylib -compatibility_version 5 
-current_version 5.0
ld: Undefined symbols:
/usr/bin/libtool: internal link edit command failed
make[1]: *** [libXrender.la] Error 1

Everything was there in /usr/X11R6/lib, and even a "nm" was showing all 
the requested symbols.

Well, after trying to find out during 1h, I found the solution and 
wanted to share with whoever might make the same mistake:

If you have an Mac Intel, make sure you installed X11User from the Mac 
Intel install DVDs. Otherwise, you will have a working X11 (through 
Rosetta), but you won't be able to link any port application, since you 
can't mix PPC and Intel code...

The error doesn't show the real problem!

I found out compiling some sample programs on my own. Then I got a much 
clearer warning:
/usr/bin/ld: warning /usr/X11R6/lib/libX11.dylib cputype (18, 
architecture ppc) does not match cputype (7) for specified -arch flag: 
i386 (file not loaded)



More information about the macports-users mailing list