On 2013-11-07 22:00, Panicz Maciej Godek wrote: > Hi, > For some time I've been trying to compile my framework > for writing multimedia and 3d games in Guile Scheme > on Windows/MinGW. > The framework uses SDL library, and more details can be > found here: https://puszcza.gnu.org.ua/projects/slayer > > After many issues with compiling Guile Scheme on MinGW, > I've finally managed to achieve it, and having build SDL, > I proceeded to compile my framework. > > Although I did use the autotools to create a package, > I know only superficially how it is supposed to work. > Having ./configured my project, I managed to build the > object files, but the final linking (performed by libtool) > fails. It is invoked in the following way: > > ./libtool --tag=CXX --mode=link g++ -D_GNU_SOURCE=1 -Dmain=SDL_main > -Ic:/mingw/msys/1.0/include/SDL -Ic:/mingw/msys/1.0/include/guile/2.0 > -I/usr/local/include -Ic:/mingw/msys/1.0/include -Wall -Werror -mwindows > -Lc:/mingw/msys/1.0/lib -lmingw32 -lSDLmain -lSDL -Lc:/mingw/msys/1.0/lib > -lguile-2.0 -lgc -mwindows -Lc:/mingw/msys/1.0/lib -lSDL_image -lmingw32 > -lSDLmain -lSDL -g -O2 -mwindows -Lc:/mingw/msys/1.0/lib -lmingw32 > -lSDLmain -lSDL -Lc:/mingw/msys/1.0/lib -lguile-2.0 -lgc -mwindows > -Lc:/mingw/msys/1.0/lib -lSDL_image -lmingw32 -lSDLmain -lSDL -o > slayer.exe file.o font.o image.o input.o slayer.o symbols.o video.o > -lSDL_ttf > > and the following error appears: > c:/mingw/msys/1.0/lib/libmingw32.a(main.o): In function `main': > e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/main.c:91: > undefined reference to `WinMain@16' > collect2.exe: error: ld returned 1 exit status > > However, I do manage to build the executable with the following command: > gcc -o slayer.exe file.o font.o image.o input.o slayer.o symbols.o video.o > -mwindows -lmingw32 -lSDLmain -lSDL -lSDL_image -lSDL_ttf -lguile-2.0 > > (there are still some problems caused by libguile in the runtime, but at > least the linkign stage succeeds) > > I know that it might be a complicated issue, and the cause might lie on the > side of either MinGW or SDL or pkg-config or autotools or mine, but I thought > it might be best to ask you first. > > The project's files can be browsed here > http://hg.gnu.org.ua/hgweb/slayer/file/bb4c97fd8329
Hi! This is a classic error. You have to specify libraries *after* the object files and other libraries that need them in order to be portable. In your case the specifics are that you are adding a lot of $(FOO_LIBS) vars to AM_LDFLAGS in src/Makefile.am when you should probably have specified them in slayer_LDADD or something such instead. Hope that helps. Cheers, Peter _______________________________________________ https://lists.gnu.org/mailman/listinfo/libtool