Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to compile sample UDP echo server #78

Open
denismakogon opened this issue Oct 21, 2022 · 3 comments
Open

Unable to compile sample UDP echo server #78

denismakogon opened this issue Oct 21, 2022 · 3 comments

Comments

@denismakogon
Copy link

denismakogon commented Oct 21, 2022

conan:

[requires]
cppserver/1.0.1.0

[generators]
CMakeDeps
CMakeToolchain

CMakeLists:

cmake_minimum_required(VERSION 3.24)

project(udplib LANGUAGES C CXX VERSION 0.0.1 DESCRIPTION "udplib")

add_definitions("-std=c++11")

find_package(cppserver)
add_executable(${PROJECT_NAME} src/main.cc ${HEADERS})
target_link_libraries(${PROJECT_NAME} cppserver::cppserver)

error:

[ 50%] Building CXX object CMakeFiles/udplib.dir/src/main.cc.o
In file included from /Users/denismakogon/go/src/github.com/denismakogon/udplib/src/main.cc:1:
In file included from /Users/denismakogon/.conan/data/cppserver/1.0.1.0/_/_/package/7013dbe3bb4a95ca2ea1195c65c0d63529763c20/include/server/asio/udp_server.h:12:
In file included from /Users/denismakogon/.conan/data/cppserver/1.0.1.0/_/_/package/7013dbe3bb4a95ca2ea1195c65c0d63529763c20/include/server/asio/service.h:15:
In file included from /Users/denismakogon/.conan/data/cppcommon/1.0.2.0/_/_/package/49beb6ac68a9c74359a1b46f2da1643fab69036c/include/threads/thread.h:164:
/Users/denismakogon/.conan/data/cppcommon/1.0.2.0/_/_/package/49beb6ac68a9c74359a1b46f2da1643fab69036c/include/threads/thread.inl:47:25: warning: initialized lambda captures are a C++14 extension [-Wc++14-extensions]
    return std::thread([fn = fn, args...]()
                        ^
1 warning generated.
[100%] Linking CXX executable bin/udplib
ld: warning: directory not found for option '-L/opt/homebrew/opt/llvm/lib'
Undefined symbols for architecture arm64:
  "_CONF_modules_unload", referenced from:
      asio::ssl::detail::openssl_init_base::do_init::~do_init() in main.cc.o
  "_ERR_reason_error_string", referenced from:
      asio::error::detail::ssl_category::message(int) const in main.cc.o
  "CppServer::Asio::Service::Service(int, bool)", referenced from:
      std::__1::__shared_ptr_emplace<CppServer::Asio::Service, std::__1::allocator<CppServer::Asio::Service> >::__shared_ptr_emplace<>(std::__1::allocator<CppServer::Asio::Service>) in main.cc.o
  "CppServer::Asio::UDPServer::ReceiveAsync()", referenced from:
      vtable for EchoServer in main.cc.o
  "CppServer::Asio::UDPServer::MulticastAsync(void const*, unsigned long)", referenced from:
      vtable for EchoServer in main.cc.o
  "CppServer::Asio::UDPServer::Send(asio::ip::basic_endpoint<asio::ip::udp> const&, void const*, unsigned long)", referenced from:
      vtable for EchoServer in main.cc.o
  "CppServer::Asio::UDPServer::Send(asio::ip::basic_endpoint<asio::ip::udp> const&, void const*, unsigned long, CppCommon::Timespan const&)", referenced from:
      vtable for EchoServer in main.cc.o
  "CppServer::Asio::UDPServer::Stop()", referenced from:
      vtable for EchoServer in main.cc.o
  "CppServer::Asio::UDPServer::Start(asio::ip::basic_endpoint<asio::ip::udp> const&)", referenced from:
      vtable for EchoServer in main.cc.o
  "CppServer::Asio::UDPServer::Start(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)", referenced from:
      vtable for EchoServer in main.cc.o
  "CppServer::Asio::UDPServer::Start()", referenced from:
      vtable for EchoServer in main.cc.o
  "CppServer::Asio::UDPServer::Receive(asio::ip::basic_endpoint<asio::ip::udp>&, void*, unsigned long)", referenced from:
      vtable for EchoServer in main.cc.o
  "CppServer::Asio::UDPServer::Receive(asio::ip::basic_endpoint<asio::ip::udp>&, void*, unsigned long, CppCommon::Timespan const&)", referenced from:
      vtable for EchoServer in main.cc.o
  "CppServer::Asio::UDPServer::Receive(asio::ip::basic_endpoint<asio::ip::udp>&, unsigned long)", referenced from:
      vtable for EchoServer in main.cc.o
  "CppServer::Asio::UDPServer::Receive(asio::ip::basic_endpoint<asio::ip::udp>&, unsigned long, CppCommon::Timespan const&)", referenced from:
      vtable for EchoServer in main.cc.o
  "CppServer::Asio::UDPServer::Restart()", referenced from:
      vtable for EchoServer in main.cc.o
  "CppServer::Asio::UDPServer::Multicast(void const*, unsigned long)", referenced from:
      vtable for EchoServer in main.cc.o
  "CppServer::Asio::UDPServer::Multicast(void const*, unsigned long, CppCommon::Timespan const&)", referenced from:
      vtable for EchoServer in main.cc.o
  "CppServer::Asio::UDPServer::SendAsync(asio::ip::basic_endpoint<asio::ip::udp> const&, void const*, unsigned long)", referenced from:
      vtable for EchoServer in main.cc.o
  "CppServer::Asio::UDPServer::UDPServer(std::__1::shared_ptr<CppServer::Asio::Service> const&, int, CppServer::Asio::InternetProtocol)", referenced from:
      EchoServer::EchoServer(std::__1::shared_ptr<CppServer::Asio::Service> const&, int, CppServer::Asio::InternetProtocol) in main.cc.o
  "typeinfo for CppServer::Asio::UDPServer", referenced from:
      typeinfo for EchoServer in main.cc.o
  "vtable for CppServer::Asio::UDPServer", referenced from:
      CppServer::Asio::UDPServer::~UDPServer() in main.cc.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/udplib] Error 1
make[1]: *** [CMakeFile
@chronoxor
Copy link
Owner

Please try add_definitions("-std=c++14")

@denismakogon
Copy link
Author

No, it gave the same result. I'm adding a bit more of info regarding my machine:

  1. macOS 12.6 [M1]
  2. conan profile:
[settings]
os=Macos
os_build=Macos
arch=armv8
arch_build=armv8
#compiler=apple-clang
compiler=clang
compiler.version=14
compiler.libcxx=libc++
build_type=Release
[options]

[build_requires]

[env]
CC=/usr/bin/clang
CXX=/usr/bin/clang++

@denismakogon
Copy link
Author

@chronoxor any updates so far?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants