我尝试构build由boost asio提供的示例代码示例: http : //www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/example/cpp11/spawn/echo_server.cpp@H_404_1@
我复制所有的代码,并把它放到一个cpp文件,用gcc4.7和cmake在linux上编译,与boost协程和boost上下文库链接,但链接失败。@H_404_1@
Linking CXX executable ../../../output/bin/unit_test cd /home/watson/ID_project/build/server_linux_makefile_gcc/abc/test/unit/abc_async && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/unit_test.dir/link.txt --verbose=1 /usr/bin/c++ -std=c++11 -O3 -DNDEBUG -pthread -lrt -ltcmalloc -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free CMakeFiles/unit_test.dir/TestFileChannel.cpp.o CMakeFiles/unit_test.dir/TestStreamBuffer.cpp.o CMakeFiles/unit_test.dir/TestTimer.cpp.o CMakeFiles/unit_test.dir/TestThreadPool.cpp.o CMakeFiles/unit_test.dir/TestScheduler.cpp.o CMakeFiles/unit_test.dir/PCH.cpp.o CMakeFiles/unit_test.dir/main.cpp.o CMakeFiles/unit_test.dir/TestUdpnetwork.cpp.o CMakeFiles/unit_test.dir/TestTCPNetwork.cpp.o -o ../../../output/bin/unit_test -rdynamic ../../../../../../install/thirdparty_linux_makefile_gcc/lib/libboost_unit_test_framework-gcc47-mt-1_54.a ../../../../../../install/thirdparty_linux_makefile_gcc/lib/libboost_context-gcc47-mt-1_54.a ../../../../../../install/thirdparty_linux_makefile_gcc/lib/libboost_coroutine-gcc47-mt-1_54.a ../../../../../../install/thirdparty_linux_makefile_gcc/lib/libboost_thread-gcc47-mt-1_54.a ../../../../../../install/thirdparty_linux_makefile_gcc/lib/libboost_filesystem-gcc47-mt-1_54.a ../../../../../../install/thirdparty_linux_makefile_gcc/lib/libyaml-cpp.a ../../../../../../install/thirdparty_linux_makefile_gcc/lib/libmongoc.a ../../../../../../install/thirdparty_linux_makefile_gcc/lib/libboost_system-gcc47-mt-1_54.a ../../../../../../install/thirdparty_linux_makefile_gcc/lib/libprotobuf.a ../../../../../../install/thirdparty_linux_makefile_gcc/lib/libboost_coroutine-gcc47-mt-1_54.a(coroutine_context.o): In function `boost::coroutines::detail::coroutine_context::coroutine_context(void (*)(long),boost::coroutines::stack_context*)': coroutine_context.cpp:(.text+0x103): undefined reference to `make_fcontext' ../../../../../../install/thirdparty_linux_makefile_gcc/lib/libboost_coroutine-gcc47-mt-1_54.a(coroutine_context.o): In function `boost::coroutines::detail::coroutine_context::jump(boost::coroutines::detail::coroutine_context&,long,bool)': coroutine_context.cpp:(.text+0x1bc): undefined reference to `jump_fcontext' collect2: error: ld returned 1 exit status make[2]: *** [abc/output/bin/unit_test] Error 1@H_404_1@
我打印.a文件中的符号表,并find符号jump_fcontext' and make_fcontext'已存在:@H_404_1@
交叉编译到x86时libboost-system链接器错误@H_404_1@
如何使用CMake构build的可执行文件访问Boost DLL?@H_404_1@
不能用64位gcc在32位build立boost库@H_404_1@
如何使用boost :: asio来抽象文件描述符?@H_404_1@
扩展boost.asio文件I / O为Linux@H_404_1@
nm libboost_context-gcc47-mt-1_54.a make_x86_64_sysv_elf_gas.o: U _GLOBAL_OFFSET_TABLE_ U _exit 000000000000002e t finish 0000000000000000 T make_fcontext jump_x86_64_sysv_elf_gas.o: 0000000000000000 T jump_fcontext@H_404_1@
有人可以给我任何提示吗? 我尝试谷歌每一个地方,但没有信息。@H_404_1@
使用boost :: serialization大大增加了二进制大小@H_404_1@
ipv4和ipv6从任何有效的地址@H_404_1@
为什么boost asio函数expires_from_Now()取消deadline_timer?@H_404_1@
链接到Boost正则expression式库时程序启动时崩溃@H_404_1@
尝试交换boost_context和boost_coroutine的链接顺序。@H_404_1@
链接器按照指定的顺序搜索和处理库和对象文件。 因此,'foo.o -lz bar.o'在文件foo.o之后但在bar.o之前搜索库“z”。 如果bar.o引用“z”中的函数,则可能不会加载这些函数。@H_404_1@
在这种情况下, Boost.Coroutine依赖于Boost.Context 。 因此,在boost_context时, boost_coroutine应该出现在boost_context之前。 有关更多链接器订购详细信息,请考虑阅读此答案。@H_404_1@
只是为了增加另一种可能性(特别是Boost上下文库) – 如果在Windows上使用MinGW进行构建,使用早期版本的MASM可以生成静态库,因为符号被导出的方式不包含可链接的符号。@H_404_1@
解决方案是用MASM 8重建Boost上下文。@H_404_1@
有关更多信息,请参阅https://stackoverflow.com/a/26874113/1678468上的答案。@H_404_1@
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。