Re: build problem on windows/cygwin/mingw

Sven Luther <[email protected]> Mon, 28 Apr 2003 15:52:02 +0200
Newsgroups gmane.comp.video.gimp.windows.devel
Message-ID <20030428135202.GB2308@iliana>
On Sun, Apr 27, 2003 at 08:52:59PM +0300, Tor Lillqvist wrote:
> Sven Luther writes:
>  > I have a cygwin install on windows
> 
>  > I tried installing the gtk+ packages from
>  > http://www.gimp.org/~tml/gimp/win32/index.html, but am not having sucess
>  > with it.
> 
> If you want to build Cygwin applications, you shouldn't. Those are for
> "native" Win32, not Cygwin. (But read on.)

Yes, this is something i know now, and i think you should clarify in the
web page, because it confused me a lot.

It seems that cygwin+mingw is a a native win32 toolchain, and that your
packages can and should be used with that.

Anyway, i tried building glib myself and it failed horribly.

>  > First problem was that i don't really know where to install them. since
>  > the packages include /lib, /bin and such, the natural way would be to
>  > unzip them in /usr, which i did. But i quickly noticed that the
>  > pkg-config configuration files of these packages use a /target/build
>  > prefix, which naturally is wrong.
> 
> The pkg-config program has been especially enhanced to take care of
> this. When compiled for Win32 (*not* if compiled for Cygwin, which is
> just a particular kind of Unix), it automatically replaces the
> "prefix" variable in .pc filles with the actual prefix deduced at
> run-time from the location of the .pc file.

Mmm.

>  > gcc -mno-cygwin -mms-bitfield `pkg-config --cflags --libs gtk+-2.0`
>  > -o hello-gtk hello-gtk.c
> 
> If you are using -mno-cygwin, then those runtime and developer
> packlages you downloaded should be OK. But on the other hand, then you
> shouldn't install them in /usr/lib, which is for Cygwin stuff only.

Notice that i had absolutely no problem building other programs with
this.

>  > /cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x1c):hello-gtk.c: undefined reference to `g_print'
> 
> You need to have the libs after the C files on the compiler command
> line. Try this:
> 
> gcc -mno-cygwin -mms-bitfield `pkg-config --cflags gtk+-2.0` -o hello-gtk hello-gtk.c `pkg-config --libs gtk+-2.0`

Ok, ok, now i know and really feel stupid, i should have checked this. I
will reboot to the dark side and try it out.

Friendly,

Sven Luther