rockpro64带有gcc编译器,省去了搭建交叉编译工具
官方文档:https://help.aliyun.com/document_detail/32132.html?spm=a2c4g.11186623.6.1307.52744697sPTYKH
1. 编译apr和apr-util
1.1 从https://apr.apache.org/download.cgi下载apr和apr-util的最新包
1.2 先编译apr,我没有自定义目录,用了系统默认目录
./configure
make
sudo make install
1.3 编译好apr后,如果此时直接编译oss(cmake . -DCMAKE_BUILD_TYPE=Release),就会报apu-config缺失的错误,所以还需要编译apr-util
felix@rockpro64:~/Desktop/aliyun-oss-c-sdk$ cmake . -DCMAKE_BUILD_TYPE=Release
CMake Error at CMakeLists.txt:94 (MESSAGE):
Could not find apu-config/apu-1-config
-- Configuring incomplete, errors occurred!
1.4 编译apr-util的时候,直接./configure不带参数会报错
checking for APR... no
configure: error: APR could not be located. Please use the --with-apr option.
1.5 apr-util编译需要依赖上一步编好的apr,需要在编译参数上指定apr目录
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make
sudo make install
1.4 上面 的编译依然会报下面的错误,
xml/apr_xml.c:35:10: fatal error: expat.h: No such file or directory
#include <expat.h>
^~~~~~~~~
compilation terminated.
1.5 这是因为缺少expat库,解决上面的问题,如下
#debian system
sudo apt install libexpat1-dev
#redhat
yum install expat-devel
1.6 安装完expat之后,继续回到apr-util执行make,编译通过
1.7 回到aliyun-oss继续编译,依然会报错
felix@rockpro64:~/Desktop/aliyun-oss-c-sdk$ cmake . -DCMAKE_BUILD_TYPE=Release
CMake Error at CMakeLists.txt:107 (MESSAGE):
Could not find curl-config
-- Configuring incomplete, errors occurred!
See also "/home/felix/Desktop/aliyun-oss-c-sdk/CMakeFiles/CMakeOutput.log".
1.8 可能是curl没编译,下面去http://curl.haxx.se/download.html下载curl的源码编译
以上方法可能编不出来。。。。。。