Re: Compiling and linking with MinGW and MSYS(undefined symbols)

"Kees Zeelenberg" <[email protected]>
Newsgroups gmane.comp.windows.gnu.user
Message-ID <00ea01c75abd$0c322480$34106550@gamma>
Probably you'll need to compile with " I/gnuwin32/include/glibc " as the 
last include option, or even better use " -idirafter /gnuwin32/include/glibc 
"

Kees Zeelenberg

----- Original Message ----- 
From: "Jay Dolan" <[email protected]>
To: <[email protected]>
Sent: Sunday, February 25, 2007 11:50 PM
Subject: [GnuWin32-Users] Compiling and linking with MinGW and 
MSYS(undefined symbols)


> Hi,
>
> I'm trying to build a GNU/Linux application on Windows using mingw,
> msys, and gnuwin32.  The application builds with Autoconf.  It has a few
> dependencies that I've been able to sort out by just massaging the
> generated Makefiles a bit, and so I attempted to do the same for the
> relevant gnuwin32 portions.
>
> I have a default install of mingw and msys in C:\mingw and c:\msys,
> respectively.  gnuwin32 is installed in c:\gnuwin32.  I added a line to
> msys' /etc/fstab so that gnuwin32 is mounted at /gnuwin32.  I had
> numerous breakages before adjusting my CFLAGS to include the gnuwin32
> directory, and so I know the compiler is finding them -- in fact it
> compiles cleanly.  I'm not sure, however, that I did it 100% correctly,
> and I'm certain that something is not right with how I attempt to link
> the application:
>
> quake2world_CFLAGS = -pipe -Wall -Werror -I/gnuwin32/include/glibc
> -I/include  -I/sdl/include
> quake2world_LDADD = -L/gnuwin32/lib -L/lib -L/sdl/lib -lgw32c -lmingw32
> -lm -lole32 -lwsock32  -lSDLmain -lSDL
>
> And the build output towards completion:
>
> /bin/sh ../libtool --mode=link gcc  -g -O2   -o quake2world.exe
> quake2world-cmd.o quake2world-cmodel.o quake2world-common.o
> quake2world-cvar.o quake2world-files.o quake2world-main.o
> quake2world-net_chan.o quake2world-net_udp.o quake2world-pmove.o
> quake2world-sv_ccmds.o quake2world-sv_ents.o quake2world-sv_game.o
> quake2world-sv_init.o quake2world-sv_main.o quake2world-sv_send.o
> quake2world-sv_user.o quake2world-sv_world.o quake2world-shared.o
> quake2world-cl_ents.o quake2world-cl_fx.o quake2world-cl_input.o
> quake2world-cl_loc.o quake2world-cl_main.o quake2world-cl_parse.o
> quake2world-cl_pred.o quake2world-cl_tent.o quake2world-cl_screen.o
> quake2world-cl_view.o quake2world-cl_console.o quake2world-cl_keys.o
> quake2world-gl_draw.o quake2world-gl_image.o quake2world-gl_light.o
> quake2world-gl_mesh.o quake2world-gl_model.o quake2world-gl_rmain.o
> quake2world-gl_rmisc.o quake2world-gl_rsurf.o quake2world-gl_sdl.o
> quake2world-gl_warp.o quake2world-pcx.o quake2world-qgl.o
> quake2world-tga.o quake2world-snd_main.o quake2world-snd_mix.o
> quake2world-snd_mem.o quake2world-snd_sdl.o -L/gnuwin32/lib -L/lib
> -L/sdl/lib -lgw32c -lmingw32 -lm -lole32 -lwsock32  -lSDLmain -lSDL
> libtool: link: warning: library `/sdl/lib/libSDL.la' was moved.
> libtool: link: warning: library `/sdl/lib/libSDL.la' was moved.
> gcc -g -O2 -o quake2world.exe quake2world-cmd.o quake2world-cmodel.o
> quake2world-common.o quake2world-cvar.o quake2world-files.o
> quake2world-main.o quake2world-net_chan.o quake2world-net_udp.o
> quake2world-pmove.o quake2world-sv_ccmds.o quake2world-sv_ents.o
> quake2world-sv_game.o quake2world-sv_init.o quake2world-sv_main.o
> quake2world-sv_send.o quake2world-sv_user.o quake2world-sv_world.o
> quake2world-shared.o quake2world-cl_ents.o quake2world-cl_fx.o
> quake2world-cl_input.o quake2world-cl_loc.o quake2world-cl_main.o
> quake2world-cl_parse.o quake2world-cl_pred.o quake2world-cl_tent.o
> quake2world-cl_screen.o quake2world-cl_view.o quake2world-cl_console.o
> quake2world-cl_keys.o quake2world-gl_draw.o quake2world-gl_image.o
> quake2world-gl_light.o quake2world-gl_mesh.o quake2world-gl_model.o
> quake2world-gl_rmain.o quake2world-gl_rmisc.o quake2world-gl_rsurf.o
> quake2world-gl_sdl.o quake2world-gl_warp.o quake2world-pcx.o
> quake2world-qgl.o quake2world-tga.o quake2world-snd_main.o
> quake2world-snd_mix.o quake2world-snd_mem.o quake2world-snd_sdl.o
> -L/gnuwin32/lib -L/lib -L/sdl/lib -lgw32c -lmingw32 -lm -lole32
> -lwsock32 -lSDLmain /sdl/lib/libSDL.dll.a -luser32 -lgdi32 -lwinmm
> -ldxguid -Wl,--rpath -Wl,/sdl/lib -Wl,--rpath -Wl,/sdl/lib
> quake2world-cmodel.o(.text+0xfdd): In function `CM_InlineModel':
> c:/gnuwin32/include/glibc/stdlib.h:317: undefined reference to
> `__strtol_internal'
> quake2world-cvar.o(.text+0xb4): In function `Cvar_VariableValue':
> c:/gnuwin32/include/glibc/stdlib.h:311: undefined reference to
> `__strtod_internal'
> quake2world-cvar.o(.text+0x287): In function `Cvar_Get':
> c:/gnuwin32/include/glibc/stdlib.h:311: undefined reference to
> `__strtod_internal'
> quake2world-cvar.o(.text+0x40e): In function `Cvar_Set2':
> c:/gnuwin32/include/glibc/stdlib.h:311: undefined reference to
> `__strtod_internal'
> quake2world-cvar.o(.text+0x4a5):c:/gnuwin32/include/glibc/stdlib.h:311:
> undefined reference to `__strtod_internal'
> quake2world-cvar.o(.text+0x5c5): In function `Cvar_FullSet':
> c:/gnuwin32/include/glibc/stdlib.h:311: undefined reference to
> `__strtod_internal'
> quake2world-cvar.o(.text+0x6ee):c:/gnuwin32/include/glibc/stdlib.h:311:
> more undefined references to `__strtod_internal' follow
> quake2world-files.o(.text+0xcc8): In function `FS_ListFiles':
> C:/msys/1.0/home/jdolan/quake2world-snapshot/src/files.c:581: undefined
> reference to `__strdup'
> quake2world-main.o(.text+0x102): In function `Sys_ConsoleOutput':
> C:/msys/1.0/home/jdolan/quake2world-snapshot/src/main.c:100: undefined
> reference to `stdout'
> quake2world-main.o(.text+0x624): In function `Sys_Error':
> C:/msys/1.0/home/jdolan/quake2world-snapshot/src/main.c:299: undefined
> reference to `stderr'
> quake2world-net_udp.o(.text+0x1e5): In function `NET_StringToSockaddr':
> C:/msys/1.0/home/jdolan/quake2world-snapshot/src/net_udp.c:155:
> undefined reference to `inet_addr'
> quake2world-net_udp.o(.text+0x201):C:/msys/1.0/home/jdolan/quake2world-snapshot/src/net_udp.c:157:
> undefined reference to `gethostbyname'
> quake2world-net_udp.o(.text+0x22e): In function `NET_StringToSockaddr':
> c:/gnuwin32/include/glibc/stdlib.h:317: undefined reference to
> `__strtol_internal'
> quake2world-net_udp.o(.text+0x48d): In function `NET_GetPacket':
> C:/msys/1.0/home/jdolan/quake2world-snapshot/src/net_udp.c:251:
> undefined reference to `recvfrom'
> quake2world-net_udp.o(.text+0x4e0):C:/msys/1.0/home/jdolan/quake2world-snapshot/src/net_udp.c:257:
> undefined reference to `errno'
> quake2world-net_udp.o(.text+0x5e8): In function `NET_SendPacket':
> C:/msys/1.0/home/jdolan/quake2world-snapshot/src/net_udp.c:301:
> undefined reference to `sendto'
> quake2world-net_udp.o(.text+0x874): In function `NET_Socket':
> C:/msys/1.0/home/jdolan/quake2world-snapshot/src/net_udp.c:362:
> undefined reference to `socket'
> quake2world-net_udp.o(.text+0x8af):C:/msys/1.0/home/jdolan/quake2world-snapshot/src/net_udp.c:374:
> undefined reference to `setsockopt'
> quake2world-net_udp.o(.text+0x8ff):C:/msys/1.0/home/jdolan/quake2world-snapshot/src/net_udp.c:391:
> undefined reference to `bind'
> quake2world-net_udp.o(.text+0x9c7): In function `NET_ErrorString':
> C:/msys/1.0/home/jdolan/quake2world-snapshot/src/net_udp.c:416:
> undefined reference to `errno'
> quake2world-sv_ccmds.o(.text+0x339): In function `SV_SetPlayer':
> c:/gnuwin32/include/glibc/stdlib.h:317: undefined reference to
> `__strtol_internal'
> quake2world-sv_main.o(.text+0x30a): In function `SVC_Info':
> c:/gnuwin32/include/glibc/stdlib.h:317: undefined reference to
> `__strtol_internal'
> quake2world-sv_main.o(.text+0x785): In function `SVC_Connect':
> c:/gnuwin32/include/glibc/stdlib.h:317: undefined reference to
> `__strtol_internal'
> quake2world-sv_main.o(.text+0x7d5):c:/gnuwin32/include/glibc/stdlib.h:317:
> undefined reference to `__strtol_internal'
> quake2world-sv_main.o(.text+0x7f6):c:/gnuwin32/include/glibc/stdlib.h:317:
> undefined reference to `__strtol_internal'
> quake2world-sv_main.o(.text+0x1c2a):c:/gnuwin32/include/glibc/stdlib.h:317:
> more undefined references to `__strtol_internal' follow
> quake2world-cl_keys.o(.text+0x316): In function `Key_Console':
> c:/gnuwin32/include/glibc/ctype.h:199: undefined reference to
> `__ctype_toupper_loc'
> quake2world-cl_keys.o(.text+0x335):c:/gnuwin32/include/glibc/ctype.h:199:
> undefined reference to `__ctype_toupper_loc'
> quake2world-gl_model.o(.text+0x47a): In function `Mod_ForName':
> c:/gnuwin32/include/glibc/stdlib.h:317: undefined reference to
> `__strtol_internal'
> quake2world-gl_rmain.o(.text+0x16a3): In function `strlwr':
> C:/msys/1.0/home/jdolan/quake2world-snapshot/src/gl_rmain.c:676:
> undefined reference to `__ctype_tolower_loc'
> quake2world-snd_sdl.o(.text+0x2c8): In function `SND_Init':
> c:/gnuwin32/include/glibc/stdlib.h:317: undefined reference to
> `__strtol_internal'
> c:/gnuwin32/lib/libgw32c.a(readlink.o)(.text+0x79):readlink.c: undefined
> reference to `IID_IPersistFile'
> make[3]: *** [quake2world.exe] Error 1
> make[3]: Leaving directory `/home/jdolan/quake2world-snapshot/src'
> make[2]: *** [all-recursive] Error 1
> make[2]: Leaving directory `/home/jdolan/quake2world-snapshot/src'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/home/jdolan/quake2world-snapshot'
> make: *** [all] Error 2
>
>
> Clearly, it's missing some very basic things.  Is there a dependency for
> gnuwin32 that I'm missing?  Do I need to copy the msvcrt.dll somewhere,
> and link against that?
>
> Thanks in advance,
>
> Jay
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share 
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> GnuWin32-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/gnuwin32-users
>
>
> 


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.