Clang and undefined symbols when building a library

后端 未结 3 1601
一整个雨季
一整个雨季 2020-12-08 17:17

I\'m working on a C++ framework, and there\'s a few issues when I compile it on OSX with Clang.

First of, I\'m using some other libraries, such as openssl, and clang

3条回答
  •  温柔的废话
    2020-12-08 17:28

    Solved it ! Clang needs to receive the option -undefined dynamic_lookup to ignore missing symbols when compiling a library.

    Add this to the CMakeFile.txt to produce the expected effect:

    if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
      set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup")
    endif()
    

提交回复
热议问题