环境:Ubuntu
安装准备:
安装CMake和第三方库
OSS C SDK安装时,需要安装编译工具CMake和第三方库curl、apr、apr-util、minixml。
安装环境时所需参数如下:
名称 描述 版本要求
CMake 编译安装工具。 2.6.0及以上版本
curl 主要解决网络方面的问题。 7.32.0 及以上版本
apr-util 解决内存管理以及跨平台问题。 1.5.2 及以上版本
minixml 解析请求返回的xml。 推荐使用 v2.9 版本
安装CMake
sudo apt-get install cmake
安装第三方库
sudo apt-get install libcurl4-openssl-dev libapr1-dev libaprutil1-dev libmxml-dev
下载SDK
通过GitHub下载
安装SDK
如果 curl、apr、apr-util 和 mxml 第三方库安装在默认路径下时,安装方式如下:
输入:cmake .
返回:
-- Configuring done
-- Generating done
-- Build files have been written to: /work/oss/csdk/aliyun-oss-c-sdk
输入:make
返回:
[ 24%] Built target oss_c_sdk
[ 48%] Built target oss_c_sdk_static
[ 73%] Built target oss_c_sdk_sample
[100%] Built target oss_c_sdk_test
输入:make install
返回错误:
[ 24%] Built target oss_c_sdk
[ 48%] Built target oss_c_sdk_static
[ 73%] Built target oss_c_sdk_sample
[100%] Built target oss_c_sdk_test
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/liboss_c_sdk.so.3.0.0
CMake Error at cmake_install.cmake:47 (FILE):
file INSTALL cannot copy file
"/work/oss/csdk/aliyun-oss-c-sdk/build/lib/liboss_c_sdk.so.3.0.0" to
"/usr/local/lib/liboss_c_sdk.so.3.0.0".
make: *** [install] Error 1
解决方法:
输入:sudo make install
返回结果:
[ 24%] Built target oss_c_sdk
[ 48%] Built target oss_c_sdk_static
[ 73%] Built target oss_c_sdk_sample
[100%] Built target oss_c_sdk_test
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/liboss_c_sdk.so.3.0.0
-- Installing: /usr/local/lib/liboss_c_sdk.so
-- Installing: /usr/local/lib/liboss_c_sdk_static.a
-- Installing: /usr/local/include/oss_c_sdk/aos_buf.h
-- Installing: /usr/local/include/oss_c_sdk/aos_define.h
-- Installing: /usr/local/include/oss_c_sdk/aos_fstack.h
-- Installing: /usr/local/include/oss_c_sdk/aos_http_io.h
-- Installing: /usr/local/include/oss_c_sdk/aos_list.h
-- Installing: /usr/local/include/oss_c_sdk/aos_log.h
-- Installing: /usr/local/include/oss_c_sdk/aos_status.h
-- Installing: /usr/local/include/oss_c_sdk/aos_string.h
-- Installing: /usr/local/include/oss_c_sdk/aos_transport.h
-- Installing: /usr/local/include/oss_c_sdk/aos_util.h
-- Installing: /usr/local/include/oss_c_sdk/aos_crc64.h
-- Installing: /usr/local/include/oss_c_sdk/oss_api.h
-- Installing: /usr/local/include/oss_c_sdk/oss_auth.h
-- Installing: /usr/local/include/oss_c_sdk/oss_define.h
-- Installing: /usr/local/include/oss_c_sdk/oss_resumable.h
-- Installing: /usr/local/include/oss_c_sdk/oss_util.h
-- Installing: /usr/local/include/oss_c_sdk/oss_xml.h