Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Message-ID: <411181FC.DC042627@dessent.net>
Date: Wed, 04 Aug 2004 17:40:28 -0700
From: Brian Dessent <brian@dessent.net>
Organization: My own little world...
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: Possible Bug? linking sockets and system libraries
References: <1091661355.41116e2b098db@correo.ulpgc.es>
Content-Type: text/plain; charset=iso-8859-1
X-IsSubscribed: yes
Reply-To: cygwin@cygwin.com
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id i750e3Ep016585

Á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/


