[AWS S3] rv1126平台编译AWS SDK for C++遇到的问题

下载AWS SDK for C++

git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp

PC编译确定源代码下载正确

  1. sudo apt-get install libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev libpulse-dev -y
  2. cd aws-sdk-cpp
  3. mkdir build
  4. 因为我只用到S3,所以只编译S3:cmake .. -DBUILD_ONLY:STRING="s3"
-- TARGET_ARCH not specified; inferring host OS to be platform compilation target
-- Building AWS libraries as shared objects
-- Generating linux build config
-- Building project version: 1.10.35
--   Zlib library: /usr/lib/x86_64-linux-gnu/libz.so
-- Encryption: LibCrypto
-- LibCrypto Include Dir: /usr/include
-- LibCrypto Shared Lib:  /usr/lib/x86_64-linux-gnu/libcrypto.so
-- LibCrypto Static Lib:  /usr/lib/x86_64-linux-gnu/libcrypto.a
-- Http client: Curl
--   Curl include directory: /usr/include/x86_64-linux-gnu
--   Curl library: /usr/lib/x86_64-linux-gnu/libcurl.so
-- AWS CRT C++ 0.18.16
-- CMake 3.16.3
-- Building SIMD base64 decoder
-- Packaging currently only supported on Fedora.
-- Detected CMAKE_SYSTEM_PROCESSOR as x86_64
-- Detected 64-Bit system
-- Enabling Kyber_R3 x86_64 optimizations
-- madvise() support detected
-- clone() support detected
-- S2N found target: AWS::crypto
-- crypto Include Dir: /usr/include
-- Using libcrypto from the cmake path
-- Using libcrypto from system: /usr/lib/x86_64-linux-gnu/libcrypto.so
-- Add s3-crt:s3 to C2J_SPECIAL_NAME_LIST
-- Considering s3
-- Updating version info to 1.10.35
-- Custom memory management disabled
-- SKIPPING:Threads::Threads
-- SKIPPING:Threads::Threads
-- SKIPPING:Threads::Threads
-- SKIPPING:Threads::Threads
-- SKIPPING:Threads::Threads
-- SKIPPING:Threads::Threads
-- SKIPPING:Threads::Threads
-- SKIPPING:Threads::Threads
-- SKIPPING:Threads::Threads
-- SKIPPING:Threads::Threads
-- SKIPPING:Threads::Threads
-- SKIPPING:Threads::Threads
-- SKIPPING:Threads::Threads
-- SKIPPING:Threads::Threads
-- SKIPPING:Threads::Threads
-- SKIPPING:Threads::Threads
-- SKIPPING:Threads::Threads
-- SKIPPING:Threads::Threads
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jyb/workspace/aws-sdk-cpp/build
  1. make -j12
  2. sudo make install

rv1126编译遇到的问题

交叉编译用到的cmake选项

 _compiler_path_rv1126:  /home/jyb/libsrc/src/scripts/../../compiler/build_rv1126
Using Platform [rv1126]
Try using toolchain path: /home/jyb/libsrc/src/scripts/../../compiler/build_rv1126/toolchain.cmake
Toolchain File Found OK!!
 ############### using config: [ config_rv1126.rc ] !! ###################
PATH_TO_TOOLCHAIN = /home/jyb/libsrc/src/scripts/../../compiler/build_rv1126
ROOT_SRC          = /home/jyb/libsrc/src/scripts/..
Prefix            = /home/jyb/libsrc/src/scripts/../../libs/build_rv1126
SYS_NAME          = Linux
SYS_PROCESSOR     = arm
HOST              = arm-linux-gnueabihf
CC                = arm-linux-gnueabihf-gcc
LD                = 
CXX               = arm-linux-gnueabihf-g++
SYS_ROOT          = /home/jyb/libsrc/src/scripts/../../compiler/build_rv1126/rv1126-toolchain/usr
ToolChainFile     = /home/jyb/libsrc/src/scripts/../../compiler/build_rv1126/toolchain.cmake
ToolChain         = /home/jyb/libsrc/src/scripts/../../compiler/build_rv1126/rv1126-toolchain
PATH              = /home/jyb/libsrc/src/scripts/../../compiler/build_rv1126/rv1126-toolchain/usr/bin:/home/kongshui/anaconda3/bin:/home/jyb/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/jyb/.local/share/JetBrains/Toolbox/scripts:/home/jyb/go/bin
LDFLAGS           =  -L/home/jyb/libsrc/src/scripts/../../libs/build_rv1126/lib -L/home/jyb/libsrc/src/scripts/../../compiler/build_rv1126/rv1126-toolchain/usr/lib -ldl -lm -pthread -fPIC 
CFLAGS            =     -I/home/jyb/libsrc/src/scripts/../../libs/build_rv1126/include -O3 -g0   -fPIC     -fPIC -mfloat-abi=hard  -mfpu=neon-vfpv4  
CXXFLAGS          = -I/home/jyb/libsrc/src/scripts/../../libs/build_rv1126/include -O3 -g0   -fPIC  -fPIC -mfloat-abi=hard  -mfpu=neon-vfpv4 
compile_cores     = 12
enable_asan       = 0
enable_stl_dbg    = 0
enable_dbg        = 0
enable_shared     = 0

S3代码内部遇到重定义的修改

+++ b/aws-cpp-sdk-core/include/aws/core/endpoint/DefaultEndpointProvider.h
@@ -111,6 +111,6 @@ namespace Aws
         };

         // Export symbol from the DLL:
-        template class AWS_CORE_API DefaultEndpointProvider<Aws::Client::GenericClientConfiguration</*HasEndpointDiscovery*/ true> >;
+//        template class AWS_CORE_API DefaultEndpointProvider<Aws::Client::GenericClientConfiguration</*HasEndpointDiscovery*/ true> >;
     } // namespace Endpoint
 } // namespace Aws
diff --git a/aws-cpp-sdk-core/include/aws/core/endpoint/EndpointProviderBase.h b/aws-cpp-sdk-core/include/aws/core/endpoint/EndpointProviderBase.h
index 29b67626e3..c93dadc95e 100644
--- a/aws-cpp-sdk-core/include/aws/core/endpoint/EndpointProviderBase.h
+++ b/aws-cpp-sdk-core/include/aws/core/endpoint/EndpointProviderBase.h
@@ -71,6 +71,6 @@ namespace Aws
         };

         // Export symbol from the DLL:
-        template class AWS_CORE_API EndpointProviderBase<Aws::Client::GenericClientConfiguration</*HasEndpointDiscovery*/ true> >;
+//        template class AWS_CORE_API EndpointProviderBase<Aws::Client::GenericClientConfiguration</*HasEndpointDiscovery*/ true> >;
     } // namespace Endpoint
 } // namespace Aws
diff --git a/aws-cpp-sdk-s3/include/aws/s3/S3EndpointProvider.h b/aws-cpp-sdk-s3/include/aws/s3/S3EndpointProvider.h
index 5b2f47e00f..d605849a5d 100644
--- a/aws-cpp-sdk-s3/include/aws/s3/S3EndpointProvider.h
+++ b/aws-cpp-sdk-s3/include/aws/s3/S3EndpointProvider.h
@@ -82,11 +82,11 @@ namespace Endpoint
 /**
  * Export endpoint provider symbols from DLL
  */
-template class AWS_S3_API
-    Aws::Endpoint::EndpointProviderBase<S3::Endpoint::S3ClientConfiguration, S3::Endpoint::S3BuiltInParameters, S3::Endpoint::S3ClientContextParameters>;
-
-template class AWS_S3_API
-    Aws::Endpoint::DefaultEndpointProvider<S3::Endpoint::S3ClientConfiguration, S3::Endpoint::S3BuiltInParameters, S3::Endpoint::S3ClientContextParameters>;
+//template class AWS_S3_API
+//    Aws::Endpoint::EndpointProviderBase<S3::Endpoint::S3ClientConfiguration, S3::Endpoint::S3BuiltInParameters, S3::Endpoint::S3ClientContextParameters>;
+//
+//template class AWS_S3_API
+//    Aws::Endpoint::DefaultEndpointProvider<S3::Endpoint::S3ClientConfiguration, S3::Endpoint::S3BuiltInParameters, S3::Endpoint::S3ClientContextParameters>;
 } // namespace Endpoint

 namespace S3

What is curl error 77 problem with the SSL CA cert?

  1. 下载最新的CA证书到rv1126平台https://curl.se/docs/caextract.html
  2. 代码内部clientConfig.caPath和clientConfig.caFile设置CA证书
    clientConfig.caPath = "/mnt/udisk/AWS_S3/";
    clientConfig.caFile = "/mnt/udisk/AWS_S3/cacert.pem";

Curl error: 28

如果regionaccessKeyIdsecretKey这三个值输入都正确,那么可以考虑将Aws::SDKOptions的loggingOptions.logLevel改为Aws::Utils::Logging::LogLevel::Trace查看更消息的log。
我这边就是发现提示因为rv1126平台连的美国的网,然后S3的服务器选的"ap-northeast-2",导致时间戳同步一直有问题。
clientConfig.connectTimeoutMs改大一些就可以,比如改成30000ms。
https://github.com/aws/aws-sdk-cpp/issues/906

posted @ 2022-12-22 18:01  空水  阅读(616)  评论(0编辑  收藏  举报