Home grown Linux x86 system, pretty bleeding edge on everything.
It looks like, starting with SDL-1.2.7, that libSDL.so now depends on
libstdc++:
nexus at thune[1:24pm]/usr/src/SDL(417) ldd ./SDL-1.2.8-build/src/.libs/libSDL.so
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x4009c000)
libm.so.6 => /lib/libm.so.6 (0x40179000)
libdl.so.2 => /lib/libdl.so.2 (0x4019e000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x401a2000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x4026b000)
libpthread.so.0 => /lib/libpthread.so.0 (0x40279000)
libc.so.6 => /lib/libc.so.6 (0x402cc000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x403e1000)
/lib/ld-linux.so.2 (0x80000000)
As a result, when other apps try to find if SDL is installed, and they use
gcc instead of g++, they fail with linkage errors during configure. Here’s
an example from config.log from libdv that’s pretty typical:
configure:19648: checking for sdl-config
configure:19666: found /usr/X11R6/bin/sdl-config
configure:19679: result: /usr/X11R6/bin/sdl-config
configure:19687: checking for SDL - version >= 1.1.6
configure:19779: i486-linux-gcc -o conftest -g -O2 -Wall -g -I/usr/X11R6/include /SDL -D_REENTRANT -I/usr/X11R6/include -L/usr/X11R6/lib conftest.c -L/usr/X11R6 /lib -Wl,-rpath,/usr/X11R6/lib -lSDL -lpthread >&5
/usr/lib/libstdc++.so.6: undefined reference to _Unwind_DeleteException at GCC_3.0' /usr/lib/libstdc++.so.6: undefined reference to
_Unwind_Resume at GCC_3.0’
/usr/lib/libstdc++.so.6: undefined reference to _Unwind_RaiseException at GCC_3.0' /usr/lib/libstdc++.so.6: undefined reference to
_Unwind_GetRegionStart at GCC_3.0’
/usr/lib/libstdc++.so.6: undefined reference to _Unwind_GetDataRelBase at GCC_3.0' /usr/lib/libstdc++.so.6: undefined reference to
_Unwind_SetGR at GCC_3.0’
/usr/lib/libstdc++.so.6: undefined reference to _Unwind_GetLanguageSpecificData at GCC_3.0' /usr/lib/libstdc++.so.6: undefined reference to
_Unwind_Resume_or_Rethrow at GCC_3.3’
/usr/lib/libstdc++.so.6: undefined reference to _Unwind_GetIP at GCC_3.0' /usr/lib/libstdc++.so.6: undefined reference to
_Unwind_GetTextRelBase at GCC_3.0’
/usr/lib/libstdc++.so.6: undefined reference to `_Unwind_SetIP at GCC_3.0’
collect2: ld returned 1 exit status
It looks like the problem is, starting with SDL-1.2.7, switching from
automake-1.4 to automake-1.8.
As a result, we end up with this section in src/main/Makefile.in:
libarch.la: $(libarch_la_OBJECTS) $(libarch_la_DEPENDENCIES)
$(CXXLINK) $(libarch_la_LDFLAGS) $(libarch_la_OBJECTS) $(libarch_la_LIBADD) $(LIBS)
In 1.2.6, that was LINK, not CXXLINK. Running automake-1.9 against
SDL-1.2.6 ended up with a CXXLINK there as well, so I’m pretty sure it’s
automake.
I believe the problem comes from this in Makefile.am:
if TARGET_BEOS
ARCH_SRCS = beos/SDL_BeApp.cc beos/SDL_BeApp.h
else
ARCH_SRCS = arch.c
endif
Because there is at least one path that has a potential .cc file, it uses
CXXLINK instead of LINK. Actually, cheating and changing SDL_BeApp.cc to
SDL_BeApp.c and rerunning automake results in LINK instead CXXLINK.
Anyway, I use this patch locally when building:
diff -ru SDL-1.2.8.orig/src/main/Makefile.in SDL-1.2.8/src/main/Makefile.in
— SDL-1.2.8.orig/src/main/Makefile.in 2004-12-13 01:04:02.000000000 -0800
+++ SDL-1.2.8/src/main/Makefile.in 2005-04-27 13:08:18.000000000 -0700
@@ -411,7 +411,7 @@
rm -f “$${dir}/so_locations”;
done
libarch.la: $(libarch_la_OBJECTS) $(libarch_la_DEPENDENCIES)
-
$(CXXLINK) $(libarch_la_LDFLAGS) $(libarch_la_OBJECTS) $(libarch_la_LIBADD) $(LIBS)
-
$(LINK) $(libarch_la_LDFLAGS) $(libarch_la_OBJECTS) $(libarch_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
And that makes for a happyier library:
nexus at thune[2:07pm]/usr/src/SDL(328) ldd ./SDL-1.2.8-build/src/.libs/libSDL.so
libm.so.6 => /lib/libm.so.6 (0x4009c000)
libdl.so.2 => /lib/libdl.so.2 (0x400c2000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x400c6000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x4018f000)
libpthread.so.0 => /lib/libpthread.so.0 (0x4019d000)
libc.so.6 => /lib/libc.so.6 (0x401f0000)
/lib/ld-linux.so.2 (0x80000000)
What I don’t understand is, how does this work on distributions like
debian? I didn’t see a similar patch for their libSDL. So does it link
against libstdc++ there? If so, how do they get other applications to
build against that libSDL?
I’m not sure what to suggest here. Just pointing out the problem and my
local work around.
Thoughts?
mrc