[CMake] How to set libcurl library path and the library name?

Alex Chen alex_chen at filemaker.com
Thu Apr 27 20:14:07 EDT 2017


Hi,

    I am trying to build AWS CPP SDK for the iOS from downloaded source. The compilation seems to go well but it fails at link time.  My CMake invocation is

 

/Applications/CMake.app/Contents/bin/cmake -Wno-dev -DBUILD_ONLY=s3;s3-encryption -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_SHARED_LINKER_FLAGS=-framework Foundation -framework Security -DCMAKE_EXE_LINKER_FLAGS=-framework Foundation -framework Security -DCMAKE_PREFIX_PATH=/Volumes/Workspace/Prebuilt/Release-iphoneos/libcurl -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-O3 -DCMAKE_INSTALL_PREFIX=/Volumes/Workspace/AWS/CppSDK/1.0.101/iPhoneOS/arm64/Release -DBUILD_SHARED_LIBS=off -DCPP_STANDARD=14 -DCURL_INCLUDE_DIR=/Volumes/Workspace/Prebuilt/Release-iphoneos/libcurl/include64 -DCURL_LIBRARIES=libcurl_7.51 -DSTATIC_LINKING=1 -DTARGET_ARCH=Apple /Volumes/Workspace/FMSOURCE/Shared/AWS/CppSDK/aws-sdk-cpp-1.0.101

 

The output from CMake looks like it finds the include path of libcurl but no the library.

 

-- Found Git: /usr/bin/git (found version "2.11.0 (Apple Git-81)")

-- Building AWS libraries as static objects

fatal: Not a git repository (or any parent up to mount point /Volumes/Workspace)

Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

-- Building project version: 1.0.101

-- The CXX compiler identification is AppleClang 8.1.0.8020042

-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++

-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -- works

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info - done

-- Detecting CXX compile features

-- Detecting CXX compile features - done

-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.8")

--   Zlib include directory: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/usr/include

--   Zlib library: /usr/lib/libz.dylib

-- Encryption: CommonCrypto

-- Http client: Curl

-- Found CURL: /usr/lib/libcurl.dylib (found version "7.51.0")

--   Curl include directory: /Volumes/Workspace/FMSOURCE/Shared/Prebuilt/Release-iphoneos/libcurl/include64

--   Curl library: /usr/lib/libcurl.dylib

-- Considering s3

-- Considering s3-encryption

-- The C compiler identification is AppleClang 8.1.0.8020042

-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang

-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -- works

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Detecting C compile features

-- Detecting C compile features - done

-- Updating version info to 1.0.101

-- Custom memory management disabled

-- Configuring done

-- Generating done

 

The linking errors look like this:

 

[ 92%] Linking CXX executable aws-cpp-sdk-s3-integration-tests

ld: warning: ignoring file /usr/lib/libcurl.dylib, missing required architecture arm64 in file /usr/lib/libcurl.dylib (2 slices)

Undefined symbols for architecture arm64:

  "_curl_easy_cleanup", referenced from:

      Aws::Http::CurlHandleContainer::~CurlHandleContainer() in libaws-cpp-sdk-core.a(CurlHandleContainer.cpp.o)

  "_curl_easy_getinfo", referenced from:

      Aws::Http::CurlHttpClient::MakeRequest(Aws::Http::HttpRequest&, Aws::Utils::RateLimits::RateLimiterInterface*, Aws::Utils::RateLimits::RateLimiterInterface*) const in libaws-cpp-sdk-core.a(CurlHttpClient.cpp.o)

  "_curl_easy_init", referenced from:

      Aws::Http::CurlHandleContainer::CheckAndGrowPool() in libaws-cpp-sdk-core.a(CurlHandleContainer.cpp.o)

  "_curl_easy_perform", referenced from:

      Aws::Http::CurlHttpClient::MakeRequest(Aws::Http::HttpRequest&, Aws::Utils::RateLimits::RateLimiterInterface*, Aws::Utils::RateLimits::RateLimiterInterface*) const in libaws-cpp-sdk-core.a(CurlHttpClient.cpp.o)

  "_curl_easy_reset", referenced from:

      Aws::Http::CurlHandleContainer::ReleaseCurlHandle(void*) in libaws-cpp-sdk-core.a(CurlHandleContainer.cpp.o)

  "_curl_easy_setopt", referenced from:

      SetOptCodeForHttpMethod(void*, Aws::Http::HttpRequest const&) in libaws-cpp-sdk-core.a(CurlHttpClient.cpp.o)

      Aws::Http::CurlHttpClient::MakeRequest(Aws::Http::HttpRequest&, Aws::Utils::RateLimits::RateLimiterInterface*, Aws::Utils::RateLimits::RateLimiterInterface*) const in libaws-cpp-sdk-core.a(CurlHttpClient.cpp.o)

      Aws::Http::CurlHandleContainer::CheckAndGrowPool() in libaws-cpp-sdk-core.a(CurlHandleContainer.cpp.o)

      Aws::Http::CurlHandleContainer::ReleaseCurlHandle(void*) in libaws-cpp-sdk-core.a(CurlHandleContainer.cpp.o)

      Aws::Http::CurlHandleContainer::SetDefaultOptionsOnHandle(void*) in libaws-cpp-sdk-core.a(CurlHandleContainer.cpp.o)

  "_curl_global_cleanup", referenced from:

      Aws::Http::CurlHttpClient::CleanupGlobalState() in libaws-cpp-sdk-core.a(CurlHttpClient.cpp.o)

  "_curl_global_init", referenced from:

      Aws::Http::CurlHttpClient::InitGlobalState() in libaws-cpp-sdk-core.a(CurlHttpClient.cpp.o)

  "_curl_slist_append", referenced from:

      Aws::Http::CurlHttpClient::MakeRequest(Aws::Http::HttpRequest&, Aws::Utils::RateLimits::RateLimiterInterface*, Aws::Utils::RateLimits::RateLimiterInterface*) const in libaws-cpp-sdk-core.a(CurlHttpClient.cpp.o)

  "_curl_slist_free_all", referenced from:

      Aws::Http::CurlHttpClient::MakeRequest(Aws::Http::HttpRequest&, Aws::Utils::RateLimits::RateLimiterInterface*, Aws::Utils::RateLimits::RateLimiterInterface*) const in libaws-cpp-sdk-core.a(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-s3-integration-tests/aws-cpp-sdk-s3-integration-tests] Error 1

make[1]: *** [aws-cpp-sdk-s3-integration-tests/CMakeFiles/aws-cpp-sdk-s3-integration-tests.dir/all] Error 2

make: *** [all] Error 2

 

Thanks for any help you can provide

 

Alex Chen

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170427/e5856cf6/attachment.html>


More information about the CMake mailing list