socket.io-client-cpp icon indicating copy to clipboard operation
socket.io-client-cpp copied to clipboard

Build Issue: Linker errors when building with shared library option

Open TheGorge7 opened this issue 8 months ago • 0 comments

Environment

  • OS: Windows on ARM64
  • Compiler: Clang (LLVM)
  • Build System: CMake with Ninja
  • Repository: socket.io-client-cpp (latest version from main branch)

Steps to Reproduce:

  • Cloned the repository recursively:
git clone --recursive https://github.com/socketio/socket.io-client-cpp.git
cd socket.io-client-cpp
  • Generated build files with CMake:

cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON ninja

Error

The main library seems to build but when linking the test executable, I'm getting multiple "undefined symbol" errors for various methods in the sio::packet class:

[113/113] Linking CXX executable test\sio_test.exe
FAILED: test/sio_test.exe
C:\Windows\system32\cmd.exe /C "cd . && C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -nostartfiles -nostdlib -O3 -DNDEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrt -Xlinker /subsystem:console -fuse-ld=lld-link test/CMakeFiles/sio_test.dir/sio_test.cpp.obj -o test\sio_test.exe -Xlinker /MANIFEST:EMBED -Xlinker /implib:test\sio_test.lib -Xlinker /pdb:test\sio_test.pdb -Xlinker /version:0.0   _deps/catch2-build/src/Catch2Main.lib  sioclient.lib  _deps/catch2-build/src/Catch2.lib  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -loldnames  && cd ."
lld-link: error: undefined symbol: public: __cdecl sio::packet::packet(class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> const &, class std::shared_ptr<class sio::message> const &, int, bool)
>>> referenced by test/CMakeFiles/sio_test.dir/sio_test.cpp.obj:(void __cdecl CATCH2_INTERNAL_TEST_0(void))
>>> referenced by test/CMakeFiles/sio_test.dir/sio_test.cpp.obj:(void __cdecl CATCH2_INTERNAL_TEST_12(void))

lld-link: error: undefined symbol: public: enum sio::packet::frame_type __cdecl sio::packet::get_frame(void) const
>>> referenced by test/CMakeFiles/sio_test.dir/sio_test.cpp.obj:(void __cdecl CATCH2_INTERNAL_TEST_0(void))

TheGorge7 avatar Apr 09 '25 03:04 TheGorge7