This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Confusing error messages when with linking with LTO?
- From: Benjamin Redelings I <benjamin dot redelings at nescent dot org>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 09 Apr 2011 19:04:46 -0400
- Subject: Confusing error messages when with linking with LTO?
Hi,
I just tried compiling with LTO for the first time. I can't figure
out what to try based on the error message below. Is there a HTML page
I should be looking at?
It seems that this did not work:
g++-4.6 -isystem ../../../master/boost/include -ffast-math -DNDEBUG
-DNDEBUG_DP -funroll-loops -fweb -flto -fuse-linker-plugin
-march=native -pipe -O3 -isystem /usr/lib/openmpi/include -isystem
/usr/lib/openmpi/include/openmpi -pthread -pedantic -pthread
-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/pixman-1 -I/usr/include/freetype2
-I/usr/include/libpng12 -Wall -Wextra -Wno-sign-compare
-Woverloaded-virtual -Wstrict-aliasing -o alignment-gild
alignment-gild.o alignment.o alphabet.o sequence.o util.o rng.o tree.o
sequencetree.o optimize.o findroot.o setup.o imodel.o probability.o
sequence-format.o model.o distance-methods.o alignment-random.o
alignment-util.o randomtree.o tree-util.o inverse.o io.o
../boost/lib/filesystem/libboost_filesystem.a
../boost/lib/program_options/libboost_program_options.a -lgsl -lgslcblas
-lm
/usr/bin/ld.gold: error: /tmp/cc4IJUrh.ltrans12.ltrans.o: multiple
definition of '_ZTV18RootedSequenceTree.local.4048'
/usr/bin/ld.gold: /tmp/cc4IJUrh.ltrans7.ltrans.o: previous definition here
/usr/bin/ld.gold: error: /tmp/cc4IJUrh.ltrans12.ltrans.o: multiple
definition of '_ZTT18RootedSequenceTree.local.4049'
/usr/bin/ld.gold: /tmp/cc4IJUrh.ltrans7.ltrans.o: previous definition here
collect2: ld returned 1 exit status
So, it looks like the virtual table for class RootedSequenceTree is
defined in multiple places. But the file name
cc4IJUrh.ltrans12.ltrans.o doesn't clearly correspond to any input file
name. Is there any way for me to find out which *.o files have
definitions for this symbol, and why they are problematic only with LTO?
-BenRI
P.S. Apparently this did work:
g++-4.6 -isystem ../../../master/boost/include -ffast-math -DNDEBUG
-DNDEBUG_DP -funroll-loops -fweb -flto -fuse-linker-plugin
-march=native -pipe -O3 -isystem /usr/lib/openmpi/include -isystem
/usr/lib/openmpi/include/openmpi -pthread -pedantic -pthread
-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/pixman-1 -I/usr/include/freetype2
-I/usr/include/libpng12 -Wall -Wextra -Wno-sign-compare
-Woverloaded-virtual -Wstrict-aliasing -o bali-phy sequence.o tree.o
alignment.o substitution.o moves.o rng.o exponential.o eigenvalue.o
parameters.o likelihood.o mcmc.o choose.o sequencetree.o
sample-branch-lengths.o util.o randomtree.o alphabet.o smodel.o
bali-phy.o hmm.o dp-engine.o dp-array.o dp-matrix.o 3way.o 2way.o
sample-alignment.o sample-tri.o sample-node.o imodel.o 5way.o
sample-topology-NNI.o setup.o rates.o matcache.o sample-two-nodes.o
sequence-format.o util-random.o alignment-random.o setup-smodel.o
sample-topology-SPR.o alignment-sums.o alignment-util.o probability.o
model.o alignment-constraint.o substitution-cache.o substitution-star.o
monitor.o substitution-index.o tree-util.o myexception.o pow2.o
partition.o proposals.o n_indels.o distribution.o parsimony.o version.o
slice-sampling.o timer_stack.o setup-mcmc.o io.o logger.o AIS.o
../boost/lib/mpi/libboost_mpi.a
../boost/lib/serialization/libboost_serialization.a -pthread
-L/usr/lib/openmpi/lib -lmpi_cxx -lmpi -lopen-rte -lopen-pal -ldl
-Wl,--export-dynamic -lnsl -lutil -lm -ldl
../boost/lib/filesystem/libboost_filesystem.a
../boost/lib/program_options/libboost_program_options.a -lgsl -lgslcblas -lm
If I don't use LTO (that is, if I remove "-flto -fuse-linker-plugin")
then everything works.