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

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

Open
cboulay opened this issue Jun 27, 2022 · 1 comment
Open

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

cboulay opened this issue Jun 27, 2022 · 1 comment
Assignees

Comments

@cboulay
Copy link
Collaborator

cboulay commented Jun 27, 2022

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.

@tstenner tstenner self-assigned this Jul 2, 2022
@tstenner
Copy link
Collaborator

tstenner commented Jul 3, 2022

Aside from the obligatory "I don't have a Mac" it looks to me as if the asio symbols are there, but depend on exported C++ symbols (which shouldn't happen). Asio should have an option controlling which symbols get exported, i.e. what ASIO_DECL in thirdparty/asio/asio/detail/config.hpp expands to.

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