2 years ago

#18085

test-img

Diamonddedo

Can't compile Asio with conan macos

I'm trying to build a C++ project with Conan to download the libraries, but the problem is that I can't build it since Asio throw error on it's own functions.

Here is the result of the build : https://pastebin.com/WQ2bFHvm

I'm going to share you my configuration :

//Conan Profile

[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=12.0
os=Macos
os_build=Macos
[options]
[build_requires]
[env]

conanfile.txt

//conanfile.txt
[requires]
asio/1.20.0
boost/1.77.0
libbacktrace/cci.20210118
sfml/2.5.1@bincrafters/stable

[options]
libstd:compiler.libcxx=libstdc++11

[generators]
cmake
cmake_find_package

CMakeLists.txt :

//CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
project(R-Type)

# conan
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
include(build/conanbuildinfo.cmake)
conan_basic_setup()

# Package
find_package(asio 1.20.0 REQUIRED)
find_package(Boost 1.77.0 REQUIRED)
find_package(SFML 2.5.1 COMPONENTS graphics window system REQUIRED)

# .cmake files
include(./rtype/client/build.cmake)
include(./rtype/server/build.cmake)
include(./ecs-engine/build.cmake)
include(./graphics/build.cmake)

set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
include(build/conanbuildinfo.cmake)
conan_basic_setup()

include_directories(${CMAKE_INCLUDE_PATH})

find_package(asio 1.19.2 REQUIRED)
find_package(SFML 2.5.1 COMPONENTS window graphics system audio REQUIRED)

set(ECS_ENGINE_DIR ./ecs-engine/)
set(GRAPHICS_DIR ./graphics/)
set(RTYPE_CLIENT_DIR ./rtype/client/)
set(RTYPE_SERVER_DIR ./rtype/server/)

build_engine()
set(ECS_ENGINE_INCLUDES INCLUDE_DIR)

build_graphics()
build_server()
build_client()

Server cmake build :

//build.cmake
set(RTYPE_SERVER_EXECUTABLE rtype_server)
set(RTYPE_SERVER_DIR ./rtype/server/)


macro(build_server)
    set(SOURCE_DIR ${RTYPE_SERVER_DIR}/sources)
    set(INCLUDE_DIR ${RTYPE_SERVER_DIR}/includes)
    include_directories(${CMAKE_INCLUDE_PATH} ${INCLUDE_DIR})

    add_executable(${RTYPE_SERVER_EXECUTABLE}
        ${SOURCE_DIR}/main.cpp
        ${SOURCE_DIR}/UDP.cpp
    )
    target_link_libraries(${RTYPE_SERVER_EXECUTABLE} ${CONAN_LIBS})
endmacro()

And finally here are the commands I run to build the project :

rm -rf build
mkdir build && cd build
conan install .. --build=missing
cmake .. -G "Unix Makefiles"
cmake --build .

I've tried to install the libraries locally but it does not work, do you guys have any idea on what I'm missing ?

c++

macos

cmake

conan

asio

0 Answers

Your Answer

Accepted video resources