2016-02-15 218 views
1

未定義的引用我試圖在操作系統Raspbian Jessie上編譯樹莓派2上的Ocelot跟蹤器。我已經安裝了apt的libboost1.55-dev-all庫。 編譯時,我得到了多個錯誤:「未定義的引用boost :: system :: system_category()」。在樹莓pi上編譯libboost - 對`boost :: system :: system_category()

我一直在尋找很多,我發現在大多數情況下,這是一個鏈接器的問題,類似的東西-lboost_system應該放在Makefile.am的某個地方,但我不知道該把它放在哪裏。

此外,我甚至不確定這是這種情況。任何指針都會非常感謝,這是我第一次做這樣的事情。

編譯時,完整的日誌:

[email protected]:~/ocelot-1.0 $ make 
g++ -DPACKAGE_NAME=\"ocelot\" -DPACKAGE_TARNAME=\"ocelot\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"ocelot\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DHAVE_BOOST=/\*\*/ -DHAVE_BOOST_IOSTREAMS=/\*\*/ -DHAVE_BOOST_SYSTEM=/\*\*/ -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBTCMALLOC=1 -I. -I/usr/include -I/usr/include/mysql -I/usr/include/mysql++ -std=c++11 -march=native -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fomit-frame-pointer -fno-ident -Wall -Wfatal-errors -pthread -I/usr/include -fstack-protector-strong -g -O2 -MT config.o -MD -MP -MF .deps/config.Tpo -c -o config.o config.cpp 
mv -f .deps/config.Tpo .deps/config.Po 
g++ -DPACKAGE_NAME=\"ocelot\" -DPACKAGE_TARNAME=\"ocelot\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"ocelot\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DHAVE_BOOST=/\*\*/ -DHAVE_BOOST_IOSTREAMS=/\*\*/ -DHAVE_BOOST_SYSTEM=/\*\*/ -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBTCMALLOC=1 -I. -I/usr/include -I/usr/include/mysql -I/usr/include/mysql++ -std=c++11 -march=native -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fomit-frame-pointer -fno-ident -Wall -Wfatal-errors -pthread -I/usr/include -fstack-protector-strong -g -O2 -MT db.o -MD -MP -MF .deps/db.Tpo -c -o db.o db.cpp 
mv -f .deps/db.Tpo .deps/db.Po 
g++ -DPACKAGE_NAME=\"ocelot\" -DPACKAGE_TARNAME=\"ocelot\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"ocelot\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DHAVE_BOOST=/\*\*/ -DHAVE_BOOST_IOSTREAMS=/\*\*/ -DHAVE_BOOST_SYSTEM=/\*\*/ -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBTCMALLOC=1 -I. -I/usr/include -I/usr/include/mysql -I/usr/include/mysql++ -std=c++11 -march=native -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fomit-frame-pointer -fno-ident -Wall -Wfatal-errors -pthread -I/usr/include -fstack-protector-strong -g -O2 -MT events.o -MD -MP -MF .deps/events.Tpo -c -o events.o events.cpp 
mv -f .deps/events.Tpo .deps/events.Po 
g++ -DPACKAGE_NAME=\"ocelot\" -DPACKAGE_TARNAME=\"ocelot\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"ocelot\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DHAVE_BOOST=/\*\*/ -DHAVE_BOOST_IOSTREAMS=/\*\*/ -DHAVE_BOOST_SYSTEM=/\*\*/ -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBTCMALLOC=1 -I. -I/usr/include -I/usr/include/mysql -I/usr/include/mysql++ -std=c++11 -march=native -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fomit-frame-pointer -fno-ident -Wall -Wfatal-errors -pthread -I/usr/include -fstack-protector-strong -g -O2 -MT misc_functions.o -MD -MP -MF .deps/misc_functions.Tpo -c -o misc_functions.o misc_functions.cpp 
mv -f .deps/misc_functions.Tpo .deps/misc_functions.Po 
g++ -DPACKAGE_NAME=\"ocelot\" -DPACKAGE_TARNAME=\"ocelot\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"ocelot\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DHAVE_BOOST=/\*\*/ -DHAVE_BOOST_IOSTREAMS=/\*\*/ -DHAVE_BOOST_SYSTEM=/\*\*/ -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBTCMALLOC=1 -I. -I/usr/include -I/usr/include/mysql -I/usr/include/mysql++ -std=c++11 -march=native -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fomit-frame-pointer -fno-ident -Wall -Wfatal-errors -pthread -I/usr/include -fstack-protector-strong -g -O2 -MT ocelot.o -MD -MP -MF .deps/ocelot.Tpo -c -o ocelot.o ocelot.cpp 
mv -f .deps/ocelot.Tpo .deps/ocelot.Po 
g++ -DPACKAGE_NAME=\"ocelot\" -DPACKAGE_TARNAME=\"ocelot\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"ocelot\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DHAVE_BOOST=/\*\*/ -DHAVE_BOOST_IOSTREAMS=/\*\*/ -DHAVE_BOOST_SYSTEM=/\*\*/ -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBTCMALLOC=1 -I. -I/usr/include -I/usr/include/mysql -I/usr/include/mysql++ -std=c++11 -march=native -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fomit-frame-pointer -fno-ident -Wall -Wfatal-errors -pthread -I/usr/include -fstack-protector-strong -g -O2 -MT report.o -MD -MP -MF .deps/report.Tpo -c -o report.o report.cpp 
mv -f .deps/report.Tpo .deps/report.Po 
g++ -DPACKAGE_NAME=\"ocelot\" -DPACKAGE_TARNAME=\"ocelot\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"ocelot\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DHAVE_BOOST=/\*\*/ -DHAVE_BOOST_IOSTREAMS=/\*\*/ -DHAVE_BOOST_SYSTEM=/\*\*/ -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBTCMALLOC=1 -I. -I/usr/include -I/usr/include/mysql -I/usr/include/mysql++ -std=c++11 -march=native -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fomit-frame-pointer -fno-ident -Wall -Wfatal-errors -pthread -I/usr/include -fstack-protector-strong -g -O2 -MT response.o -MD -MP -MF .deps/response.Tpo -c -o response.o response.cpp 
mv -f .deps/response.Tpo .deps/response.Po 
g++ -DPACKAGE_NAME=\"ocelot\" -DPACKAGE_TARNAME=\"ocelot\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"ocelot\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DHAVE_BOOST=/\*\*/ -DHAVE_BOOST_IOSTREAMS=/\*\*/ -DHAVE_BOOST_SYSTEM=/\*\*/ -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBTCMALLOC=1 -I. -I/usr/include -I/usr/include/mysql -I/usr/include/mysql++ -std=c++11 -march=native -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fomit-frame-pointer -fno-ident -Wall -Wfatal-errors -pthread -I/usr/include -fstack-protector-strong -g -O2 -MT schedule.o -MD -MP -MF .deps/schedule.Tpo -c -o schedule.o schedule.cpp 
mv -f .deps/schedule.Tpo .deps/schedule.Po 
g++ -DPACKAGE_NAME=\"ocelot\" -DPACKAGE_TARNAME=\"ocelot\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"ocelot\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DHAVE_BOOST=/\*\*/ -DHAVE_BOOST_IOSTREAMS=/\*\*/ -DHAVE_BOOST_SYSTEM=/\*\*/ -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBTCMALLOC=1 -I. -I/usr/include -I/usr/include/mysql -I/usr/include/mysql++ -std=c++11 -march=native -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fomit-frame-pointer -fno-ident -Wall -Wfatal-errors -pthread -I/usr/include -fstack-protector-strong -g -O2 -MT site_comm.o -MD -MP -MF .deps/site_comm.Tpo -c -o site_comm.o site_comm.cpp 
mv -f .deps/site_comm.Tpo .deps/site_comm.Po 
g++ -DPACKAGE_NAME=\"ocelot\" -DPACKAGE_TARNAME=\"ocelot\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"ocelot\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DHAVE_BOOST=/\*\*/ -DHAVE_BOOST_IOSTREAMS=/\*\*/ -DHAVE_BOOST_SYSTEM=/\*\*/ -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBTCMALLOC=1 -I. -I/usr/include -I/usr/include/mysql -I/usr/include/mysql++ -std=c++11 -march=native -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fomit-frame-pointer -fno-ident -Wall -Wfatal-errors -pthread -I/usr/include -fstack-protector-strong -g -O2 -MT user.o -MD -MP -MF .deps/user.Tpo -c -o user.o user.cpp 
mv -f .deps/user.Tpo .deps/user.Po 
g++ -DPACKAGE_NAME=\"ocelot\" -DPACKAGE_TARNAME=\"ocelot\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"ocelot\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DHAVE_BOOST=/\*\*/ -DHAVE_BOOST_IOSTREAMS=/\*\*/ -DHAVE_BOOST_SYSTEM=/\*\*/ -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBTCMALLOC=1 -I. -I/usr/include -I/usr/include/mysql -I/usr/include/mysql++ -std=c++11 -march=native -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fomit-frame-pointer -fno-ident -Wall -Wfatal-errors -pthread -I/usr/include -fstack-protector-strong -g -O2 -MT worker.o -MD -MP -MF .deps/worker.Tpo -c -o worker.o worker.cpp 
worker.cpp: In member function ‘void worker::reap_peers()’: 
worker.cpp:1028:49: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] 
    if (p->second.last_announced + peers_timeout < cur_time) { 
               ^
worker.cpp:1041:49: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] 
    if (p->second.last_announced + peers_timeout < cur_time) { 
               ^
mv -f .deps/worker.Tpo .deps/worker.Po 
g++ -std=c++11 -march=native -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fomit-frame-pointer -fno-ident -Wall -Wfatal-errors -pthread -I/usr/include -fstack-protector-strong -g -O2 -Wl,-O1 -Wl,--as-needed -L/usr/lib/arm-linux-gnueabihf/ -L/usr/lib/arm-linux-gnueabihf/ -o ocelot config.o db.o events.o misc_functions.o ocelot.o report.o response.o schedule.o site_comm.o user.o worker.o -lboost_iostreams -ltcmalloc -lmysqlpp -lmysqlclient -lev 
site_comm.o: In function `error_code': 
/usr/include/boost/system/error_code.hpp:323: undefined reference to `boost::system::system_category()' 
/usr/include/boost/system/error_code.hpp:323: undefined reference to `boost::system::system_category()' 
/usr/include/boost/system/error_code.hpp:323: undefined reference to `boost::system::system_category()' 
/usr/include/boost/system/error_code.hpp:323: undefined reference to `boost::system::system_category()' 
site_comm.o: In function `get_system_category': 
/usr/include/boost/asio/error.hpp:224: undefined reference to `boost::system::system_category()' 
site_comm.o:/usr/include/boost/system/error_code.hpp:323: more undefined references to `boost::system::system_category()' follow 
site_comm.o: In function `__static_initialization_and_destruction_0': 
/usr/include/boost/system/error_code.hpp:222: undefined reference to `boost::system::generic_category()' 
/usr/include/boost/system/error_code.hpp:223: undefined reference to `boost::system::generic_category()' 
/usr/include/boost/system/error_code.hpp:224: undefined reference to `boost::system::system_category()' 
site_comm.o: In function `get_system_category': 
/usr/include/boost/asio/error.hpp:224: undefined reference to `boost::system::system_category()' 
events.o: In function `get_system_category': 
/usr/include/boost/asio/error.hpp:224: undefined reference to `boost::system::system_category()' 
events.o: In function `__static_initialization_and_destruction_0': 
/usr/include/boost/system/error_code.hpp:222: undefined reference to `boost::system::generic_category()' 
/usr/include/boost/system/error_code.hpp:223: undefined reference to `boost::system::generic_category()' 
/usr/include/boost/system/error_code.hpp:224: undefined reference to `boost::system::system_category()' 
events.o: In function `get_system_category': 
/usr/include/boost/asio/error.hpp:224: undefined reference to `boost::system::system_category()' 
ocelot.o: In function `__static_initialization_and_destruction_0': 
/usr/include/boost/system/error_code.hpp:222: undefined reference to `boost::system::generic_category()' 
/usr/include/boost/system/error_code.hpp:223: undefined reference to `boost::system::generic_category()' 
/usr/include/boost/system/error_code.hpp:224: undefined reference to `boost::system::system_category()' 
ocelot.o: In function `get_system_category': 
/usr/include/boost/asio/error.hpp:224: undefined reference to `boost::system::system_category()' 
schedule.o: In function `__static_initialization_and_destruction_0': 
/usr/include/boost/system/error_code.hpp:222: undefined reference to `boost::system::generic_category()' 
/usr/include/boost/system/error_code.hpp:223: undefined reference to `boost::system::generic_category()' 
/usr/include/boost/system/error_code.hpp:224: undefined reference to `boost::system::system_category()' 
schedule.o: In function `get_system_category': 
/usr/include/boost/asio/error.hpp:224: undefined reference to `boost::system::system_category()' 
worker.o: In function `__static_initialization_and_destruction_0': 
/usr/include/boost/system/error_code.hpp:222: undefined reference to `boost::system::generic_category()' 
/usr/include/boost/system/error_code.hpp:223: undefined reference to `boost::system::generic_category()' 
/usr/include/boost/system/error_code.hpp:224: undefined reference to `boost::system::system_category()' 
worker.o: In function `get_system_category': 
/usr/include/boost/asio/error.hpp:224: undefined reference to `boost::system::system_category()' 
collect2: error: ld returned 1 exit status 
Makefile:412: recipe for target 'ocelot' failed 
make: *** [ocelot] Error 1 

原始Makefile.am

M4文件夾
ACLOCAL_AMFLAGS = -I m4 

bin_PROGRAMS = ocelot ocelot_SOURCES = config.cpp config.h db.cpp db.h events.cpp events.h misc_functions.cpp misc_functions.h \ 
     ocelot.cpp ocelot.h report.cpp report.h response.cpp response.h \ 
     schedule.cpp schedule.h site_comm.cpp site_comm.h user.cpp user.h worker.cpp worker.h 

AM_CXXFLAGS = -std=c++11 -march=native -O2 -fvisibility=hidden 
-fvisibility-inlines-hidden -fomit-frame-pointer -fno-ident -Wall -Wfatal-errors $(PTHREAD_CFLAGS) $($ ocelot_LDADD = $(PTHREAD_LIBS) $(BOOST_IOSTREAMS_LIB) $(BOOST_SYSTEM_LIB) AM_LDFLAGS = -Wl,-O1 
-Wl,--as-needed EXTRA_DIST = CHANGES LICENSE README.md ocelot.conf.dist dist-hook: 
     touch ${distdir}/configure 
     patch -p2 -d ${distdir} --no-backup-if-mismatch < ../dist.patch 
+0

你使用的是什麼版本的gcc?我最近遇到了gcc 5和boost相關的autoconf宏的一些問題。 –

回答

1

加速相關的文件可能太舊,新版本可以從boost base下載, boost iostreamsboost system

複製文件的新版本的文件夾後,M4,嘗試autoreconf -fvi然後configuremake

我設法在debian jessie amd64上編譯ocelot,然後更新這些m4文件。