oatpp: Missing Atomic library

Hello,

I was able to cross-compile a simple API for Clang ARM. But when I run the executable I get the following error: ./{executable}: error while loading shared libraries: libatomic.so.1: cannot open shared object file: No such file or directory

The GNU Atomic library is not supported for my target devices (compatibility problems with libraries delivered by chip manfacturer).

I’m not sure but I think Atomic is only used for a spinlock in Oat++, correct me if I’m wrong. Would there be a sollution where I wouldn’t have to use Atomic?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 30 (16 by maintainers)

Most upvoted comments

I will make a PR.

I was able to compile on Linux without atomic so maybe just as a default not link atomic for every platform and let people turn it on if they somehow need it.

SET(ADD_LINK_LIBS ${CMAKE_THREAD_LIBS_INIT})

if(MSVC OR MINGW)
    SET(ADD_LINK_LIBS "${ADD_LINK_LIBS} wsock32 ws2_32")
endif()

if(OATPP_DO_LINK_ATOMIC) 
    SET(ADD_LINK_LIBS "${ADD_LINK_LIBS} atomic")
endif()

target_link_libraries(oatpp PUBLIC ${ADD_LINK_LIBS})

With OATPP_DO_LINK_ATOMIC “OFF” as default.