libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using libtool via autotools causes linking problem on mingw


From: Peter Rosin
Subject: Re: Using libtool via autotools causes linking problem on mingw
Date: Fri, 08 Nov 2013 11:49:10 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0.1

On 2013-11-08 11:31, Václav Zeman wrote:
> On 7 November 2013 22:00, Panicz Maciej Godek <address@hidden 
> <mailto:address@hidden>> 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 address@hidden'
>     collect2.exe: error: ld returned 1 exit status
> 
> The -mwindows switch says that your are compiling a Windows GUI application, 
> which implies WinMain() function. If you are not doing that, remove the 
> switch and (maybe) use -mconsole instead. See 
> http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Windows-Options.html 
> for explanations of the switches.

The SDL library, for some obscure reason, has its own special take on that and
prescribes that you should keep using main() even if you are doing a GUI app.
I think the SDLmain library contains the real address@hidden entry point and 
that
entry point in turn calls the application main function. Or I should perhaps
say SDL_main (see that -Dmain=SDL_main define above). Some part of this
fragile SDL crap fails. I don't know what.

Perhaps the SDL_main library was compiled to expect an ordinary main entry
point instead of the GUI address@hidden version?

Just to be clear, I'm not an SDL user. This is just my understanding of this.
The above description might very well be flawed in some way, but SDL
initialization is peculiar.

Cheers,
Peter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]