尝试链接我的项目时遇到了麻烦:
arm-linux-gnueabihf/bin/ld: ~/libcrypto_t.a(mem_dbg.o): relocation R_ARM_THM_MOVW_ABS_NC against 'a local symbol' an not be used when making a shared object; recompile with -fPIC
libcrypto_t.a: could not read symbols: Bad value
所以我想我没有将 openssl 构建为共享对象。我厌倦了这样做
export cross=arm-linux-gnueabihf-
cd openssl-1.0.1e
./Configure dist --prefix=$HOME/opensslArm
make CC="${cross}gcc" AR="${cross}ar r" RANLIB="${cross}ranlib" CFLAGS="-fPIC" CXXFLAGS="-fPIC"
但是我马上遇到了一个错误(如果我省略了 CFLAGS 和 CXXFLAGS 它编译得很好):
making all in crypto...
make[1]: Entering directory `/home/dev/openssl-1.0.1e/crypto'
( echo "#ifndef MK1MF_BUILD"; \
echo ' /* auto-generated by crypto/Makefile for crypto/cversion.c */'; \
echo ' #define CFLAGS "/home/linuxonarm/armv7_devel/dl/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin/arm-linux-gnueabihf-gcc -O"'; \
echo ' #define PLATFORM "dist"'; \
echo " #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \
echo '#endif' ) >buildinf.h
/home/linuxonarm/armv7_devel/dl/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin/arm-linux-gnueabihf-gcc -fPIC -c -o cryptlib.o cryptlib.c
In file included from cryptlib.c:117:0:
cryptlib.h:65:18: fatal error: e_os.h: No such file or directory
compilation terminated.
make[1]: *** [cryptlib.o] Error 1
make[1]: Leaving directory `/home/dev/openssl-1.0.1e/crypto'
make: *** [build_crypto] Error 1