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

[spdlog] build failure #42153

Open
simaocat opened this issue Nov 14, 2024 · 0 comments
Open

[spdlog] build failure #42153

simaocat opened this issue Nov 14, 2024 · 0 comments
Assignees
Labels
category:port-bug The issue is with a library, which is something the port should already support

Comments

@simaocat
Copy link

simaocat commented Nov 14, 2024

Operating system

arm64-osx

Compiler

AppleClang 15.0.0.15000309

Steps to reproduce the behavior

1. my dependencies are gflags spdlog brpc braft
2. here is my CMakeLists:
cmake_minimum_required(VERSION 3.18)

set(VCPKG_ROOT ${CMAKE_SOURCE_DIR}/vcpkg)
set(CMAKE_TOOLCHAIN_FILE ${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
include(${CMAKE_TOOLCHAIN_FILE})

if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
    set(CMAKE_OSX_ARCHITECTURES arm64)
endif()

project(controller)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# install gflags
execute_process(
        COMMAND ${VCPKG_ROOT}/vcpkg install gflags
        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
        RESULT_VARIABLE result
)
if (result)
    message(FATAL_ERROR "-- Failed to install gflags")
endif()
set(GFLAGS_USE_TARGET_NAMESPACE ON)
find_package(gflags CONFIG REQUIRED)

# include spdlog
execute_process(
        COMMAND ${VCPKG_ROOT}/vcpkg install spdlog
        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
        RESULT_VARIABLE result
)
if (result)
    message(FATAL_ERROR "-- Failed to install spdlog")
endif()
find_package(spdlog CONFIG REQUIRED)

# install brpc
execute_process(
        COMMAND ${VCPKG_ROOT}/vcpkg install brpc
        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
        RESULT_VARIABLE result
)
if (result)
    message(FATAL_ERROR "-- Failed to install brpc")
endif()
find_package(unofficial-brpc CONFIG REQUIRED)

## include braft
execute_process(
        COMMAND ${VCPKG_ROOT}/vcpkg install braft
        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
        RESULT_VARIABLE result
)
if (result)
    message(FATAL_ERROR "-- Failed to install braft")
endif()
find_package(unofficial-braft CONFIG REQUIRED)

# target binary file
add_executable(controller main.cc)
target_link_libraries(controller PRIVATE
        gflags::gflags
        spdlog::spdlog
        unofficial::brpc::brpc-static
        unofficial::braft::braft-static
)

3. here are my directories:
cmake  CMakeLists.txt  main.cc  vcpkg
enter cmake and execute: cmake ..

Failure logs

CMake Warning at vcpkg/scripts/buildsystems/vcpkg.cmake:338 (message):
Unable to determine target architecture, continuing without vcpkg.
Call Stack (most recent call first):
CMakeLists.txt:5 (include)

-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Computing installation plan...
The following packages are already installed:
gflags:[email protected]#9
gflags:x64-linux is already installed
Total install time: 10.7 us
gflags provides CMake targets:

set(GFLAGS_USE_TARGET_NAMESPACE ON)
find_package(gflags CONFIG REQUIRED)
target_link_libraries(main PRIVATE gflags::gflags)

Computing installation plan...
The following packages are already installed:
spdlog:[email protected]
spdlog:x64-linux is already installed
Total install time: 9.8 us
The package spdlog provides CMake targets:

find_package(spdlog CONFIG REQUIRED)
target_link_libraries(main PRIVATE spdlog::spdlog)

# Or use the header-only version
find_package(spdlog CONFIG REQUIRED)
target_link_libraries(main PRIVATE spdlog::spdlog_header_only)

CMake Error at CMakeLists.txt:36 (find_package):
Could not find a package configuration file provided by "spdlog" with any
of the following names:

spdlogConfig.cmake
spdlog-config.cmake

Add the installation prefix of "spdlog" to CMAKE_PREFIX_PATH or set
"spdlog_DIR" to a directory containing one of the above files. If "spdlog"
provides a separate development package or SDK, be sure it has been
installed.

Additional context

I wonder why gflags is found correctly while spdlog is missing. I comment out the line: find_package(spdlog CONFIG REQUIRED), and then the new error is : could not find package unofficial-brpcConfig.cmake. I comment out the line: find_package(unofficial-brpc CONFIG REQUIRED), and then the new error is: could not find package unofficial-braftConfig.cmake
I also test on Ubuntu platform, the same error again.

@simaocat simaocat added the category:port-bug The issue is with a library, which is something the port should already support label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support
Projects
None yet
Development

No branches or pull requests

2 participants