交叉编译configure后不能生成静态库
configure完了之后显示:
checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
Libtool claims it does not support shared libraries during cross compilation
因为configure中指定的–host=arm,libtool会将--host=arm
等同于-host=arm-unknown-none
,所以用--host=arm-none-linux
代替就可以了,arm-unknown-none是用于static链接,即使指定了–enable-static=no --enable-shared=yes也是没用的。
在无交叉编译环境中执行autoreconf
无交叉编译环境,就是说我的host是ubuntu,在已经配置好交叉编译的环境中如何回到没有配置前的状态去执行命令,这个找了一下通过env命令就可以解决:
env -i HOME="$HOME" bash -c 'autoreconf --install'
env -i HOME="$HOME" bash -l -c 'your_command'
提供一个新的bash环境运行后面的命令,-c参数后面跟命令
bash -l
不会加载.bash_profile
参考链接:Runing a command without inheriting parent’s environment
所以在我的使用场景中,因为前面的编译已经配置好了交叉编译环境,需要运行autoreconf的时候,在交叉编译环境下是有问题的,所以通过命令env -i HOME="$HOME" bash -c 'autoreconf --install'
,方便的执行了autoreconf,这里是需要加载.bash_profile
文件,所以去掉了-l参数。
shell里面赋值语句=前面不能有空格
export LDFLAGS='-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now -ldrm -L${SYSROOT}/usr/lib/gstreamer-1.0 -Wl,-rpath -Wl,/usr/lib/gstreamer-1.0'
在LDFLAGS后面的等号之间不小心,写了空格,LDFLAGS就不起作用了。