我在嘗試使用openssl for android x-86編譯c程序時遇到以下問題。我設置環境變量使用下面的腳本如下:用openssl for Android交叉編譯c程序
運行腳本我有以下的環境之後。
./setenv-android_x86.sh find: /dev/fd/3: Not a directory find: /dev/fd/4: Not a directory Error: FIPS_SIG does not specify incore module. Please edit this script. ANDROID_NDK_ROOT: /opt/android-ndk-r9d-x86 ANDROID_ARCH: arch-x86 ANDROID_EABI: x86-4.6 ANDROID_API: android-18 ANDROID_SYSROOT: /opt/android-ndk-r9d-x86/platforms/android-18/arch-x86 ANDROID_TOOLCHAIN: /opt/android-ndk-r9d-x86/toolchains/x86-4.6/prebuilt/darwin-x86_64/bin FIPS_SIG: CROSS_COMPILE: i686-linux-android- ANDROID_DEV: /opt/android-ndk-r9d-x86/platforms/android-18/arch-x86/usr
但是嘗試使用以下命令我碰到下面的錯誤編譯時:
pwd /opt/android-ndk-r9d-x86/bin
./i686-linux-android-gcc Test.c -o test -lcrypto
fatal error: openssl/conf.h: No such file or directory
當我找到對的OpenSSL/conf.h我看到文件可以在許多地方:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/openssl/conf.h /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/openssl/conf.h /data/local/arm/ssl/include/openssl/conf.h /data/local/ssl/include/openssl/conf.h /openssl/include/openssl/conf.h /openssl-1.0.1e/include/openssl/conf.h /openssl-1.0.1g/include/openssl/conf.h /opt/local/include/openssl/conf.h /usr/include/openssl/conf.h /usr/local/include/openssl/conf.h /usr/local/ssl/android-14/include/openssl/conf.h /usr/local/ssl/android-18/include/openssl/conf.h
/usr/local/ssl/android-18-x86/include/openssl/conf.h /usr/local/ssl/include/openssl/conf.h
我認爲正確的路徑是這樣的:
在/ usr/LO cal/ssl/android-18-x86/include/openssl/conf.h
我嘗試使用-L選項,但沒有運氣。
-L在/ usr /本地/ SSL/Android的18-86 /包括/
可有人請解釋如何設置正確的路徑來解決這個問題。 (最後C代碼沒有問題,因爲它使用gcc編譯正常)
你試過「-I/usr/local/ssl/android-18-x86/include /」嗎? -L用於將目錄添加到庫搜索路徑,-I(大寫字母i)用於將目錄添加到包含搜索路徑。 – crazymaik 2015-01-26 22:38:07
我現在試過了 - 我沒有工作。雖然它給了比以前更多的錯誤...... – user340 2015-01-26 22:57:48