delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/07/05/13:36:03

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Fri, 05 Jul 2002 13:34:28 -0400
From: "Scott A. Smith" <ssmith AT magnet DOT fsu DOT edu>
Subject: New problems with -mno-cygwin
In-reply-to: <PCEJJPDHEECNEKDDLPNLKECBCAAA.ssmith@magnet.fsu.edu>
To: cygwin AT cygwin DOT com
Message-id: <PCEJJPDHEECNEKDDLPNLEECCCAAA.ssmith@magnet.fsu.edu>
MIME-version: 1.0
X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
Importance: Normal
X-Priority: 3 (Normal)
X-MSMail-priority: Normal

Hi,

I had built a small test DLL with cygwin, worked great. I then adjusted
the Cygwin mingw directory files for C++ and rebuilt the DLL with
additional -mno-cygwin flags. Again no problems! Recently I ran setup
and upgraded everything Cygwin on my system. Things work fine, Cygwin
still makes the DLL, but the DLL build using -mno-cygwin no longer seems
to work. I get errors regarding multiple definitons when I try an make
any executables linking to my DLL:

.//libBasics.dll.a(d000259.o)(.text+0x0): multiple definition of `atexit'
/usr/lib/mingw/crt2.o(.text+0xfc):crt1.c: first defined here
.//libBasics.dll.a(d000223.o)(.text+0x0): multiple definition of `_onexit'
/usr/lib/mingw/crt2.o(.text+0x114):crt1.c: first defined here

Does anyone know why this would happen? The same executable using
the Cygwin built DLL (no MinGW) works fine. It seems like either the command
to do the linking is adding in multiple libraries having these defined or
the
DLL build goes funny and adds them in where they shouldn't be.

Here is what my final linking command looks like (making a test program
using the DLL):

c++ -v -o TestBasics.exe -g  -mno-cygwin TestBasics.o -L./ -lBasics
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/specs
gcc version 2.95.3-5 (cygwin special)
/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/collect2.exe -Bdynamic --dll-search
-prefix=cyg -o TestBasics.exe
/usr/lib/mingw/crt2.o -L./ -L/usr/lib/mingw -L/usr/lib/w32api -L/usr/lib/gcc
-lib/i686-pc-cygwin/2.95.3-5
TestBasics.o -lBasics -lstdc++ -lmingw32 -lgcc -lmoldname -lmsvcrt -lmingw32
 -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmsvcr
t

Are the repeated libraries proper? When I look in the straight Cygwin built
DLL (mine is Basics.dll) it does not have atexit listed, but it is listed in
the DLL built with -mno-cygwin. If it matters, here is the command that made
the
DLL:

g++ -shared -Wl,--out-implib=libBasics.dll.a -o Basics.dll
${MYOBJS} -Wl,--export-all-symbols --target=i386-mingw32 -mno-cygwin

and all of my object files are made with commands such as

c++ -c -mno-cygwin -I. -g  -o TestBasics.o TestBasics.cc

I am pretty certain that this problem began to occur after my last
Cygwin upgrade. Thanks in advance for any help.

Scott

 =======================================
 Scott A. Smith


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019