Subject: Re: Possible Bug? linking sockets and system libraries
From: Brian Dessent <[email-masked]>
To: [email-masked]
Date: Wed, 04 Aug 2004 17:40:28 -0700

Álvaro Suárez Sarmiento wrote:

> I would be grateful if you indicate me how to correct the errors, or indicate me
> if this is a bug in "gcc". 

Build problems are rarely bugs in the compiler.  The makefile or build
environment (locally installed libraries, headers, include directories,
etc.) are usually the problem.

> gcc -Wl,--warn-common -g  -v -o ffplay_g ffplay.o cmdutils.o -L./libavformat
> -lavformat -L./libavcodec -lavcodec -lz -lpthread  -L/usr/local/lib -lmingw32
> -lSDLmain -lSDL -mwindows -mno-cygwin
                            ^^^^^^^^^^^
This means you're compiling with the mingw compiler, and Cygwin is
compltely out of the loop.  Though you are running Cygwin's gcc, it's
really just a shortcut for running mingw which uses none of the Cygwin
libraries/emulation layer.

> Reading specs from /usr/lib/gcc-lib/i686-pc-mingw32/3.3.1/specs
> Configured with: /GCC/gcc-3.3.1-3/configure --with-gcc --with-gnu-ld
> --with-gnu-as --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc
> --libdir=/usr/lib --libexecdir=/usr/sbin --mandir=/usr/share/man
> --infodir=/usr/share/info --enable-languages=c,ada,c++,f77,pascal,java,objc
> --enable-libgcj --enable-threads=posix --with-system-zlib --enable-nls
> --without-included-gettext --enable-interpreter --enable-sjlj-exceptions
> --disable-version-specific-runtime-libs --enable-shared
> --disable-win32-registry --enable-java-gc=boehm --disable-hash-synchronization
> --verbose --target=i686-pc-cygwin --host=i686-pc-cygwin --build=i686-pc-cygwin
> Thread model: posix
> gcc version 3.3.1 (cygming special)
>  /usr/lib/gcc-lib/i686-pc-mingw32/3.3.1/collect2.exe --subsystem windows
> -Bdynamic -o ffplay_g.exe
> /usr/lib/gcc-lib/i686-pc-mingw32/3.3.1/../../../../i686-pc-mingw32/lib/crt2.o
> /usr/lib/gcc-lib/i686-pc-mingw32/3.3.1/crtbegin.o -L./libavformat
> -L./libavcodec -L/usr/local/lib -L/usr/lib/gcc-lib/i686-pc-mingw32/3.3.1
> -L/usr/lib/gcc-lib/i686-pc-mingw32/3.3.1/../../../../i686-pc-mingw32/lib
> -L/usr/lib/gcc-lib/i686-pc-mingw32/3.3.1/../../.. --warn-common ffplay.o
> cmdutils.o -lavformat -lavcodec -lz -lpthread -lmingw32 -lSDLmain -lSDL
> -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -lmingw32 -lgdi32 -lcomdlg32
> -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex
> -lmsvcrt /usr/lib/gcc-lib/i686-pc-mingw32/3.3.1/crtend.o

Since you're compiling with mingw and not cygwin it means you're using
the Windows API directly, so you probably need -lws2_32 to link in the
socket functions.  Check the configure options for the thing you're
building, as it seems it was intended to build in mingw but you may have
to set some options.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/