Open brandonros opened 2 years ago
Because your sub project(s) check it with "find_package(OpenSSL)". So you need to setup it:
...
add_subdirectory("deps/openssl-cmake")
set(OPENSSL_SSL_LIBRARY ssl)
set(OPENSSL_CRYPTO_LIBRARY crypto)
set(OPENSSL_INCLUDE_DIR "${openssl_BINARY_DIR}/include" "${openssl_BINARY_DIR}")
set(OPENSSL_FOUND ON)
message(STATUS "Build OpenSSL: ${openssl_BINARY_DIR}")
...
-- Looking for ldap_init in ldap;-framework SystemConfiguration;-framework CoreFoundation;OpenSSL::SSL;OpenSSL::Crypto
CMake Error at /Users/brandonros/Desktop/j2534-rpc-js/output/CMakeFiles/CMakeTmp/CMakeLists.txt:15 (add_executable):
Target "cmTC_30b46" links to target "OpenSSL::SSL" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at /Users/brandonros/Desktop/j2534-rpc-js/output/CMakeFiles/CMakeTmp/CMakeLists.txt:15 (add_executable):
Target "cmTC_30b46" links to target "OpenSSL::Crypto" but the target was
not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
CMake Error at /opt/homebrew/Cellar/cmake/3.22.2/share/cmake/Modules/CheckLibraryExists.cmake:72 (try_compile):
Failed to generate test project build system.
Call Stack (most recent call first):
deps/curl/CMake/Macros.cmake:30 (check_library_exists)
deps/curl/CMakeLists.txt:586 (check_library_exists_concat)
-- Configuring incomplete, errors occurred!
cmake_minimum_required(VERSION 3.5.1)
project(j2534-rpc)
set(CMAKE_CXX_STANDARD 11)
# architecture
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCHITECTURE_SLUG "x64")
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
set(ARCHITECTURE_SLUG "ia32")
endif()
# variables
set(MSGPACK_USE_BOOST OFF CACHE BOOL "")
# msgpack
add_subdirectory("deps/msgpack-c")
# openssl
add_subdirectory("deps/openssl-cmake")
set(OPENSSL_SSL_LIBRARY ssl)
set(OPENSSL_CRYPTO_LIBRARY crypto)
set(OPENSSL_INCLUDE_DIR "${openssl_BINARY_DIR}/include" "${openssl_BINARY_DIR}")
set(OPENSSL_FOUND ON)
message(STATUS "Build OpenSSL: ${openssl_BINARY_DIR}")
# curl
add_subdirectory("deps/curl")
# diag test
add_executable(j2534-rpc-diag-test-${ARCHITECTURE_SLUG} j2534-rpc-diag-test.cpp)
target_link_libraries(j2534-rpc-diag-test-${ARCHITECTURE_SLUG} curl msgpack)
Brandons-MacBook-Air:j2534-rpc-js brandonros 2022-02-20 13:20:44 $ uname -a
Darwin Brandons-MacBook-Air.local 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:29:10 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T8101 arm64
It's the add_subdirectory("deps/curl")
line causing it.
Try adding the following , before add of deps/curl:
add_library(OpenSSL::Crypto ALIAS crypto) add_library(OpenSSL::SSL ALIAS ssl)
Also see: https://cmake.org/cmake/help/v3.6/module/FindOpenSSL.html Probably we will have to add these lines in the project "openssl" itself ... if that works for you
edit: Yep looking in this issue: https://github.com/janbar/openssl-cmake/issues/23#issuecomment-924661972 , that should resolve your issue
Nope, no luck. I think it's something to do with Mac/Darwin. It isn't happening to me on Windows. Maybe colliding with some local installation of libcurl-dev I have somewhere with Mac OS X by default or brew or something? Really no clue.
cmake_minimum_required(VERSION 3.5.1)
project(j2534-http)
set(CMAKE_CXX_STANDARD 11)
# architecture
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCHITECTURE_SLUG "x64")
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
set(ARCHITECTURE_SLUG "ia32")
endif()
# msgpack
set(MSGPACK_USE_BOOST OFF CACHE BOOL "")
add_definitions(-DMSGPACK_NO_BOOST)
add_subdirectory("deps/msgpack-c")
include_directories("deps/msgpack-c/include")
# openssl
add_subdirectory("deps/openssl-cmake")
set(OPENSSL_SSL_LIBRARY ssl)
set(OPENSSL_CRYPTO_LIBRARY crypto)
set(OPENSSL_INCLUDE_DIR "${openssl_BINARY_DIR}/include" "${openssl_BINARY_DIR}")
set(OPENSSL_FOUND ON)
message(STATUS "Build OpenSSL: ${openssl_BINARY_DIR}")
# curl
add_library(OpenSSL::Crypto ALIAS crypto)
add_library(OpenSSL::SSL ALIAS ssl)
add_subdirectory("deps/curl")
include_directories("deps/curl/include")
# libconfig
set(BUILD_SHARED_LIBS OFF CACHE BOOL "")
set(BUILD_TESTS OFF CACHE BOOL "")
set(BUILD_EXAMPLES OFF CACHE BOOL "")
add_subdirectory("deps/libconfig")
include_directories("deps/libconfig/lib")
# diag test
add_executable(j2534-http-diag-test-${ARCHITECTURE_SLUG} diag/log.cpp diag/api.cpp diag/j2534-http-diag-test.cpp)
target_link_libraries(j2534-http-diag-test-${ARCHITECTURE_SLUG} libcurl msgpackc-cxx)
# diag
add_library(j2534-http-diag-${ARCHITECTURE_SLUG} SHARED diag/log.cpp diag/api.cpp diag/structs.cpp diag/j2534-http-diag.cpp)
target_link_libraries(j2534-http-diag-${ARCHITECTURE_SLUG} libcurl msgpackc-cxx libconfig)
Brandons-MacBook-Air:j2534-http brandonros 2022-02-20 22:37:59 $ cmake -S . -B "output" && cmake --build output --config Debug
-- OpenSSL version 1.1.1m
-- Build OpenSSL: /Users/brandonros/Desktop/j2534-http/output/deps/openssl-cmake
-- curl version=[7.82.0-DEV]
-- Looking for ber_init in lber;-framework SystemConfiguration;-framework CoreFoundation;OpenSSL::SSL;OpenSSL::Crypto
CMake Error at /Users/brandonros/Desktop/j2534-http/output/CMakeFiles/CMakeTmp/CMakeLists.txt:15 (add_executable):
Target "cmTC_fab92" links to target "OpenSSL::SSL" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at /Users/brandonros/Desktop/j2534-http/output/CMakeFiles/CMakeTmp/CMakeLists.txt:15 (add_executable):
Target "cmTC_fab92" links to target "OpenSSL::Crypto" but the target was
not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
CMake Error at /opt/homebrew/Cellar/cmake/3.22.2/share/cmake/Modules/CheckLibraryExists.cmake:72 (try_compile):
Failed to generate test project build system.
Call Stack (most recent call first):
deps/curl/CMake/Macros.cmake:30 (check_library_exists)
deps/curl/CMakeLists.txt:587 (check_library_exists_concat)
-- Configuring incomplete, errors occurred!
See also "/Users/brandonros/Desktop/j2534-http/output/CMakeFiles/CMakeOutput.log".
See also "/Users/brandonros/Desktop/j2534-http/output/CMakeFiles/CMakeError.log".
Brandons-MacBook-Air:j2534-http brandonros 2022-02-20 22:38:43 $
Hey still a problem for me
I still have the same problem on windows with the version 3.27.0-rc2. Is there any other solution?
Same issue with Ubuntu 22.04.3 via WSL trying to build the toolchain for SerenityOS.
Cross-posting to the Serenity repo.