2016-07-28 109 views
2

我試圖構建Android NDK,它給了我這個錯誤。 即時通訊使用eclipse。 即時通訊使用android-ndk-r12。並且在eclipse中的Android NDK偏好是C:\ android-ndk-r12(我也嘗試過「C:\ android-ndk-r12 \ build」,並且它無法工作)。和Android Android.mk是如下:Android NDK給出了這個錯誤使錯誤2

LOCAL_PATH := $(call my-dir) 

include $(CLEAR_VARS) 

LOCAL_MODULE := com_example_ndktest_Store 
LOCAL_SRC_FILES := com_example_ndktest_Store.cpp 

include $(BUILD_SHARED_LIBRARY) 

的錯誤是如下:

[armeabi-v7a] "Compile++ arm ": "com_example_ndktesting_Store <= com_example_ndktesting_Store.cpp" 
process_begin: CreateProcess(NULL, C:/android-ndk-r12/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -MMD -MP -MF ./obj/local/armeabi-v7a/objs/com_example_ndktesting_Store/com_example_ndktesting_Store.o.d -gcc-toolchain C:/android-ndk-r12/build//../toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64 -fpic -ffunction-sections -funwind-tables -fstack-protector-strong -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -no-canonical-prefixes -fno-integrated-as -g -target armv7-none-linux-androideabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-exceptions -fno-rtti -marm -O2 -DNDEBUG -IC:/android-ndk-r12/build//../sources/cxx-stl/gnu-libstdc++/4.9/include -IC:/android-ndk-r12/build//../sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -IC:/android-ndk-r12/build//../sources/cxx-stl/gnu-libstdc++/4.9/include/backward -Ijni -DANDROID -mfpu=vfp -mfloat-abi=softfp -fno-short-enums -Werror -DANDROID -DDISABLE_IMPORTGL -isystem /usr/include/ -Wa,--noexecstack -Wformat -Werror=format-security -std=gnu++0x -frtti -fexceptions -DANDROID -isystem C:/android-ndk-r12/build//../platforms/android-24/arch-arm/usr/include -c jni/com_example_ndktesting_Store.cpp -o ./obj/local/armeabi-v7a/objs/com_example_ndktesting_Store/com_example_ndktesting_Store.o, ...) failed. 
make (e=2): The system cannot find the file specified. 
make: *** [obj/local/armeabi-v7a/objs/com_example_ndktesting_Store/com_example_ndktesting_Store.o] Error 2 
+0

由錯誤信息來看,它看起來像你的路徑編譯器可執行文件不正確。你仔細檢查過它嗎? – zenzelezz

+0

@zenzelezz我編輯了我的問題。如果可以,請你幫助我。 – Shahryar

+0

如果你打開一個Windows命令提示符並輸入'C:/ android-ndk -r12/toolchains/llvm/prebuilt/windows-x86_64/bin/clang ++ .exe',那麼這也會出錯?預編譯後的 – zenzelezz

回答

1

1 - 請確保您有NDK的正確版本: 如果使用32位Windows ,你應該下載並安裝android-ndk-r12-windows-x86.zip,如果你使用64位Windows,你應該下載並安裝android-ndk-r12-windows-x86_64.zip

2-定義合適的工具鏈: 你確定鏗鏘聲++。exe是在指定的路徑中找到的,這個ndk版本有這個工具鏈嗎? 嘗試在Android.mk文件中將NDK_TOOLCHAIN_VERSION(示例NDK_TOOLCHAIN_VERSION:= clang3.3)設置爲在ndk-r12中找到的正確工具鏈。 Android開發文檔:

NDK_TOOLCHAIN_VERSION 
Define this variable as either 4.9 or 4.8 to select a version of the GCC compiler. Version 4.9 is the default for 64-bit ABIs, and 4.8 is the default for 32-bit ABIs. To select a version of Clang, define this variable as clang3.4, clang3.5, or clang. Specifying clang chooses the most recent version of Clang. 
+0

我改變了這樣的路徑: C:\ android-ndk-r12 \ toolchains \ aarch64-linux-android-4.9 \ prebuilt \ windows-x86_64 for each toolchain。 – Shahryar