gpt4 book ai didi

linux - 在树莓派上使用 libboost 进行编译 - 未定义对 `boost::system::system_category() 的引用

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:47:31 25 4
gpt4 key购买 nike

我正在尝试使用 OS Raspbian Jessie 在树莓派 2 上编译 Ocelot 跟踪器。我已经从 apt 安装了 libboost1.55-dev-all 库。编译时出现多个错误:“对 `boost::system::system_category() 的 undefined reference ”。

我搜索了很多,发现在大多数情况下这是链接器的问题,像 -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

最佳答案

m4 文件夹中的 Boost 相关文件可能太旧,新版本可以从 boost base 下载, boost iostreams , 和 boost system .

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

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

关于linux - 在树莓派上使用 libboost 进行编译 - 未定义对 `boost::system::system_category() 的引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35414901/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com