编译 && 运行
我们把 android-ndk-r19c 放置到 D:\android-ndk-r19c 这个位置,然后把 hello-exe 目录放到这里。然后我们 CMD 打开命令行窗口,切换到D:\android-ndk-r19c\hello-exe\jni,使用 ..\..\ndk-build.cmd -B V=1 执行,会看到如下内容:
Android NDK: APP_PLATFORM not set. Defaulting to minimum supported version android-16.
[armeabi-v7a] Compile thumb : hello-exe <= hello-exe.c
D:/android-ndk-r19c/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/ clang.exe -MMD -MP -MF D:/android-ndk-r19c/hello-exe/obj/local/armeabi-v7a/objs/hello-exe/hello-exe.o.d -target armv7-none-linux-androideabi16 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes --sysroot D:/android-ndk-r19c/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -fno-addrsig -fpic -mfpu=vfpv3-d16 -march=armv7-a -mthumb -Oz -DNDEBUG -ID:/android-ndk-r19c/hello-exe/jni -DANDROID -nostdinc++ -Wa,--noexecstack -Wformat -Werror=format-security -c D:/android-ndk-r19c/hello-exe/jni/hello-exe.c -o D:/android-ndk-r19c/hello-exe/obj/local/armeabi-v7a/objs/hello-exe/hello-exe.o
[armeabi-v7a] Executable : hello-exe
D:/android-ndk-r19c/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -Wl,--gc-sections -Wl,-rpath-link=D:/android-ndk-r19c/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/arm-linux-androideabi/16 -Wl,-rpath-link=D:/android-ndk-r19c/hello-exe/obj/local/armeabi-v7a D:/android-ndk-r19c/hello-exe/obj/local/armeabi-v7a/objs/hello-exe/hello-exe.o -lgcc -Wl,--exclude-libs,libgcc.a -latomic -Wl,--exclude-libs,libatomic.a -target armv7-none-linux-androideabi16 -no-canonical-prefixes -Wl,--build-id -nostdlib++ -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -fpic -fPIE -pie -lc -lm -o D:/android-ndk-r19c/hello-exe/obj/local/armeabi-v7a/hello-exe
[armeabi-v7a] Install : hello-exe => libs/armeabi-v7a/hello-exe
copy /b/y "D:\android-ndk-r19c\hello-exe\obj\local\armeabi-v7a\hello-exe" "D:\android-ndk-r19c\hello-exe\libs\armeabi-v7a\hello-exe" > NUL
D:/android-ndk-r19c/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/arm-linux-androideabi-strip --strip-unneeded D:/android-ndk-r19c/hello-exe/libs/armeabi-v7a/hello-exe
这里专门把编译过程打印了出来( V=1 )。跟这个差不多的是 --just-print 参数,不过 --just-print 是只打