Closed dylu6699 closed 3 years ago
target_link_libraries (youprocess libgonet) target_link_libraries (youprocess libgo_static) target_link_libraries (youprocess static_hook) target_link_libraries (youprocess glog) target_link_libraries (youprocess boost_chrono) target_link_libraries (youprocess boost_context) target_link_libraries (youprocess boost_coroutine) target_link_libraries (youprocess boost_regex) target_link_libraries (youprocess boost_system) target_link_libraries (youprocess boost_thread)
g++ -I/usr/local/include/libgo --std=c++17 -L/lib/ -lpthread -ldl \
../tutorial/sample1_go.cpp ./liblibgo.a ./libstatic_hook.a
I have test run succeed on my linux server. but I failed to config on my macOS book
[ 94%] Building CXX object socks-serv/CMakeFiles/socks-serv.dir/server/server.cpp.o [ 97%] Building CXX object socks-serv/CMakeFiles/socks-serv.dir/str/str.cpp.o [100%] Linking CXX executable ../../bin/socks-serv CMakeFiles/socks-serv.dir/server/server.cpp.o: In function, std::allocator > >, std::allocator<boost::sub_match<gnu_cxx::__normal_iterator<char const*, std::cxx11::basic_string<char, std::char_traits, std::allocator > > > >, boost::regex_traits<char, boost::cpp_regex_traits > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits > > const&, boost::regex_constants::_match_flags)'
/root/work/socks-libgo/build/liblibgonet.a(abstract.cpp.o): In function > >::do_assign(char const, char const, unsigned int)'
/root/work/socks-libgo/build/liblibgonet.a(abstract.cpp.o): In function ::transform_primary[abi:cxx11](char const , char const) const':
/usr/local/include/boost/regex/v4/cpp_regex_traits.hpp:966: undefined reference to `boost::re_detail_107500::cpp_regex_traits_implementation::transform_primary[abi:cxx11](char const , char const) const'
/root/work/socks-libgo/build/liblibgonet.a(abstract.cpp.o): In function `boost::cpp_regex_traits::transform[abi:cxx11](char const , char const) const':
/usr/local/include/boost/regex/v4/cpp_regex_traits.hpp:962: undefined reference to `boost::re_detail_107500::cpp_regex_traits_implementation::transform[abi:cxx11](char const , char const) const'
/root/work/socks-libgo/build/liblibgonet.a(abstract.cpp.o): In function , std::allocator > >, std::allocator<boost::sub_match<__gnu_cxx:: normal_iterator<char const, std::cxx11::basic_string<char, std::char_traits, std::allocator > > > >, boost::regex_traits<char, boost::cpp_regex_traits > >::extend_stack()':
/usr/local/include/boost/regex/v4/perl_matcher_non_recursive.hpp:236: undefined reference to normal_iterator<char const, std::cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<boost::sub_match<__gnu_cxx:: normal_iterator<char const, std::cxx11::basic_string<char, std::char_traits, std::allocator > > > >, boost::regex_traits<char, boost::cpp_regex_traits > >::match_match()':
/usr/local/include/boost/regex/v4/perl_matcher_non_recursive.hpp:1108: undefined reference to `boost::match_results< gnu_cxx::__normal_iterator<char const, std::cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<boost::sub_match<__gnu_cxx:: normal_iterator<char const, std::cxx11::basic_string<char, std::char_traits, std::allocator > > > > >::maybe_assign(boost::match_results< gnu_cxx::__normal_iterator<char const, std::cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<boost::sub_match<__gnu_cxx:: normal_iterator<char const, std::cxx11::basic_string<char, std::char_traits, std::allocator > > > > > const&)'
/root/work/socks-libgo/build/liblibgonet.a(abstract.cpp.o): In function `boost::re_detail_107500::perl_matcher<__gnu_cxx:: normal_iterator<char const, std::cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<boost::sub_match<__gnu_cxx:: normal_iterator<char const, std::cxx11::basic_string<char, std::char_traits, std::allocator > > > >, boost::regex_traits<char, boost::cpp_regex_traits > >::extend_stack()':
/usr/local/include/boost/regex/v4/perl_matcher_non_recursive.hpp:236: undefined reference to gnu_cxx::__normal_iterator<char const, std::cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<boost::sub_match<__gnu_cxx:: normal_iterator<char const, std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > >, boost::regex_traits<char, boost::cpp_regex_traits > >::match_imp()':
/usr/local/include/boost/regex/v4/perl_matcher_common.hpp:231: undefined reference to )'
/root/work/socks-libgo/build/liblibgonet.a(abstract.cpp.o): In function , std::allocator > >, std::allocator<boost::sub_match<gnu_cxx::__normal_iterator<char const*, std::cxx11::basic_string<char, std::char_traits, std::allocator > > > > >::maybe_assign(boost::match_results<gnu_cxx::__normal_iterator<char const*, std::cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<boost::sub_match<gnu_cxx::__normal_iterator<char const*, std::cxx11::basic_string<char, std::char_traits, std::allocator > > > > > const&)'
/root/work/socks-libgo/build/liblibgonet.a(abstract.cpp.o): In function
leichecksum(unsigned char const*)': server.cpp:(.text+0x1d): multiple definition of
leichecksum(unsigned char const)' CMakeFiles/socks-serv.dir/server/peer.cpp.o:peer.cpp:(.text+0x1d): first defined here /root/work/socks-libgo/build/liblibgo.a(hook.cpp.o): In functiondoInitHook': /root/work/socks-libgo/third_party/libgo/libgo/netio/unix/hook.cpp:1121: undefined reference to
dlsym' /root/work/socks-libgo/third_party/libgo/libgo/netio/unix/hook.cpp:1123: undefined reference todlsym' /root/work/socks-libgo/third_party/libgo/libgo/netio/unix/hook.cpp:1124: undefined reference to
dlsym' /root/work/socks-libgo/third_party/libgo/libgo/netio/unix/hook.cpp:1125: undefined reference todlsym' /root/work/socks-libgo/third_party/libgo/libgo/netio/unix/hook.cpp:1126: undefined reference to
dlsym' /root/work/socks-libgo/build/liblibgo.a(hook.cpp.o):/root/work/socks-libgo/third_party/libgo/libgo/netio/unix/hook.cpp:1127: more undefined references todlsym' follow /root/work/socks-libgo/build/liblibgo.a(hook.cpp.o): In function
co::Context::SwapOut()': /root/work/socks-libgo/third_party/libgo/libgo/netio/unix/../../scheduler/../task/../context/context.h:49: undefined reference tojump_fcontext' /root/work/socks-libgo/third_party/libgo/libgo/netio/unix/../../scheduler/../task/../context/context.h:49: undefined reference to
jump_fcontext' /root/work/socks-libgo/third_party/libgo/libgo/netio/unix/../../scheduler/../task/../context/context.h:49: undefined reference tojump_fcontext' /root/work/socks-libgo/third_party/libgo/libgo/netio/unix/../../scheduler/../task/../context/context.h:49: undefined reference to
jump_fcontext' /root/work/socks-libgo/third_party/libgo/libgo/netio/unix/../../scheduler/../task/../context/context.h:49: undefined reference tojump_fcontext' /root/work/socks-libgo/build/liblibgo.a(hook.cpp.o):/root/work/socks-libgo/third_party/libgo/libgo/netio/unix/../../scheduler/../task/../context/context.h:49: more undefined references to
jump_fcontext' follow /root/work/socks-libgo/build/liblibgo.a(task.cpp.o): In function `co::Context::Context(void ()(long), long, unsigned long)': /root/work/socks-libgo/third_party/libgo/libgo/task/../context/context.h:20: undefined reference tomake_fcontext' /root/work/socks-libgo/build/liblibgo.a(task.cpp.o): In function
co::Context::SwapOut()': /root/work/socks-libgo/third_party/libgo/libgo/task/../context/context.h:49: undefined reference tojump_fcontext' /root/work/socks-libgo/build/liblibgo.a(processer.cpp.o): In function
co::Context::SwapIn()': /root/work/socks-libgo/third_party/libgo/libgo/scheduler/../task/../context/context.h:39: undefined reference tojump_fcontext' /root/work/socks-libgo/build/liblibgo.a(co_mutex.cpp.o): In function
co::Context::SwapOut()': /root/work/socks-libgo/third_party/libgo/libgo/sync/../scheduler/../task/../context/context.h:49: undefined reference tojump_fcontext' /root/work/socks-libgo/third_party/libgo/libgo/sync/../scheduler/../task/../context/context.h:49: undefined reference to
jump_fcontext' /root/work/socks-libgo/build/liblibgonet.a(abstract.cpp.o): In functionboost::re_detail_107500::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::perl_matcher(__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags, __gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >)': /usr/local/include/boost/regex/v4/perl_matcher.hpp:396: undefined reference to
boost::re_detail_107500::perl_matcher<gnu_cxx::__normal_iterator<char const*, std::cxx11::basic_string<char, std::char_traitsboost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::assign(char const*, char const*, unsigned int)': /usr/local/include/boost/regex/v4/basic_regex.hpp:398: undefined reference to
boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traitsboost::re_detail_107500::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::unwind_extra_block(bool)': /usr/local/include/boost/regex/v4/perl_matcher_non_recursive.hpp:1371: undefined reference to
boost::re_detail_107500::put_mem_block(void)' /root/work/socks-libgo/build/liblibgonet.a(abstract.cpp.o): In function `boost::cpp_regex_traitsboost::re_detail_107500::cpp_regex_traits_implementation<char>::error_string[abi:cxx11](boost::regex_constants::error_type) const': /usr/local/include/boost/regex/v4/cpp_regex_traits.hpp:449: undefined reference to
boost::re_detail_107500::get_default_error_string(boost::regex_constants::error_type)' /root/work/socks-libgo/build/liblibgonet.a(abstract.cpp.o): In functionvoid boost::re_detail_107500::raise_error<boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > > >(boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::error_type)': /usr/local/include/boost/regex/pattern_except.hpp:78: undefined reference to
boost::re_detail_107500::raise_runtime_error(std::runtime_error const&)' /root/work/socks-libgo/build/liblibgonet.a(abstract.cpp.o): In function `boost::re_detail_107500::perl_matcher<__gnu_cxx::__normal_iterator<char const, std::cxx11::basic_string<char, std::char_traitsboost::re_detail_107500::get_mem_block()' /usr/local/include/boost/regex/v4/perl_matcher_non_recursive.hpp:236: undefined reference to
boost::re_detail_107500::get_mem_block()' /usr/local/include/boost/regex/v4/perl_matcher_non_recursive.hpp:236: undefined reference toboost::re_detail_107500::get_mem_block()' /usr/local/include/boost/regex/v4/perl_matcher_non_recursive.hpp:236: undefined reference to
boost::re_detail_107500::get_mem_block()' /usr/local/include/boost/regex/v4/perl_matcher_non_recursive.hpp:236: undefined reference toboost::re_detail_107500::get_mem_block()' /root/work/socks-libgo/build/liblibgonet.a(abstract.cpp.o):/usr/local/include/boost/regex/v4/perl_matcher_non_recursive.hpp:236: more undefined references to
boost::re_detail_107500::get_mem_block()' follow /root/work/socks-libgo/build/liblibgonet.a(abstract.cpp.o): In function `boost::re_detail_107500::perl_matcher<__gnu_cxx::boost::re_detail_107500::get_mem_block()' /usr/local/include/boost/regex/v4/perl_matcher_non_recursive.hpp:236: undefined reference to
boost::re_detail_107500::get_mem_block()' /usr/local/include/boost/regex/v4/perl_matcher_non_recursive.hpp:236: undefined reference toboost::re_detail_107500::get_mem_block()' /usr/local/include/boost/regex/v4/perl_matcher_non_recursive.hpp:236: undefined reference to
boost::re_detail_107500::get_mem_block()' /root/work/socks-libgo/build/liblibgonet.a(abstract.cpp.o): In functionboost::re_detail_107500::save_state_init::save_state_init(boost::re_detail_107500::saved_state**, boost::re_detail_107500::saved_state**)': /usr/local/include/boost/regex/v4/perl_matcher_non_recursive.hpp:110: undefined reference to
boost::re_detail_107500::get_mem_block()' /root/work/socks-libgo/build/liblibgonet.a(abstract.cpp.o): In function `boost::re_detail_107500::perl_matcher<boost::re_detail_107500::verify_options(unsigned int, boost::regex_constants::_match_flags)' /root/work/socks-libgo/build/liblibgonet.a(abstract.cpp.o): In function
boost::re_detail_107500::save_state_init::~save_state_init()': /usr/local/include/boost/regex/v4/perl_matcher_non_recursive.hpp:118: undefined reference to `boost::re_detail_107500::put_mem_block(voidboost::re_detail_107500::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match_prefix()': /usr/local/include/boost/regex/v4/perl_matcher_common.hpp:356: undefined reference to
boost::match_results<gnu_cxx::__normal_iterator<char const*, std::cxx11::basic_string<char, std::char_traitsboost::re_detail_107500::save_state_init::~save_state_init()': /usr/local/include/boost/regex/v4/perl_matcher_non_recursive.hpp:118: undefined reference to
boost::re_detail_107500::put_mem_block(void)' /root/work/socks-libgo/build/liblibgonet.a(tcp_detail.cpp.o): In function `co::CoTimer::CoTimer<long, std::ratio<1l, 1000l> >(std::chrono::duration<long, std::ratio<1l, 1000l> >, co::Scheduler)': /root/work/socks-libgo/third_party/libgonet/../libgo/libgo/timer/timer.h:53: undefined reference toco::CoTimer::CoTimerImpl::CoTimerImpl(std::chrono::duration<long, std::ratio<1l, 1000000000l> >)' /root/work/socks-libgo/third_party/libgonet/../libgo/libgo/timer/timer.h:55: undefined reference to
co::CoTimer::Initialize(co::Scheduler)' /root/work/socks-libgo/build/liblibgonet.a(tcp_detail.cpp.o): In functionnetwork::tcp_detail::GetTimer()': /root/work/socks-libgo/third_party/libgonet/libgonet/tcp_detail.cpp:22: undefined reference to
co::CoTimer::~CoTimer()' /root/work/socks-libgo/build/liblibgonet.a(tcp_detail.cpp.o): In functionco::Timer<std::function<void ()> >::TimerId co::CoTimer::ExpireAt<long, std::ratio<1l, 1000l> >(std::chrono::duration<long, std::ratio<1l, 1000l> >, std::function<void ()> const&)': /root/work/socks-libgo/third_party/libgonet/../libgo/libgo/timer/timer.h:70: undefined reference to
co::CoTimer::ExpireAt(std::chrono::duration<long, std::ratio<1l, 1000000000l> >, std::function<void ()> const&)' /root/work/socks-libgo/third_party/libgonet/../libgo/libgo/timer/timer.h:70: undefined reference toco::CoTimer::ExpireAt(std::chrono::duration<long, std::ratio<1l, 1000000000l> >, std::function<void ()> const&)' /root/work/socks-libgo/third_party/libgonet/../libgo/libgo/timer/timer.h:70: undefined reference to
co::CoTimer::ExpireAt(std::chrono::duration<long, std::ratio<1l, 1000000000l> >, std::function<void ()> const&)' /root/work/socks-libgo/build/liblibgonet.a(tcp_detail.cpp.o): In functionco::Context::SwapOut()': /root/work/socks-libgo/third_party/libgonet/../libgo/libgo/common/../scheduler/../task/../context/context.h:49: undefined reference to
jump_fcontext' /root/work/socks-libgo/third_party/libgonet/../libgo/libgo/common/../scheduler/../task/../context/context.h:49: undefined reference tojump_fcontext' /root/work/socks-libgo/third_party/libgonet/../libgo/libgo/common/../scheduler/../task/../context/context.h:49: undefined reference to
jump_fcontext' /root/work/socks-libgo/third_party/libgonet/../libgo/libgo/common/../scheduler/../task/../context/context.h:49: undefined reference tojump_fcontext' /root/work/socks-libgo/third_party/libgonet/../libgo/libgo/common/../scheduler/../task/../context/context.h:49: undefined reference to
jump_fcontext' /root/work/socks-libgo/build/liblibgonet.a(tcp_detail.cpp.o): In function `std::_Sp_counted_ptr<co::CoTimer::CoTimerImpl, (gnu_cxx::_Lock_policy)2>::_M_dispose()': /usr/local/gcc/include/c++/11.0.0/bits/shared_ptr_base.h:348: undefined reference toco::CoTimer::CoTimerImpl::~CoTimerImpl()' /root/work/socks-libgo/build/liblibgonet.a(tcp_detail.cpp.o): In function
std::shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<co::CoTimer::CoTimerImpl>(co::CoTimer::CoTimerImpl)': /usr/local/gcc/include/c++/11.0.0/bits/shared_ptr_base.h:600: undefined reference toco::CoTimer::CoTimerImpl::~CoTimerImpl()' /root/work/socks-libgo/build/liblibgonet.a(tcp_detail.cpp.o): In function
co::Context::SwapOut()': /root/work/socks-libgo/third_party/libgonet/../libgo/libgo/common/../scheduler/../task/../context/context.h:49: undefined reference tojump_fcontext' /root/work/socks-libgo/third_party/libgonet/../libgo/libgo/common/../scheduler/../task/../context/context.h:49: undefined reference to
jump_fcontext' /root/work/socks-libgo/third_party/libgonet/../libgo/libgo/common/../scheduler/../task/../context/context.h:49: undefined reference tojump_fcontext' /root/work/socks-libgo/third_party/libgonet/../libgo/libgo/common/../scheduler/../task/../context/context.h:49: undefined reference to
jump_fcontext' /root/work/socks-libgo/third_party/libgonet/../libgo/libgo/common/../scheduler/../task/../context/context.h:49: undefined reference tojump_fcontext' /root/work/socks-libgo/build/liblibgonet.a(tcp_detail.cpp.o):/root/work/socks-libgo/third_party/libgonet/../libgo/libgo/common/../scheduler/../task/../context/context.h:49: more undefined references to
jump_fcontext' follow collect2: error: ld returned 1 exit status make[2]: [../bin/socks-serv] Error 1 make[1]: [socks-serv/CMakeFiles/socks-serv.dir/all] Error 2 make: *** [all] Error 2