[Top][All Lists]

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

Re: Using libtool via autotools causes linking problem on mingw

From: Panicz Maciej Godek
Subject: Re: Using libtool via autotools causes linking problem on mingw
Date: Sat, 9 Nov 2013 01:52:17 +0100

2013/11/8 Peter Rosin <address@hidden>
On 2013-11-08 12:18, Panicz Maciej Godek wrote:
> 2013/11/8 Peter Rosin <address@hidden <mailto:address@hidden>>
>     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.
> I can later try to add some of the options from the libtool 
> invocation generated by autoconf to my invocation of gcc to see
> which particular option causes the failure and then let you know. 
> I think that your description of the way SDL does things on mingw 
> is sound (and I think that the goal is to ensure portability, as
> unix programmers have no idea what the WinMain is)

Hmmm, I have this hunch that the -nostdlib option that libtool adds to the
g++ invocation beats -mwindows, just like it beats -pthread. But I don't
know that for a fact...
I just made the following test: I removed the mediation of libtool
and called g++ directly, with the same flags, i.e.
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  -g -O2   -o slayer.exe file.o font.o image.o input.o slayer.o symbols.o video.o   -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   -lSDL_ttf 

(the initial part, "/bin/sh ../libtool --tag=CXX   --mode=link", was removed)
and it got linked with no complaints. I then removed both -mwindows flags
from the above invocation, and it did work as well.

So plainly it looks as if there was some problem with libtool on MinGW.
Unfortunately, I'm not a shell scripting master, so I can't say exactly which command libtool uses to link the program and how it is invoked.

reply via email to

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