九色国产,午夜在线视频,新黄色网址,九九色综合,天天做夜夜做久久做狠狠,天天躁夜夜躁狠狠躁2021a,久久不卡一区二区三区

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
AWS CPP SDK 編譯鏈接

728 x 394960 x 520

AWS scheme

modify date:2018.03.22

[TOC]

AWS 庫編譯

To use the AWS SDK for C++, you need:

  • Visual Studio 2013 or later

    ? Note:Visual Studio 2013 doesn't provide default move constructors and operators. Later versions of Visual Studio provide a standards-compliant compiler.

  • or GNU Compiler Collection (GCC) 4.9 or later

  • or Clang 3.3 or later

  • A minimum of 4 GB of RAM

(-dev packages) for libcurl, libopenssl, libuuid, zlib

cmake version > 3.0

unix 編譯依賴

  • libz
  • curl
  • openssl
  • libuuid

Ubuntu 安裝開發(fā)庫 sudo apt-get install libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev libpulse-dev

openssluuidzlibcurl

CentOS

安裝新版本 gcc 和 gdb

# 1. Install a package with repository for your system:# On CentOS, install package centos-release-scl available in CentOS repository:$ sudo yum install centos-release-scl# On RHEL, enable RHSCL repository for you system:$ sudo yum-config-manager --enable rhel-server-rhscl-7-rpms# 2. Install the collection:$ sudo yum install devtoolset-7# 3. Start using software collections:$ scl enable devtoolset-7 bash

安裝 cmake

yum install llvm-toolset-7

ccmake-命令行界面,交互模式。

安裝 libz,curl,openssl 和 libuuid 的 devel 版

只編譯部分模塊

通過 cmake 配置生成模塊,cmake /mnt/hd03.d/xdu.d/aws/source/aws-sdk-cpp -DBUILD_ONLY="s3"

  • BUILD_SHARED_LIBS,是否生成動態(tài)庫。ON 動態(tài)庫,OFF 靜態(tài)庫
  • CMAKE_BUILD_TYPE,生成類型,Relaese,Debug -DCMAKE_BUILD_TYPE=Release
cmake /mnt/hd03.d/xdu.d/aws/source/aws-sdk-cpp  -DBUILD_ONLY="core;s3;transfer"  -DBUILD_SHARED_LIBS="OFF" -DCMAKE_BUILD_TYPE=Release

動態(tài)庫

cmake /mnt/hd03.d/xdu.d/aws/source/aws-sdk-cpp  -DBUILD_ONLY="core;s3;transfer"  -DBUILD_SHARED_LIBS="ON" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-fPIC -DCMAKE_C_FLAGS=-fPIC

鏈接

動態(tài)鏈接需要定義 USE_IMPORT_EXPORT

If you dynamically link to the SDK you will need to define the USE_IMPORT_EXPORT symbol for all build targets using the SDK

GCC: what are the --start-group and --end-group command line options?

It is for resolving circular dependences between several libraries

Impossible to link static libraries with circular dependencies

在 aws 的靜態(tài)庫中,有循環(huán)引用問題。

In a project we have multiple static libraries (build using cdt), two of which have circular dependencies to each other, that link together into an executable (also built using cdt).

With the "GCC C Linker" selected it's impossible to build that file. The linker complains about missing references when the static libraries are simply added in the "C/(C++ Build -> Settings -> GCC C Linker -> Libraries" tab, because references of the library that appears last on the generated command line has undefined references.

The solution would be to add "--start-group -lX -lY --end-group" to the linker command line after the list of the object files. But that's simply not possible. The additional linker options (both the "Linker flags" and "Other options (-Xlinker [option])" fields) that can be specified on the "GCC C Linker -> Miscellaneous" tab are added to the command line before the object, which has essentially no effect.

N.B. In our project I have installed a (dirty) workaround: I have added the linker options (-Wl,--start-group,-lX,-lY,--end-group) to the "Other objects" field (and added a dummy make rule in makefile.init so make won't complain about it) to force CDT to put it after the list of objects. It works but is really ugly.

使用 GCC 可將鏈接參數(shù)傳遞給鏈接器使用 -Wl,--start-group-Wl,--end-group

-Wl,--start-group  -laws-cpp-sdk-core -laws-cpp-sdk-s3 -laws-cpp-sdk-transfer-Wl,--end-group
//linux makefileCC = g++CCFLAGS = -DNDEBUG  -std=c++11 -O0INCLUDE := -I../LDFLAGS := -L../aws/bin/linux/static -Wl,-rpath ./ -Wl,-rpath ../aws/bin/linux/dynamicLIBS  := -lcurl -pthread -lcrypto -Wl,--start-group -laws-cpp-sdk-core -laws-cpp-sdk-s3 -laws-cpp-sdk-transfer -Wl,--end-groupmake: main        rm *.o        @echo successmain:        $(CC) $(CCFLAGS) $(INCLUDE) -c -o main.o main.cpp        $(CC) $(CCFLAGS) $(INCLUDE) $(LDFLAGS) -o transfer main.o $(LIBS)

Mac 下不需要 -pthread -lcrypto

查看動態(tài)庫依賴

readelf -d libbar.so

$ readelf -d ../aws/bin/linux/dynamic/libaws-cpp-sdk-transfer.soDynamic section at offset 0x29c38 contains 36 entries:  Tag        Type                         Name/Value 0x0000000000000001 (NEEDED)             Shared library: [libaws-cpp-sdk-s3.so] 0x0000000000000001 (NEEDED)             Shared library: [libaws-cpp-sdk-core.so] 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0] 0x0000000000000001 (NEEDED)             Shared library: [libcurl.so.4] 0x0000000000000001 (NEEDED)             Shared library: [libssl.so.10] 0x0000000000000001 (NEEDED)             Shared library: [libcrypto.so.10] 0x0000000000000001 (NEEDED)             Shared library: [libz.so.1] 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6] 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6] 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1] 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6] 0x000000000000000e (SONAME)             Library soname: [libaws-cpp-sdk-transfer.so]

從靜態(tài)庫合并為動態(tài)庫

gcc -shared -o libmerge.so -Wl,--whole-archive libaws-cpp-sdk-core.a libaws-cpp-sdk-s3.a libaws-cpp-sdk-transfer.a -Wl,--no-whole-archive

windows 編譯鏈接 aws lib

使用 cmake 生成工程,到生成庫目錄下,此處打開PowerShell 然后運行指令

& "E:\Software Install\cmake-3.11.0-rc3-win64-x64\cmake-3.11.0-rc3-win64-x64\bin\cmake" E:\libs\aws-sdk-cpp-1.4.11 -DBUILD_ONLY="transfer" -DBUILD_SHARED_LIBS=ON -DSTATIC_LINKING=1 -DTARGET=WINDOWS -G "Visual Studio 15 2017"

windows 靜態(tài)鏈接 aws static lib 需要依賴于幾個系統(tǒng)靜態(tài)庫

 winhttp.lib wininet.lib bcrypt.lib userenv.lib Version.lib

靜態(tài)鏈接出現(xiàn) GetObjectA/GetObjectW 錯誤,由于 wingdi.h 中定義了

//wingdi.h#ifdef UNICODE#define GetObject  GetObjectW#else#define GetObject  GetObjectA#endif // !UNICODE

S3Client.h 被包含之前取消 GetObject 定義

//on windows visual studio//undef GetObject to avoid marco conflict#if defined _WIN32 && defined GetObject#undef GetObject#endif
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
GCC/G++快速使用指南
Linux靜態(tài)鏈接(庫)、動態(tài)鏈接(庫)、可執(zhí)行文件加載相關(guān)問題(創(chuàng)建、選項、環(huán)境變量等)
gcc/g++ 鏈接庫的編譯與鏈接
Linux下C語言動態(tài)庫、靜態(tài)庫的制作(轉(zhuǎn)載)
動態(tài)庫靜態(tài)庫鏈接問題
C 程序編譯之謎(二)——隱藏源碼,動態(tài)和靜態(tài)鏈接庫的秘密
更多類似文章 >>
生活服務(wù)
熱點新聞
分享 收藏 導長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服