Fixed bug 2298 - undefined reference to `IID_IUnknown' on cygwin
authorSam Lantinga <slouken@libsdl.org>
Sat, 22 Feb 2014 15:34:31 -0800
changeset 8236751605725282
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
     1.1 --- a/configure	Fri Feb 21 13:57:53 2014 +0000
     1.2 +++ b/configure	Sat Feb 22 15:34:31 2014 -0800
     1.3 @@ -22808,7 +22808,12 @@
     1.4              have_loadso=yes
     1.5          fi
     1.6          # Set up the system libraries we need
     1.7 -        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -XCClinker -static-libgcc"
     1.8 +        if  -f /lib/w32api/libuuid.a ; then
     1.9 +            LIBUUID=/lib/w32api/libuuid.a
    1.10 +        else
    1.11 +            LIBUUID=-luuid
    1.12 +        fi
    1.13 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion $LIBUUID -XCClinker -static-libgcc"
    1.14          # The Windows platform requires special setup
    1.15          VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
    1.16          SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
     2.1 --- a/configure.in	Fri Feb 21 13:57:53 2014 +0000
     2.2 +++ b/configure.in	Sat Feb 22 15:34:31 2014 -0800
     2.3 @@ -2860,7 +2860,12 @@
     2.4              have_loadso=yes
     2.5          fi
     2.6          # Set up the system libraries we need
     2.7 -        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -XCClinker -static-libgcc"
     2.8 +        if [ -f /lib/w32api/libuuid.a ]; then
     2.9 +            LIBUUID=/lib/w32api/libuuid.a
    2.10 +        else
    2.11 +            LIBUUID=-luuid
    2.12 +        fi
    2.13 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion $LIBUUID -XCClinker -static-libgcc"
    2.14          # The Windows platform requires special setup
    2.15          VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
    2.16          SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"