bug#52253: mingw cross-compilation issue - possibly as of commit ac40b5f37a
Ozkan Sezer <[email protected]>
| Newsgroups | gmane.comp.gnu.libtool.bugs |
|---|---|
| Message-ID | <CAA2C=vCbgWnKsSzXHYQd2wQW0zwSN3rCwfLDxpawG_dOk1kEoQ@mail.gmail.com> |
Linking executables with a linux-to-windows cross-compilation setup has issues: $ export PATH=/opt/cross_win64/bin:$PATH $ export PKG_CONFIG_PATH=/home/sz/x86_64-w64-mingw32/lib/pkgconfig $ pkg-config --cflags sdl2 -Dmain=SDL_main -I/home/sz/x86_64-w64-mingw32/include/SDL2 $ pkg-config --libs sdl2 -mwindows -L/home/sz/x86_64-w64-mingw32/lib -lmingw32 -lSDL2main -lSDL2 $ cd SDL_net $ ./configure --host=x86_64-w64-mingw32 --prefix=/home/sz/x86_64-w64-mingw32 [...] $ make [...] libtool: link: ( cd ".libs" && rm -f "libSDL2_net.la" && ln -s "../libSDL2_net.la" "libSDL2_net.la" ) /bin/sh ./libtool --tag=CC --mode=link x86_64-w64-mingw32-gcc -g -O2 -Dmain=SDL_main -I/home/sz/x86_64-w64-mingw32/include/SDL2 -o showinterfaces.exe showinterfaces.o libSDL2_net.la -mwindows -L/home/sz/x86_64-w64-mingw32/lib -lmingw32 -lSDL2main -lSDL2 libtool: link: x86_64-w64-mingw32-gcc -g -O2 -Dmain=SDL_main -I/home/sz/x86_64-w64-mingw32/include/SDL2 -o .libs/showinterfaces.exe showinterfaces.o -mwindows ./.libs/libSDL2_net.dll.a -L/home/sz/x86_64-w64-mingw32/lib -lws2_32 -liphlpapi -lmingw32 -lSDL2main -lSDL2 -L/home/sz/x86_64-w64-mingw32/lib libtool: error: Could not determine the host path corresponding to libtool: error: '/home/sz/SDL_net/.libs' libtool: error: Continuing, but uninstalled executables may not work. libtool: error: Could not determine the host path corresponding to libtool: error: '/home/sz/x86_64-w64-mingw32/lib:/home/sz/x86_64-w64-mingw32/bin:/home/sz/SDL_net/.libs' libtool: error: Continuing, but uninstalled executables may not work. /opt/cross_win64/lib/gcc/x86_64-w64-mingw32/4.5.4/../../../../x86_64-w64-mingw32/lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o): In function `main': /home/sz/Downloads/W64_4.5_189152-src/build-crt/../mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `WinMain' collect2: ld returned 1 exit status x86_64-w64-mingw32-strip: './showinterfaces.exe': No such file The link library order, i.e. -lmingw32 -lSDL2main -lSDL2 is important here. I am not exactly sure what libtool does here, because manual linking without libtool getting in the way actually works, e.g.: $ x86_64-w64-mingw32-gcc -g -O2 -Dmain=SDL_main -I/home/sz/x86_64-w64-mingw32/include/SDL2 -o .libs/showinterfaces.exe showinterfaces.o -mwindows ./.libs/libSDL2_net.dll.a -L/home/sz/x86_64-w64-mingw32/lib -lws2_32 -liphlpapi -lmingw32 -lSDL2main -lSDL2 The issue shows itself with libtool-2.4.2 and 2.4.6 -- libtool-2.2.6 does not have this issue. The problem likely started with this commit by Charles Wilson: http://git.savannah.gnu.org/gitweb/?p=libtool.git;a=commit;h=ac40b5f37ae68a7b4a254e43364e2d297f563310 Is there a way of resolving this, please? -- O.S.