Description
Describe the bug
Error building aws-sdk-ccp-core
want to link against local download and built curl-8.0.1
The variables CURL_INCLUDE_DIR, CURL_LIBRARY
, are specified,
- CURL_INCLUDE_DIR="${DEPEND_INSTALL_DIR}/curl-${LIBCURL_VERSION}/include" \
- CURL_LIBRARY="${DEPEND_INSTALL_DIR}/curl-${LIBCURL_VERSION}/lib/libcurl.dylib" \
These desired directories exist and are correctly referenced
But cmake files look for system libraries first, using FindCURL.
Expected Behavior
Curl library and include directories, CURL_INCLUDE_DIR, CURL_LIBRARY, should be recognized and used to access specified version of curl. Or, an option should be provided to configure cmake to use these variables instead of system values.
Linking should succeed.
Current Behavior
message:
CMake Warning:
Manually-specified variables were not used by the project:
CURL_INCLUDE_DIR
CURL_LIBRARY
...
[ 81%] Linking CXX shared library libaws-cpp-sdk-core.dylib
Undefined symbols for architecture arm64:
"_curl_easy_cleanup", referenced from:
Aws::Http::CurlHandleContainer::~CurlHandleContainer() in CurlHandleContainer.cpp.o
Aws::Http::CurlHandleContainer::DestroyCurlHandle(void*) in CurlHandleContainer.cpp.o
"_curl_easy_getinfo", referenced from:
Aws::Http::CurlHttpClient::MakeRequest(std::__1::shared_ptr<Aws::Http::HttpRequest> const&, Aws::Utils::RateLimits::RateLimiterInterface*, Aws::Utils::RateLimits::RateLimiterInterface*) const in CurlHttpClient.cpp.o
...
"_curl_version_info", referenced from:
Aws::Http::CurlHttpClient::InitGlobalState() in CurlHttpClient.cpp.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [aws-cpp-sdk-core/libaws-cpp-sdk-core.dylib] Error 1
make[1]: *** [aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/all] Error 2
Reproduction Steps
Have local version of curl installed in /usr/local/lib
, with /usr/local/lib/cmake/CURL
directory
CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake \
-DCMAKE_CXX_FLAGS="-fstack-protector-strong -Wno-deprecated-declarations" \
-DCMAKE_C_FLAGS="-fstack-protector-strong -Wno-deprecated-declarations" \
-DBUILD_SHARED_LIBS=ON \
-DCURL_INCLUDE_DIR="${DEPEND_INSTALL_DIR}/curl-${LIBCURL_VERSION}/include" \
-DCURL_LIBRARY="${DEPEND_INSTALL_DIR}/curl-${LIBCURL_VERSION}/lib/libcurl.dylib" \
-DCMAKE_PREFIX_PATH="${DEPEND_INSTALL_DIR}/aws-sdk-${AWS_SDK_CPP_VERSION}" \
-DCMAKE_INSTALL_PREFIX="${DEPEND_INSTALL_DIR}/aws-sdk-${AWS_SDK_CPP_VERSION}" \
-DBUILD_ONLY="ebs" \
-DCPP_STANDARD="${CPP_STANDARD}" \
-DENABLE_TESTING=OFF \
-S ${DEPEND_BUILD_DIR}/aws-sdk-${AWS_SDK_CPP_VERSION}/aws-sdk-cpp \
-B ${DEPEND_BUILD_DIR}/aws-sdk-${AWS_SDK_CPP_VERSION}/aws-sdk-cpp-build
These directories exist and are accessible,
CURL_INCLUDE_DIR="${DEPEND_INSTALL_DIR}/curl-${LIBCURL_VERSION}/include" \
CURL_LIBRARY="${DEPEND_INSTALL_DIR}/curl-${LIBCURL_VERSION}/lib/libcurl.dylib" \
Possible Solution
One option could be provided to configure cmake to use/prefer these variables instead of system values.
- CURL_INCLUDE_DIR
- CURL_LIBRARY
Another option would be to add a flag (e.g. CURL_USE_SYSTEM
or CURL_USE_SPECIFIED
) to indicate which library to prefer.
Additional Information/Context
There is a system-wide setting, NO_CMAKE_SYSTEM_PATH
, but that prevents finding any system installed libraries.
AWS CPP SDK version used
1.9.379
Compiler and Version used
clang++ --version Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Operating System and version
mac os ventura