Quantcast

How to set libcurl library path and the library name?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to set libcurl library path and the library name?

Alex Chen

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

 


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to set libcurl library path and the library name?

Alex Chen

There is an error in the FindCURL document of Cmake 3.8 (or prior versions).

It says

 

CURL_INCLUDE_DIRS   - where to find curl/curl.h, etc.

CURL_LIBRARIES      - List of libraries when using curl.

CURL_FOUND          - True if curl found.

CURL_VERSION_STRING - the version of curl found (since CMake 2.8.8)

 

But in fact it is looking for CURL_INCLUDE_DIR, not CURL_INCLUDE_DIRS.  If I set –DCURL_INCLUDE_DIRS, cmake cannot find libcurl’s header files.

 

Alex Chen

 

From: CMake <[hidden email]> on behalf of Alex Chen <[hidden email]>
Date: Thursday, April 27, 2017 at 5:14 PM
To: CMake <[hidden email]>
Subject: [CMake] How to set libcurl library path and the library name?

 

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

 

-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to set libcurl library path and the library name?

Rolf Eike Beer
Alex Chen wrote:
> There is an error in the FindCURL document of Cmake 3.8 (or prior versions).

No.

> It says
>
> CURL_INCLUDE_DIRS   - where to find curl/curl.h, etc.

Which is what it is _setting_.

> But in fact it is looking for CURL_INCLUDE_DIR, not CURL_INCLUDE_DIRS.  If I
> set –DCURL_INCLUDE_DIRS, cmake cannot find libcurl’s header files.

This is correct, it is _looking_ for the singular form, and then putting it in
the plural one, like basically all modules do. This has the reason that
sometimes you need multiple include dirs, but you can't properly store that in
one cache variable (you need to know which one was actually not found on next
run).

Eike
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

signature.asc (188 bytes) Download Attachment
Loading...