Fixed bug 2298 - undefined reference to `IID_IUnknown' on cygwin
authorSam Lantinga <slouken@libsdl.org>
Sat, 22 Feb 2014 15:34:31 -0800
changeset 8236 751605725282
parent 8235 cc1d377f014a
child 8237 6cc44a5d9eef
Fixed bug 2298 - undefined reference to `IID_IUnknown' on cygwin Brian Minton When building static or shared libraries on cygwin 1.7.25 on Windows 7 (32-bit), I get the following link errors: build/.libs/SDL_windowskeyboard.o: In function `UIElementSink_QueryInterface@12': /home/c-bminton/src/SDL/src/video/windows/SDL_windowskeyboard.c:995: undefined reference to `IID_IUnknown' build/.libs/SDL_windowskeyboard.o: In function `IPPASink_QueryInterface@12': /home/c-bminton/src/SDL/src/video/windows/SDL_windowskeyboard.c:1101: undefined reference to `IID_IUnknown' collect2: error: ld returned 1 exit status Makefile:126: recipe for target 'build/libSDL2.la' failed make: *** [build/libSDL2.la] Error 1 -- The libuuid from e2fsprogs is completely unrelated to the w32api UUID.DLL implib. FWIW, any *NIX software that I've seen obviously wants the e2fsprogs version, but if libuuid-devel is installed (in /usr/lib) then you can't link against the w32api implib with a simple -luuid.
configure
configure.in
--- a/configure	Fri Feb 21 13:57:53 2014 +0000
+++ b/configure	Sat Feb 22 15:34:31 2014 -0800
@@ -22808,7 +22808,12 @@
             have_loadso=yes
         fi
         # Set up the system libraries we need
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -XCClinker -static-libgcc"
+        if  -f /lib/w32api/libuuid.a ; then
+            LIBUUID=/lib/w32api/libuuid.a
+        else
+            LIBUUID=-luuid
+        fi
+        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion $LIBUUID -XCClinker -static-libgcc"
         # The Windows platform requires special setup
         VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
         SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
--- a/configure.in	Fri Feb 21 13:57:53 2014 +0000
+++ b/configure.in	Sat Feb 22 15:34:31 2014 -0800
@@ -2860,7 +2860,12 @@
             have_loadso=yes
         fi
         # Set up the system libraries we need
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -XCClinker -static-libgcc"
+        if [ -f /lib/w32api/libuuid.a ]; then
+            LIBUUID=/lib/w32api/libuuid.a
+        else
+            LIBUUID=-luuid
+        fi
+        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion $LIBUUID -XCClinker -static-libgcc"
         # The Windows platform requires special setup
         VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
         SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"