OpenSSL在Linux中的跨平台使用主要涉及安装、配置及开发适配,核心要点如下:
apt-get install openssl libssl-dev
,CentOS/RHEL用yum install openssl-devel
。./config --prefix=/安装路径
,再make && make install
,可指定架构(如--cross-compile-prefix=arm-linux-
实现交叉编译)。-I
)和库文件路径(-L
),如gcc -I/usr/include/openssl -L/usr/lib/x86_64-linux-gnu -lssl -lcrypto
。LD_LIBRARY_PATH
或通过/etc/ld.so.conf.d/
配置。find_package(OpenSSL REQUIRED)
定位库文件。openssl version
确认当前版本,避免兼容性问题。