This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Build/Linker question again (g++)
"Gerrit P. Haase" <gp@familiehaase.de> wrote in message
417ADE6A.7090804@familiehaase.de">news:417ADE6A.7090804@familiehaase.de...
> Judd wrote:
>
> > The error I'm getting now is:
> > ----------------------------
> > /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/libgcc.a(_chkstk.o)(.text+0x0):
> > multiple definition of `__alloca'
> >
> > /usr/lib/libcygwin.a(d000085.o)(.text+0x0): first defined here
> >
> > /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/libgcc.a(_eprintf.o)(.text+0x0):
> > multiple definition of `___eprintf'
> >
> > /usr/lib/libcygwin.a(d000027.o)(.text+0x0): first defined here
> >
> > ---------------------------------
> >
> > From the build command:
> >
> > -------------------------
> >
> > g++ -shared \
> > -nodefaultlibs \
> > -o libInventor.dll \
> > -Wl,--out-implib=libInventor.dll.a \
> > -Wl,--export-all-symbols \
> > -Wl,--enable-auto-import \
> > -Wl,--whole-archive \
> > libInventor.a \
> > -WL,--no-whole-archive \
> > -L/usr/lib \
> > -L/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3 \
> > -L/usr/X11R6/lib \
> > -L/usr/lib/w32api \
> > -L../libimage \
> > -L../libFL/src \
> > -ljpeg.dll -limage -lFL -lX11.dll -lfltk_gl.dll -lGLU.dll \
> > -lGL.dll -liconv.dll -lfreetype.dll -lcygwin -lstdc++ \
> > -lasprintf -lz -lkernel32 -lgcc
>
> You don't need to add the .dll prefix, the linker should automatically
> pick up the .dll.a import lib if both, import lib and static archives
> are present.
>
Not the problem, but thanks.
>
> > -----------------------------
> >
> > I'm using nodefaultlibs because I had a problem linking before where I
was
> > getting lots of multiple definition errors from essentially the same
> > library. Using nodefaultlibs and linking all the libs I need by hand
has
> > fixed all those, but I have those last 2 multiple definition errors. Is
> > there any way to link libcygwin and libgcc without getting multiple
> > definitions of ___eprintf and __alloca? It seems bizarre that those 2
would
> > conflict. Maybe there's a command line option that I need to be using
in my
> > build command.
>
> There is no option like nodefaultlibs:
>
> $ ld --help | grep nodefaultlibs
>
> Try -nostdlib instead.
Actually, the option does exist with 3.3.3 and it does work. It forces the
linker not to use default libraries. I could take the argument out and get
a completely different build. I'm more interested in somone knowing about
the errors I suppose and how to get around a multiple definition error of
eprintf and alloca between libgcc and libcygwin.
--
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/