Skip to content

Can't link to static liblsl due to missing asio #171

@cboulay

Description

@cboulay

I'm using a pretty uncommon config and I haven't tested in other environments, so this might not be a general problem.

Macbook Pro M1Pro, MacOS 12.4, CLion with make and ninja + clang.

I'm fetching LSL using the following cmake snippet:

FetchContent_Declare(lsl
        GIT_REPOSITORY https://github.com/sccn/liblsl.git
        GIT_TAG a3322ae32d3a9da1d6dd8c591007ee209e84f38b
)
set(LSL_BUILD_STATIC ON CACHE INTERNAL "")
FetchContent_MakeAvailable(lsl)

During building, compiling works fine but then the linker gives this error:

: && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names  {list of objects} -o {binary}  _deps/lsl-build/liblsl.a  /opt/homebrew/lib/libportaudio.dylib  -lSystem && :
Undefined symbols for architecture arm64:
  "std::logic_error::what() const", referenced from:
      vtable for asio::invalid_service_owner in liblsl.a(stream_outlet_impl.cpp.o)
      vtable for asio::service_already_exists in liblsl.a(stream_outlet_impl.cpp.o)
      vtable for asio::invalid_service_owner in liblsl.a(tcp_server.cpp.o)
      vtable for asio::service_already_exists in liblsl.a(tcp_server.cpp.o)

(and several more pages like that)

If I change LSL_BUILD_STATIC to OFF then everything works fine, but of course I have to ship liblsl with my project binaries.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions