export CC=/home/hk/Desktop/sixin/gcc-4.9/bin/mips-linux-gcc
export CXX=/home/hk/Desktop/sixin/gcc-4.9/bin/mips-linux-g++
export AR=/home/hk/Desktop/sixin/gcc-4.9/bin/mips-linux-ar
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/hk/Desktop/sixin/gcc-4.9/lib
1.设置交叉编译环境。
2.执行以下命令配置编译选项。 --prefix=
后面跟的是编译出来的库的安装目录,需要根据实际情况设置,--host=
后面的内容根据交叉编译工具设置。
./configure --host=arm-linux-gnueabihf --prefix=/home/hk/Desktop/moxa/sqlite-autoconf-3071600/out
make #编译
make install #安装
1.设置交叉编译环境。
2.执行以下命令配置编译选项。 --prefix=
后面跟的是编译出来的库的安装目录,需要根据实际情况设置。
编译静态库,linux:‘arm-linux-gnueabihf-gcc‘
中arm-linux-gnueabihf-gcc
根据交叉编译工具设置。
./Configure linux-elf-arm -DB_ENDIAN linux:'arm-linux-gnueabihf-gcc' --prefix=[输出路径]
make
make install
编译动态库
./config -fPIC no-asm -shared --prefix=/home/hk/Desktop/openssl-1.0.0/out
# 配置完成之后需要修改makefile,将makefile中的 -m64 删除。
make
make install
注意:尽量使用静态库,动态库有时会出错。
1.设置交叉编译环境。
2.执行以下命令配置编译选项。 --prefix=
后面跟的是编译出来的库的安装目录,需要根据实际情况设置。
3.CPPFLAGS="-I/usr/local/Cellar/openssl/1.0.2h_1/include"
为openssl头文件目录,LDFLAGS=LDFLAGS="-L/usr/local/Cellar/openssl/1.0.2h_1/lib -lssl -lcrypto"
是编译出来的openssl库目录,需要根据实际情况设置。
./configure --host=arm-linux CPPFLAGS="-I/usr/local/Cellar/openssl/1.0.2h_1/include" LDFLAGS="-L/usr/local/Cellar/openssl/1.0.2h_1/lib -lssl -lcrypto" --prefix=/usr/local
make
make install
1.设置交叉编译环境。
2.修改makefile ,在129行添加如下,CFLAGS += -I
后面的内容为openssl头文件目录,LDFLAGS += -L
是编译出来的openssl库目录,需要根据实际情况设置。
# 修改makefile ,在129行添加如下, -I参数后面的内容为 交叉编译openssl库安装目录
CFLAGS += -I./../openssl-1.1.0g/install/include
LDFLAGS += -L./../openssl-1.1.0g/install/lib
#修改后执行make命令编译
make
3.编译完成后,会在当前目录创建build目录,进入build目录,里面有一个output目录和一个版本头文件,output目录中存放着编译出来的库文件,examples和测试程序。
config.mk
文件。
WITH_TLS、WITH_TLS_PSK、WITH_SRV、WITH_UUID 、WITH_DOCS
设置为 nopaho.mqtt.c
,openssl
头文件和库目录,如下所示:# -I参数后面的内容为paho.mqtt.c库和openssl头文件目录,-L参数后面的内容为编译好的paho.mqtt.c库和openssl库目录 ,注意: 实际修改时需要不使用[]。
CFLAGS += -I[paho.mqtt.c源代码目录下的src目录] -I[openssl头文件目录]
LDFLAGS += -L[编译处的paho.mqtt.c库目录] -L[编译出来的openssl库目录] -lssl -lcrypto
Sqlite,libevent,openssl,mosquito交叉编译
原文:https://www.cnblogs.com/ay-a/p/10459065.html