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

2017-04-27 Thread 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 <cmake-boun...@cmake.org> on behalf of Alex Chen 
<alex_c...@filemaker.com>
Date: Thursday, April 27, 2017 at 5:14 PM
To: CMake <cmake@cmake.org>
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 
liba

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

2017-04-27 Thread Alex Chen
eContainer::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

Re: [CMake] Overriding the include path, library path of OpenSSL, Zlib and libcurl

2017-04-21 Thread Alex Chen
Although cmake uses the path I supplied for OpenSSL and Zlib, I do not see the 
–I flag being used in compiling the code. (I set VERBOSE=1 to make to see what 
it does.)

When I run ‘ldd’ against the resulting .so files, reference to libssl.so or 
libcrypto.so is empty, i.e ‘libssl.so => not found’, but libz.so still links to 
/lib64/libz.so. (It seems to ignore the fact it does find a new path of zlib.)

 

How to I set the linker flag, i.e. –L and –Wl,-rpath=$myLibPath ?

 

Alex Chen

 

From: CMake <cmake-boun...@cmake.org> on behalf of Alex Chen 
<alex_c...@filemaker.com>
Date: Friday, April 21, 2017 at 10:28 AM
To: CMake <cmake@cmake.org>
Subject: Re: [CMake] Overriding the include path, library path of OpenSSL, Zlib 
and libcurl

 

Thanks for the help.  I will try that. 

 

Alex Chen

 

From: Michael Ellery <mellery...@gmail.com>
Date: Thursday, April 20, 2017 at 8:13 PM
To: Alex Chen <alex_c...@filemaker.com>
Cc: CMake <cmake@cmake.org>
Subject: Re: [CMake] Overriding the include path, library path of OpenSSL, Zlib 
and libcurl

 

It doesn’t look like that find module directly supports HINTS or PATHS, so you 
can try setting CMAKE_LIBRARY_PATH and CMAKE_INCLUDE_PATH  
(https://cmake.org/cmake/help/v3.7/variable/CMAKE_LIBRARY_PATH.html) before 
calling the curl finder. I think you can add to those variables whatever paths 
are appropriate to search for CURL on your systems.

 

-Mike

 

On Apr 20, 2017, at 6:06 PM, Alex Chen <alex_c...@filemaker.com> wrote:

The source code I want to compile on Linux uses ‘FindOpenSSL’, ‘FindZLIB’, and 
‘FindCURL’ to resolve the paths of these libraries.

However, I have newer version of these libraries in different locations.  How 
to I override these to use my paths?

I am able to use OPENSSL_ROOT_DIR, from FindOpenSSL module, and ZLIB_ROOT, from 
FindZLIB module, to override the paths.  

But I cannot find anything in FindCURL module to override the path of libcurl.

  

  

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 

-- 

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

Re: [CMake] Overriding the include path, library path of OpenSSL, Zlib and libcurl

2017-04-21 Thread Alex Chen
Thanks for the help.  I will try that. 

 

Alex Chen

 

From: Michael Ellery <mellery...@gmail.com>
Date: Thursday, April 20, 2017 at 8:13 PM
To: Alex Chen <alex_c...@filemaker.com>
Cc: CMake <cmake@cmake.org>
Subject: Re: [CMake] Overriding the include path, library path of OpenSSL, Zlib 
and libcurl

 

It doesn’t look like that find module directly supports HINTS or PATHS, so you 
can try setting CMAKE_LIBRARY_PATH and CMAKE_INCLUDE_PATH  
(https://cmake.org/cmake/help/v3.7/variable/CMAKE_LIBRARY_PATH.html) before 
calling the curl finder. I think you can add to those variables whatever paths 
are appropriate to search for CURL on your systems.

 

-Mike

 

On Apr 20, 2017, at 6:06 PM, Alex Chen <alex_c...@filemaker.com> wrote:

The source code I want to compile on Linux uses ‘FindOpenSSL’, ‘FindZLIB’, and 
‘FindCURL’ to resolve the paths of these libraries.

However, I have newer version of these libraries in different locations.  How 
to I override these to use my paths?

I am able to use OPENSSL_ROOT_DIR, from FindOpenSSL module, and ZLIB_ROOT, from 
FindZLIB module, to override the paths.  

But I cannot find anything in FindCURL module to override the path of libcurl.

  

  

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

[CMake] Overriding the include path, library path of OpenSSL, Zlib and libcurl

2017-04-20 Thread Alex Chen
The source code I want to compile on Linux uses ‘FindOpenSSL’, ‘FindZLIB’, and 
‘FindCURL’ to resolve the paths of these libraries.

However, I have newer version of these libraries in different locations.  How 
to I override these to use my paths?

I am able to use OPENSSL_ROOT_DIR, from FindOpenSSL module, and ZLIB_ROOT, from 
FindZLIB module, to override the paths.  

But I cannot find anything in FindCURL module to override the path of libcurl.

 

 

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

Re: [CMake] How to set C++ standard?

2017-04-20 Thread Alex Chen
Thanks.  I find the problem in the source code where it uses CPP_STANDARD as 
suffix in –std=c++, therefore I should set CPP_STANDARD instead of the other 
one.

 

 

Alex Chen

 

From: Craig Scott <craig.sc...@crascit.com>
Date: Thursday, April 20, 2017 at 4:41 PM
To: Alex Chen <alex_c...@filemaker.com>
Cc: CMake <cmake@cmake.org>
Subject: Re: [CMake] How to set C++ standard?

 

You generally shouldn't set CMAKE_CXX_STANDARD on its own, you should also be 
explicitly setting CMAKE_CXX_STANDARD_REQUIRED and CMAKE_CXX_EXTENSIONS to 
ensure you are getting the behaviour you want. These would also typically be 
set by the project's own CMakeLists.txt file rather than being passed on the 
cmake command line as cache variables. You may find the following article 
helpful:

 

https://crascit.com/2015/03/28/enabling-cxx11-in-cmake/

 

 

 

On Fri, Apr 21, 2017 at 8:57 AM, Alex Chen <alex_c...@filemaker.com> wrote:

I tried to set the compiler flag –std=c++14 via cmake command line on Linux 
with –DCMAKE_CXX_STANDARD=14.  The message from ‘make’ shows   -std=c++11 
–std=gnu++14

If I do not set that flag, I get -std=c++11.  This seem to imply the 
CMAKE_CXX_STANDARD flag sets gnu++ instead of c++.  How do I set the flag 
–std=c++14 then?

 

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



 

-- 

Craig Scott

Melbourne, Australia

https://crascit.com

-- 

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

[CMake] How to set C++ standard?

2017-04-20 Thread Alex Chen
I tried to set the compiler flag –std=c++14 via cmake command line on Linux 
with –DCMAKE_CXX_STANDARD=14.  The message from ‘make’ shows   -std=c++11 
–std=gnu++14

If I do not set that flag, I get -std=c++11.  This seem to imply the 
CMAKE_CXX_STANDARD flag sets gnu++ instead of c++.  How do I set the flag 
–std=c++14 then?

 

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