[csw-users] GCC4 ld Warnings
Maciej Bliziński
maciej at opencsw.org
Tue Apr 12 00:34:42 CEST 2011
2011/4/11 Kapoor, Nitin <Nitin.Kapoor at sensis.com>:
> (...) -licuuc -licudata -lnsl -lsocket -lpthread -ldl /opt/csw/gcc4/lib/libstdc++.so
I believe that the culprit is the explicit
"/opt/csw/gcc4/lib/libstdc++.so" parameter given to the linker, you
can see it up there in the output. Here's a minimal example to
reproduce this behavior:
maciej at netra ~/src/gcc-test $ cat Makefile
PATH := /opt/csw/bin:/opt/csw/gcc4/bin:$(PATH)
LDFLAGS = -R/opt/csw/gcc4/lib -L/opt/csw/gcc4/lib $(EXTRA_LDFLAGS)
CC = gcc
CXX = g++
all: foo
foo: foo.cpp
foo.cpp: Makefile
echo '#include <stdio.h>' > foo.cpp
echo 'main(void) { printf("Hello world!\\n"); }' >> foo.cpp
clean:
rm -f foo foo.o foo.cpp
maciej at netra ~/src/gcc-test $ gmake
echo '#include <stdio.h>' > foo.cpp
echo 'main(void) { printf("Hello world!\\n"); }' >> foo.cpp
g++ -R/opt/csw/gcc4/lib -L/opt/csw/gcc4/lib foo.cpp -o foo
maciej at netra ~/src/gcc-test $ gmake clean
rm -f foo foo.o foo.cpp
maciej at netra ~/src/gcc-test $ gmake EXTRA_LDFLAGS=/opt/csw/gcc4/lib/libstdc++.so
echo '#include <stdio.h>' > foo.cpp
echo 'main(void) { printf("Hello world!\\n"); }' >> foo.cpp
g++ -R/opt/csw/gcc4/lib -L/opt/csw/gcc4/lib
/opt/csw/gcc4/lib/libstdc++.so foo.cpp -o foo
ld: warning: file /opt/csw/gcc4/lib/libstdc++.so: attempted multiple
inclusion of file
maciej at netra ~/src/gcc-test $
To fix the warning in your case, you need to analyze the build system
of the software you're building, and find out why the explicit
reference to libstdc++.so appears in the linker invocation. If you
manage to remove it, the warning should disappear.
Maciej
More information about the users
mailing list