This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

New problems with -mno-cygwin


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]