Ich werde damit beginnen zu sagen, ich fühle mich heute Nacht wie ein Idiot. Ich versuche, ein Arbeitsproblem, das ich unter RHEL5.6, gcc 4.1.2, Boost 1.44.0, mit Boost Serialization habe minimal zu reproduzieren.Nicht aufgelöste Symbole, die mit Boost Serialisierung unter Ubuntu verbinden 12.10
Die Umgebung Ich habe dieses Problem mit ist Ubuntu Server (mit dev-Paketen installiert), gcc 4.7.2, und ein Build von boost 1.44.0 (gegen den System-Compiler, Pakete, etc).
Mein Code kompiliert sauber, aber ich bekomme eine Vielzahl von undefined Symbole im Zusammenhang mit verschiedenen boost::archive
Typen. Laufen strace auf mein Make, sehe ich es die erwartete boost_serialization Bibliothek Abholung:
668 43569 stat("/usr/local/boost/1.44.0/lib/libboost_serialization.so", {st_mode=S_IFREG|0755, st_size=700481, ...}) = 0
669 43569 open("/usr/local/boost/1.44.0/lib/libboost_serialization.so", O_RDONLY) = 8
Mein Make-Datei ist:
default: test-app
all: test-app
BOOST := /usr/local/boost/1.44.0
CPPFLAGS := -fPIC -Wall -Wextra -Werror
INCDIRS := -isystem$(BOOST)/include
.LIBDIRS. := $(BOOST)/lib
.LIBS. :=boost_serialization
LIBS := $(foreach lib,$(.LIBS.),-l$(lib))
LIBDIRS := $(foreach dir,$(.LIBDIRS.),-L$(dir))
CPPFLAGS += $(INCDIRS)
base.o : base.cpp base.hpp
g++ $(CPPFLAGS) --compile $< -o [email protected] -g
derived.o : derived.cpp base.hpp derived.hpp
g++ $(CPPFLAGS) --compile $< -o [email protected] -g
main.o: main.cpp derived.hpp
g++ $(CPPFLAGS) --compile $< -o [email protected] -g
test-app: main.o derived.o base.o
g++ -o [email protected] $(LIBDIRS) $(LIBS) $^
clean:
rm -f *.o test
A (sehr) kleine Auswahl der Linkerfehler erhalte ich sind wie :
base.o: In Funktion
void boost::archive::basic_text_oprimitive<std::ostream>::save<boost::archive::class_id_reference_type>(boost::archive::class_id_reference_type const&)': /usr/local/boost/1.44.0/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to
boost :: Archiv :: archive_exception :: archive_exception ‚(boost :: Archiv :: archive_exception :: exception_code, char const *, char const *) /usr/local/boost/1.44.0/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference toboost::archive::archive_exception::~archive_exception()' /usr/local/boost/1.44.0/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to
boost :: Archiv :: archive_exception :: ~ archive_exception()‘base.o: In Funktionvoid boost::archive::basic_text_oprimitive<std::ostream>::save<boost::archive::tracking_type>(boost::archive::tracking_type const&)': /usr/local/boost/1.44.0/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to
boost :: archiv :: archive_exception :: archive_exception (boost :: archiv :: archive_exception :: ausnahmebedingungscode, char const *, char const *) ' /usr/local/Boost/1.44.0/include/Boost/ Archiv/basic_text_oprimitive.hpp: 91: undefined reference toboost::archive::archive_exception::~archive_exception()' /usr/local/boost/1.44.0/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to
boost :: Archiv :: archive_exception :: ~ archive_exception()‘base.o: In Funktionvoid boost::archive::basic_text_oprimitive<std::ostream>::save<unsigned int>(unsigned int const&)': /usr/local/boost/1.44.0/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to
boost :: Archiv :: archive_exception :: archive_exception (boost :: archiv :: archive_exception :: ausnahmebedingungscode, char const *, char const *) ' /usr/local/boost/1.44.0/include/boost/archive/basic_text_oprimitive.hpp:91: undefined Verweis aufboost::archive::archive_exception::~archive_exception()' /usr/local/boost/1.44.0/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to
boost :: Archiv :: Archiv_Ausnahme :: ~ archive_exception()‘
Ebenso, wenn ich auf den referenzierten .so ist ein Symbol-Dump tun, sehe ich die gewünschten Symbole:
objdump -t /usr/local/boost/1.44.0/ lib/libboost_serialization.so | C++ filt | grep "boost :: Archiv :: archive_exception :: ~ archive_exception()" 000000000004e670 g F .text 0000000000000065
boost :: Archiv :: archive_exception :: ~ archive_exception() 000000000004e6e0 g F .text 0000000000000009 virtuellen Thunk boost :: Archiv :: archive_exception :: ~ archive_exception() 000000000004e6f0 g F .text 0000000000000012
boost :: Archiv :: archive_exception :: ~ archive_exception() 000000000004ed60 g F .text 000000000000005c
boost :: Archiv :: archive_exception :: ~ archive_exception() 000000000004e710 g F.Text 0000000000000009 virtuellen Thunk boost :: Archiv :: archive_exception :: ~ archive_exception()
Ich habe für eine Weile jetzt meinen Kopf gegen den Tisch worden hämmern ... Hoffnung, jemand helfen kann. Ich denke nicht, dass die spezifische Quelle von Bedeutung ist, aber wenn ich sie anfordere, kann ich sie veröffentlichen.
Zusätzliche Umwelt Details:
g ++ --version g ++ (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2 Copyright (C) 2012 Free Software Foundation, Inc. Diese freie Software ist ; Informationen zum Kopieren finden Sie in der Quelle . Es gibt KEINE garantie; nicht einmal für MARKTGÄNGIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
ld --version GNU ld (GNU Binutils for Ubuntu) 2.22.90.20120924 Copyright 2012 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) a later version. This program has absolutely no warranty.
Zusätzlich ist diese auf einer VM läuft unter Hyper-V auf Windows 8, obwohl, ich glaube nicht, dass Angelegenheiten hier.
komplette Verbindungslinie: g ++ -L/usr/local/boost/1.44.0/lib -lboost_serialization -o test-app main.o derived.o base.o
einfach lösen alle Probleme zu isolieren, die aus der Menge der Boost-Bibliotheken von/usr/local sein könnte, könnten Sie versuchen, Ihr Makefile-zu-Punkt die ziehen Bibliotheken und Header aus denen in/usr/lib und/usr/include statt und sehen, ob es kompiliert dort erfolgreich? – Tuxdude
Fügen Sie den tatsächlichen Linkbefehl 'make' wird ausgeführt. –
@ n.m. oben getan. Es ist: g ++ -L/usr/local/boost/1.44.0/lib-lboost_serialization -o test-app main.o abgeleitete.o base.o –