使用覆盆子pi上的libboost进行编译 - 对`boost :: system :: system_category()的未定义引用

时间:2016-02-15 16:56:41

标签: linux c++11 boost raspberry-pi raspbian

我尝试使用OS Raspbian Jessie在raspberry pi 2上编译Ocelot跟踪器。我从apt安装了libboost1.55-dev-all库。 编译时我得到多个错误:"未定义引用`boost :: system :: system_category()"。

我一直在搜索很多,我发现在大多数情况下这是链接器的问题,像-lboost_system这样的东西应该放在Makefile.am的某个地方,但是我不知道在哪里把它。

此外,我甚至不确定这是否是这种情况。任何指针都会非常感激,这是我第一次做这样的事情。

编译时的完整日志:

pi@raspberrypi:~/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

    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

1 个答案:

答案 0 :(得分:1)

m4 文件夹中的

与Boost相关的文件可能过旧,可以从boost baseboost iostreamsboost system下载新版本。

将新版本的文件复制到文件夹 m4 后,请尝试autoreconf -fvi,然后configuremake

在更新了那些m4文件后,我设法在debian jessie amd64上编译了ocelot。