Re: build problem on windows/cygwin/mingw

Sven Luther <[email protected]> Tue, 29 Apr 2003 08:09:27 +0200
Newsgroups gmane.comp.video.gimp.windows.devel
Message-ID <20030429060927.GA1558@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.)
> 
>  > 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.
> 
>  > 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.
> 
>  > /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, i have done this, i managed to compile, but there still is a
problem.

When running the pkg-config from the gtk-win32 web site, i get a dialog
telling me that the glib 2.0.0 or something such dll is missing.

When running the pkg-config from cygwin, it compiles ok, but the
resulting executable when run again asks me about glib 2.0.0.

I suppose this is because of the path problem you mentioned before,
isn't it ? So what am i supposed to do ? 

Also, what i really want is to obtain an executable that can be run
anywhere. So is it possible to build a static gtk+ executable ? Simply
adding the -static option didn't work.

Or maybe it would be nice to have a way to easily create a installer
package of the resulting executable, with a nice winshield install or
something such, altough a simple zip archive with all the libs would do
also. Am i right in thinking that if all the .dll are in the same
directory as the executable, it should work on every box ?

Or should i use msvc++ ? I could do that, but i would not have all the
convenient tools : more, bash, vim, etc. and more precisely make.

Friendly,

Sven Luther