oatpp / oatpp-starter

Oatpp simple-API starter project
https://oatpp.io/
Apache License 2.0
72 stars 35 forks source link

Issue compiling on FreeBSD 12.1. Missing header include. Linking issue #6

Closed ghost closed 4 years ago

ghost commented 4 years ago

I had an issue compiling on FreeBSD 12.1 due to a missing header include. Adding:

#if defined(__FreeBSD__) 
    #include <netinet/in.h>
#endif

to the includes for non-windows systems in oatpp/src/oatpp/network/server/SimpleTCPConnectionProvider.cpp resolves the issue.

Another issue came during linking since it links with -latomic which does not work on FreeBSD as -latomic is not needed. Adding:

if(MSVC)
    target_link_libraries(oatpp PUBLIC ${CMAKE_THREAD_LIBS_INIT} wsock32 ws2_32)
elseif(APPLE)
    target_link_libraries(oatpp PUBLIC ${CMAKE_THREAD_LIBS_INIT})
else(MSVC)
    if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
        target_link_libraries(oatpp PUBLIC ${CMAKE_THREAD_LIBS_INIT})
    else(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
        target_link_libraries(oatpp PUBLIC ${CMAKE_THREAD_LIBS_INIT} atomic)
    endif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
endif(MSVC)

to the CMakeLists.txt in the src directory resolved this for me.

ghost commented 4 years ago

Wrong repo