Linux MinGW linking

I’m trying to build a Windows binary in Linux using the setup specified
at:

http://www.libsdl.org/extras/win32/cross/README.txt

I’ve slightly modified the install scripts to download the lastest version
of the MinGW environment as follows:

MINGW_URL=http://unc.dl.sourceforge.net/sourceforge/mingw
GCC=gcc-3_1-20020516-1
GCC_ARCHIVE=$GCC-src.tar.gz
GCC_PATCH=""
BINUTILS=binutils-2_12_90-20020518-1
BINUTILS_ARCHIVE=$BINUTILS-src.tar.gz
MINGW=mingw-runtime-2.0-20020430
MINGW_ARCHIVE=$MINGW.tar.gz
W32API=w32api-1.5
W32API_ARCHIVE=$W32API.tar.gz

I’ve successfully built and installed the MinGW environment. However,
when trying to compile my application I get the following linking errors:

g++ particle.o fling.o …/cmds.o …/tremor.o …/fps.o …/console.o
…/font.o …/gl_draw.o …/image.o …/shell.o …/timer.o …/vector.o
…/video.o sdl-config --libs -L/usr/lib -L/usr/X11R6/lib -lGLU -lGL
-lSDL_ttf -o fling
/tmp/cross/cross2//lib/gcc-lib/i386-mingw32msvc/3.1/…/…/…/…/i386-mingw32msvc/bin/ld:
cannot find -lGLU

It appears that the linker can not find libGLU. I’m at a loss as what to
do. Does anyone have any ideas on how to fix this?

nathan

At 12:29 AM 8/4/02 -0400, you wrote:

I’m trying to build a Windows binary in Linux using the setup specified
at:

g++ particle.o fling.o …/cmds.o …/tremor.o …/fps.o …/console.o
…/font.o …/gl_draw.o …/image.o …/shell.o …/timer.o …/vector.o
…/video.o sdl-config --libs -L/usr/lib -L/usr/X11R6/lib -lGLU -lGL
-lSDL_ttf -o fling
/tmp/cross/cross2//lib/gcc-lib/i386-mingw32msvc/3.1/…/…/…/…/i386-mingw32msvc/bin/ld:
cannot find -lGLU

It appears that the linker can not find libGLU. I’m at a loss as what to
do. Does anyone have any ideas on how to fix this?

Taking a look at the minsys/mingw32 environment I have handy in win32,
there’s no libGLU here either. However, there is libglu32, libglut,
libglut32. Unless they’re completely different things (and I can’t tell),
you might try replacing the -lGLU library with some form of -lGLU32.

Again, absolutely no gurantees, but it’s worth a shot.

[snip]

I’ve successfully built and installed the MinGW environment. However,
when trying to compile my application I get the following linking errors:

g++ particle.o fling.o …/cmds.o …/tremor.o …/fps.o …/console.o
…/font.o …/gl_draw.o …/image.o …/shell.o …/timer.o …/vector.o
…/video.o sdl-config --libs -L/usr/lib -L/usr/X11R6/lib -lGLU -lGL
-lSDL_ttf -o fling

/tmp/cross/cross2//lib/gcc-lib/i386-mingw32msvc/3.1/…/…/…/…/
i386-mingw32msvc/bin/ld:
cannot find -lGLU

The OpenGL libraries for Windows are called opengl32.dll and glu32.dll.

Try something like “-lopengl32 -lglu32”.On Sunday 04 August 2002 06:29, Cournia Nathan A wrote:


Johannes Schmidt

< http://libufo.sourceforge.net > Your widget set for OpenGL

I’m getting closer. This is what I’ve done so far.

  1. Followed the directions at:
    http://www.libsdl.org/extras/win32/cross/README.txt

  2. Installed: http://www.libsdl.org/release/SDL-devel-1.2.4-mingw32.tar.gz

  3. Installed the following:
    http://www.newimage.com/~rhk/crossgcc/zlib-1.1.3-cross-bin.tar.gz
    http://www.newimage.com/~rhk/crossgcc/libpng-1.0.8-cross-bin.tar.gz
    http://www.newimage.com/~rhk/crossgcc/jpeg-6b-cross-bin.tar.gz

  4. Compiled freetype 2.1.2.

  5. Compiled SDL_ttf 2.0.5

Which brings me to my current problem. Again, I’m having linking
problems:

g++ particle.o fling.o …/cmds.o …/tremor.o …/fps.o …/console.o
…/font.o …/gl_draw.o …/image.o …/shell.o …/timer.o …/vector.o
…/video.o sdl-config --libs -lopengl32 -lglu32 -lSDL_ttf -o fling
/usr/local/cross-tools/i386-mingw32msvc/lib/libmingwex.a(snprintf.o)(.text+0x20):snprintf.c:
multiple definition of vsnprintf' fling.o(.text$vsnprintf+0x0):/tmp/cross/cross2/include/g++-v3/bits/stl_alloc.h: first defined here /usr/local/cross-tools/i386-mingw32msvc/lib/libSDLmain.a(SDL_main.o.b): In functionconsole_main’:
/home/hercules/release/SDL-1.2.4/src/main/SDL_main.c:230: undefined
reference to `SDL_main’
make: *** [fling] Error 1

The problems seem to be with vsnprintf and SDL_main.

sdl-config produces the following:

-L/usr/local/cross-tools/i386-mingw32msvc/lib -lmingw32 -lSDLmain -lSDL
-mwindows

Any ideas on how to fix this? Thanks.

nathanOn Sun, 4 Aug 2002, Johannes Schmidt wrote:

On Sunday 04 August 2002 06:29, Cournia Nathan A wrote:
[snip]

I’ve successfully built and installed the MinGW environment. However,
when trying to compile my application I get the following linking errors:

g++ particle.o fling.o …/cmds.o …/tremor.o …/fps.o …/console.o
…/font.o …/gl_draw.o …/image.o …/shell.o …/timer.o …/vector.o
…/video.o sdl-config --libs -L/usr/lib -L/usr/X11R6/lib -lGLU -lGL
-lSDL_ttf -o fling

/tmp/cross/cross2//lib/gcc-lib/i386-mingw32msvc/3.1/…/…/…/…/
i386-mingw32msvc/bin/ld:
cannot find -lGLU

The OpenGL libraries for Windows are called opengl32.dll and glu32.dll.

Try something like “-lopengl32 -lglu32”.


Johannes Schmidt

< http://libufo.sourceforge.net > Your widget set for OpenGL


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Thought I’d follow up my old messages. I’ve fixed the SDL_main linking
problem by declaring my main function as:

int main( int argc, char *argv[] )

rather than:

int main( )

as outlined at:

http://www.libsdl.org/faq.php?action=listentries&category=4#48

The vsnprintf linking problem is still a mystery. As a quick fix I
declared all of my calls to vsnprintf to vsprintf. This problem could be
caused by my use of MinGW’s gcc 3.1 environment instead of the stable
2.95.

If anyone has any insights as to how to fix the vsnprinf linking problem,
they would be appreciated. Thanks.

nathanOn Sun, 4 Aug 2002, Cournia Nathan A wrote:

I’m getting closer. This is what I’ve done so far.

  1. Followed the directions at:
    http://www.libsdl.org/extras/win32/cross/README.txt

  2. Installed: http://www.libsdl.org/release/SDL-devel-1.2.4-mingw32.tar.gz

  3. Installed the following:
    http://www.newimage.com/~rhk/crossgcc/zlib-1.1.3-cross-bin.tar.gz
    http://www.newimage.com/~rhk/crossgcc/libpng-1.0.8-cross-bin.tar.gz
    http://www.newimage.com/~rhk/crossgcc/jpeg-6b-cross-bin.tar.gz

  4. Compiled freetype 2.1.2.

  5. Compiled SDL_ttf 2.0.5

Which brings me to my current problem. Again, I’m having linking
problems:

g++ particle.o fling.o …/cmds.o …/tremor.o …/fps.o …/console.o
…/font.o …/gl_draw.o …/image.o …/shell.o …/timer.o …/vector.o
…/video.o sdl-config --libs -lopengl32 -lglu32 -lSDL_ttf -o fling
/usr/local/cross-tools/i386-mingw32msvc/lib/libmingwex.a(snprintf.o)(.text+0x20):snprintf.c:
multiple definition of vsnprintf' fling.o(.text$vsnprintf+0x0):/tmp/cross/cross2/include/g++-v3/bits/stl_alloc.h: first defined here /usr/local/cross-tools/i386-mingw32msvc/lib/libSDLmain.a(SDL_main.o.b): In functionconsole_main’:
/home/hercules/release/SDL-1.2.4/src/main/SDL_main.c:230: undefined
reference to `SDL_main’
make: *** [fling] Error 1

The problems seem to be with vsnprintf and SDL_main.

sdl-config produces the following:

-L/usr/local/cross-tools/i386-mingw32msvc/lib -lmingw32 -lSDLmain -lSDL
-mwindows

Any ideas on how to fix this? Thanks.

nathan

On Sun, 4 Aug 2002, Johannes Schmidt wrote:

On Sunday 04 August 2002 06:29, Cournia Nathan A wrote:
[snip]

I’ve successfully built and installed the MinGW environment. However,
when trying to compile my application I get the following linking errors:

g++ particle.o fling.o …/cmds.o …/tremor.o …/fps.o …/console.o
…/font.o …/gl_draw.o …/image.o …/shell.o …/timer.o …/vector.o
…/video.o sdl-config --libs -L/usr/lib -L/usr/X11R6/lib -lGLU -lGL
-lSDL_ttf -o fling

/tmp/cross/cross2//lib/gcc-lib/i386-mingw32msvc/3.1/…/…/…/…/
i386-mingw32msvc/bin/ld:
cannot find -lGLU

The OpenGL libraries for Windows are called opengl32.dll and glu32.dll.

Try something like “-lopengl32 -lglu32”.


Johannes Schmidt

< http://libufo.sourceforge.net > Your widget set for OpenGL


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl