cmake cannot exclude /usr/include when building for Android - android

I'm building parquet-cpp project on Ubuntu for Android using cmake 3.10 (by following tutorials "Cross Compiling for Android with a Standalone Toolchain" in this link). I got this error:
In file included from /usr/include/errno.h:28:
/usr/include/features.h:391:10: fatal error: 'gnu/stubs.h' file not found
#include <gnu/stubs.h>
I checked compiling command and found an argument -isystem /usr/include. I tried to exclude /usr/include from search paths but I failed. This is the full command:
<standalone_toolchain>/bin/clang++ --target=armv7-none-linux-androideabi --gcc-toolchain=<standalone_toolchain> --sysroot=<standalone_toolchain>/sysroot -DBOOST_ALL_DYN_LINK -DBOOST_TEST_DYN_LINK -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Dthriftz_EXPORTS -I<source_dir>/parquet-cpp/build/thrift_ep-prefix/src/thrift_ep-build/lib/cpp -I<source_dir>/parquet-cpp/build/thrift_ep-prefix/src/thrift_ep/lib/cpp -I<source_dir>/parquet-cpp/build/thrift_ep-prefix/src/thrift_ep-build -I<source_dir>/parquet-cpp/build/thrift_ep-prefix/src/thrift_ep/lib/cpp/src -isystem /usr/include -isystem <standalone_toolchain>/sysroot/usr/include -isystem <standalone_toolchain>/include/c++/4.9.x -isystem <standalone_toolchain>/include/c++/4.9.x/arm-linux-androideabi/bits -march=armv7-a -marm -mfpu=neon -mfloat-abi=softfp -funwind-tables -no-canonical-prefixes --sysroot <standalone_toolchain>/sysroot -Qunused-arguments -ggdb -O0 -g -fPIC -Wno-variadic-macros -Wno-long-long -Wno-c++11-long-long -Wno-deprecated-register -pthread -g -fPIC -std=c++11 -o CMakeFiles/thriftz.dir/src/thrift/transport/TZlibTransport.cpp.o -c <source_dir>/parquet-cpp/build/thrift_ep-prefix/src/thrift_ep/lib/cpp/src/thrift/transport/TZlibTransport.cpp
I've tried lots of ways I found out when googling (i.e. here and here) but nothing works.
Can anyone here help me? Note that I'm a newbie to cross compiling :(

if you mean by exclude is to delete:
then type this in the terminal --> sudo gksu nautilus a new file manager window will open were you can access all files as root, now reach you file then delete it.

Related

bz2 module fails when building Python 3.7

I'm trying to cross compile Python 3.7 for Android. I see in my output that bz2 if failing with the following error
building '_bz2' extension
/home/dematic/SPE/python3-android/sdk/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -isystem /home/dematic/SPE/python3-android/build/19c-22-aarch64-linux-androideabi-4.9/include -isystem /home/dematic/SPE/python3-android/build/19c-22-aarch64-linux-androideabi-4.9/include/openssl -no-integrated-as -I. -I./Include -target aarch64-none-linux-androideabi22 -target aarch64-none-linux-androideabi22 -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -I./Include -I. -I/home/dematic/SPE/python3-android/src/Python-3.7.3/Include -I/home/dematic/SPE/python3-android/src/Python-3.7.3 -c /home/dematic/SPE/python3-android/src/Python-3.7.3/Modules/_bz2module.c -o build/temp.linux-aarch64-3.7/home/dematic/SPE/python3-android/src/Python-3.7.3/Modules/_bz2module.o
/home/dematic/SPE/python3-android/sdk/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -isystem /home/dematic/SPE/python3-android/build/19c-22-aarch64-linux-androideabi-4.9/include -isystem /home/dematic/SPE/python3-android/build/19c-22-aarch64-linux-androideabi-4.9/include/openssl -no-integrated-as -shared -target aarch64-none-linux-androideabi22 -fuse-ld=lld -L /home/dematic/SPE/python3-android/build/19c-22-aarch64-linux-androideabi-4.9/lib -target aarch64-none-linux-androideabi22 -fuse-ld=lld -L /home/dematic/SPE/python3-android/build/19c-22-aarch64-linux-androideabi-4.9/lib -target aarch64-none-linux-androideabi22 -fuse-ld=lld -L /home/dematic/SPE/python3-android/build/19c-22-aarch64-linux-androideabi-4.9/lib -fPIC -target aarch64-none-linux-androideabi22 build/temp.linux-aarch64-3.7/home/dematic/SPE/python3-android/src/Python-3.7.3/Modules/_bz2module.o -L. -L/home/dematic/SPE/python3-android/build/19c-22-aarch64-linux-androideabi-4.9/lib -lbz2 -lpython3.7m -o build/lib.linux-aarch64-3.7/_bz2.cpython-37m.so
ld.lld: error: /home/dematic/SPE/python3-android/build/19c-22-aarch64-linux-androideabi-4.9/lib/libbz2.a(bzlib.o) is incompatible with aarch64linux
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am building bzip2 1.0.6 without any issues, but I assume I'm not linking to it correctly or some other issue. Is there some sort of other architecture I'm supposed to be building?
This is the project I'm trying to build with
https://github.com/GRRedWings/python3-android
I'm trying to cross compile Python 3.7 for Android. I see in my output that bz2 if failing with the following error
The Bzip2 makefiles are not written for cross-compiles. They effectively ignore a user's flags like CFLAGS and LDFLAGS. The makefiles actually blows away a user's CFLAGS and sets it to CFLAGS=-Wall -Winline -O2 -g $(BIGFILES). Your flags like -target aarch64-none-linux-androideabi22 are not used.
There are two Makefiles in play. One is called Makefile and it builds the static library, if I recall correctly. The second is Makefile-libbz2_so, and it build the shared object. You need to fix the omissions and apply the fixes to both makefiles.
You should probably use a patched Bzip like bzip2-noloader. It honors a user's CFLAGS, CXXFLAGS, LDFLAGS, etc. The check-in of interest is Commit 34d170f31106.
The makefile recipes in bzip2-noloader look similar to the following. They preserve Seward's original settings in BZIP_CFLAGS. But they also utilize CPPFLAGS and allow a user override in CFLAGS. The override will pickup your flags like -target aarch64-none-linux-androideabi22.
blocksort.o: blocksort.c
$(CC) $(CPPFLAGS) $(BZIP_CFLAGS) $(CFLAGS) -c blocksort.c
Programs use LDFLAGS as expected:
bzip2: libbz2.a bzip2.o
$(CC) $(CPPFLAGS) $(BZIP_CFLAGS) $(CFLAGS) $(LDFLAGS) -o bzip2 bzip2.o -L. -lbz2
Finally, the bzip2-noloader fork also honor's PREFIX, DESTDIR, etc. So you can perform staged installs, too.
I am building bzip2 1.0.6 without any issues ...
You are probably building for i686 or x86_64, and not Aarch64. The problem does not surface until link time. You can use objdump to inspect the object files, if interested.
Also note the makefile does this:
CC=gcc
AR=ar
RANLIB=ranlib
LDFLAGS=
You may need to tweak those variable assignments, too. Sometimes ar and ranlib use unusual names, like ranlib-5.0. And also be sure the tools are on-path.
The way to write makefiles to avoid these sorts of problems is detailed at 7.2.3 Variables for Specifying Commands in the GNU Coding Standards. The short of it is, (1) leave CFLAGS (and friends) for the user; and (2) if a flag is needed, then always supply it.
The GNU Coding Standards uses this as an example:
CFLAGS = -g
ALL_CFLAGS = -I. $(CFLAGS)
.c.o:
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
Users can override the default CFLAGS of -g, and -I is always added because it is needed for the compile.

CMAKE for android, how to include header files generated by subdirectory

I'm building a project that has https://github.com/j0r1/JRTPLIB as a subdirectory because I need to build some things in it first before I build my project. I added a dependency based on
add_subdirectory(../third_party/JRTPLIB jrtplib)
add_library(myRtspClient SHARED ${SOURCES})
add_dependencies(myRtspClient jrtplib-shared)
where jrtplib-shared is a target in ../third_party/JRTPLIB CMakeLists file.
As you can see here, some header files are generated and placed in an unconventional place. This place in my project is
android/app/.externalNativeBuild/cmake/debug/armeabi-v7a/jrtplib
where the jrtplib name comes from the line add_subdirectory(../third_party/JRTPLIB jrtplib)
note that it also generates the files into android/app/.externalNativeBuild/cmake/debug/x68/jrtplib
I need to include the header files generated in android/app/.externalNativeBuild/cmake/debug/armeabi-v7a/jrtplib or android/app/.externalNativeBuild/cmake/debug/x86/jrtplib into my project to finish the compilation.
I obviously tried include_directories(jrtplib) but it didn't work, files are not found.
So how am I supposed to include header files generated from a subdirectory?
UPDATE:
1 error generated.
FAILED: /android-sdk-linux/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=i686-none-linux-android --gcc-toolchain=/android-sdk-linux/ndk-bundle/toolchains/x86-4.9/prebuilt/linux-x86_64 --sysroot=/android-sdk-linux/ndk-bundle/sysroot -DmyRtspClient_EXPORTS -I/home/project/src/jscam/myRtspClient/myRtspClient/include -I/home/project/src/jscam/myRtspClient/myRtspClient/../third_party/Base64_live555/include -I/home/project/src/jscam/myRtspClient/myRtspClient/../third_party/md5/include -Ijrtplib/src -isystem /android-sdk-linux/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /android-sdk-linux/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include -isystem /android-sdk-linux/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -isystem /android-sdk-linux/ndk-bundle/sysroot/usr/include/i686-linux-android -D__ANDROID_API__=16 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -Wa,--noexecstack -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIC -MD -MT CMakeFiles/myRtspClient.dir/MediaSession.cpp.o -MF CMakeFiles/myRtspClient.dir/MediaSession.cpp.o.d -o CMakeFiles/myRtspClient.dir/MediaSession.cpp.o -c /home/project/src/jscam/myRtspClient/myRtspClient/MediaSession.cpp
In file included from /home/project/src/jscam/myRtspClient/myRtspClient/MediaSession.cpp:17:
/home/project/src/jscam/myRtspClient/myRtspClient/include/myRtpSession.h:19:10: fatal error: 'rtpsession.h' file not found
#include "rtpsession.h"
^~~~~~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.

Very Strange Error When Building an Android ROM image (based on AOSP)

When I build the Android 4.3 ROM image for a Nexus 10 device (ARM7a) using the Android Open Source Project (AOSP) guidelines, the image works fine with no problem. However, when I add the following inline assembly code (adapted from here) to the Android Stack.cpp source file:
{uint32_t pmccntr;asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(pmccntr));t0=static_cast<int64_t>(pmccntr) * 64;}
//The C++ statement to measure its execution time
{uint32_t pmccntr;asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(pmccntr));t1=static_cast<int64_t>(pmccntr) * 64;}
time = t1-t0;
I get the follwong compiler error message:
Error: no such instruction: `mrc p15,0,%eax,c9,c13,0'
Notice that I never used eax in my added inline assembly code, however, the compiler error message shows eax.
According to the command line adb shell cat /proc/cpuinfo,
my device CPU is ARMv7 Processor rev 4 (v7l)
My build environment (according to the Android build mm command inside the directory /dalvik/vm/interp/ which contains the Stack.cpp file) is
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.3
TARGET_PRODUCT=full_manta
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a15
HOST_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.16.0-70-generic-x86_64-with-Ubuntu-14.‌​04-trusty
HOST_BUILD_TYPE=release
BUILD_ID=JWR66V
OUT_DIR=out
Update#1
Below are the compiler's commands that are used when compiling the Stack.cpp file which are shown using the build command make -j4 libdvm showcommands
It seems that the correct compiler is used as shown highlighted in bold below:
target thumb C++: libdvm <= dalvik/vm/interp/Stack.cpp
prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-g++ -I libnativehelper/include/nativehelper -I dalvik -I dalvik/vm -I external/zlib -I libcore/include -I dalvik/libattr -I external/stlport/stlport -I bionic/ -I bionic/libstdc++/include -I dalvik/vm -I out/target/product/manta/obj/SHARED_LIBRARIES/libdvm_intermediates -I libnativehelper/include/nativehelper -isystem system/core/include -isystem hardware/libhardware/include -isystem hardware/libhardware_legacy/include -isystem hardware/ril/include -isystem libnativehelper/include -isystem frameworks/native/include -isystem frameworks/native/opengl/include -isystem frameworks/av/include -isystem frameworks/base/include -isystem external/skia/include -isystem out/target/product/manta/obj/include -isystem bionic/libc/arch-arm/include -isystem bionic/libc/include -isystem bionic/libc/kernel/common -isystem bionic/libc/kernel/arch-arm -isystem bionic/libm/include -isystem bionic/libm/include/arm -isystem bionic/libthread_db/include -c -fno-exceptions -Wno-multichar -msoft-float -fpic -fPIE -ffunction-sections -fdata-sections -funwind-tables -fstack-protector -Wa,--noexecstack -Werror=format-security -D_FORTIFY_SOURCE=1 -fno-short-enums -mcpu=cortex-a15 -mfloat-abi=softfp -mfpu=neon -include build/core/combo/include/arch/linux-arm/AndroidConfig.h -I build/core/combo/include/arch/linux-arm/ -Wno-unused-but-set-variable -fno-builtin-sin -fno-strict-volatile-bitfields -Wno-psabi -mthumb-interwork -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -DNDEBUG -g -Wstrict-aliasing=2 -fgcse-after-reload -frerun-cse-after-loop -frename-registers -DNDEBUG -UDEBUG -fvisibility-inlines-hidden -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -Wsign-promo -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -DNDEBUG -UDEBUG -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -fno-rtti -fstrict-aliasing -Wstrict-aliasing=2 -fno-align-jumps -Wall -Wextra -Wno-unused-parameter -DARCH_VARIANT=\"armv7-a-neon\" -DDVM_SHOW_EXCEPTION=1 -DWITH_JIT -DANDROID_SMP=1 -MD -MF out/target/product/manta/obj/SHARED_LIBRARIES/libdvm_intermediates/interp/Stack.d -o out/target/product/manta/obj/SHARED_LIBRARIES/libdvm_intermediates/interp/Stack.o dalvik/vm/interp/Stack.cpp
Update#2:
After changing the compile command-line to use -v to show the actual sub-tool commands that the g++ frontend invokes and adding the following compiler directives as suggested by #Peter Cordes
#if defined(__x86_64__) || defined(__i386__) #error "x86 What on earth" #endif
Below is the output of the compiling after using the command prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-g++ -v -o out/target/product/manta/obj/SHARED_LIBRARIES/libdvm_intermediates/interp/Stack.o dalvik/vm/interp/Stack.cpp
Notice the error below (at the end of the compiling output) is because I removed all compiler parameters except -v and -o to shorten the output (it's about 2 pages), so I used only prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/ar‌​m-linux-androideabi-‌​g++ -v -o
When I do not remove all the original parameters (about 30), I do not get that error fatal error: Dalvik.h: No such file or directory
prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-g++ -v -o out/target/product/manta/obj/SHARED_LIBRARIES/libdvm_intermediates/interp/Stack.o dalvik/vm/interp/Stack.cpp
Using built-in specs.
COLLECT_GCC=prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-g++
COLLECT_LTO_WRAPPER=/home/user/Android/nexus10/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../libexec/gcc/arm-linux-androideabi/4.7/lto-wrapper
Target: arm-linux-androideabi
Configured with: /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/configure --prefix=/tmp/toolchain-build-linux/prefix --target=arm-linux-androideabi --host=x86_64-linux-gnu --build=x86_64-linux-gnu --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --with-gmp=/tmp/toolchain-build-linux/temp-install --with-mpfr=/tmp/toolchain-build-linux/temp-install --with-mpc=/tmp/toolchain-build-linux/temp-install --with-cloog=/tmp/toolchain-build-linux/temp-install --with-ppl=/tmp/toolchain-build-linux/temp-install --disable-ppl-version-check --disable-cloog-version-check --enable-cloog-backend=isl --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --disable-libssp --enable-threads --disable-nls --disable-libmudflap --disable-libgomp --disable-libstdc__-v3 --disable-sjlj-exceptions --disable-shared --disable-tls --disable-libitm --with-float=soft --with-fpu=vfp --with-arch=armv5te --enable-target-optspace --enable-initfini-array --disable-nls --prefix=/tmp/toolchain-build-linux/prefix --with-sysroot=/tmp/toolchain-build-linux/prefix/sysroot --with-binutils-version=2.22 --with-mpfr-version=3.1.1 --with-mpc-version=1.0.1 --with-gmp-version=5.0.5 --with-gcc-version=4.7 --with-gdb-version=7.3.x --with-gxx-include-dir=/tmp/toolchain-build-linux/prefix/include/c++/4.7 --with-bugurl=http://source.android.com/source/report-bugs.html --disable-bootstrap --disable-libquadmath --enable-plugins --enable-libgomp --enable-gold --enable-graphite=yes --with-cloog-version=0.17.0 --with-ppl-version=1.0 --with-arch=armv5te --program-transform-name='s&^&arm-linux-androideabi-&' --enable-gold=default
Thread model: posix
gcc version 4.7 (GCC)
COLLECT_GCC_OPTIONS='-v' '-o' 'out/target/product/manta/obj/SHARED_LIBRARIES/libdvm_intermediates/interp/Stack.o' '-march=armv5te' '-mfloat-abi=soft' '-mfpu=vfp' '-mtls-dialect=gnu'
/home/user/Android/nexus10/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../libexec/gcc/arm-linux-androideabi/4.7/cc1plus -quiet -v -iprefix /home/user/Android/nexus10/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/ -D_GNU_SOURCE dalvik/vm/interp/Stack.cpp -mbionic -fpic -quiet -dumpbase Stack.cpp -march=armv5te -mfloat-abi=soft -mfpu=vfp -mtls-dialect=gnu -auxbase Stack -version -fno-exceptions -fno-rtti -o /tmp/cctyR1ga.s
GNU C++ (GCC) version 4.7 (arm-linux-androideabi)
compiled by GNU C version 4.6.x-google 20120106 (prerelease), GMP version 5.0.5, MPFR version 3.1.1, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/home/user/Android/nexus10/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/include"
ignoring nonexistent directory "/home/user/Android/nexus10/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/../../include/c++/4.7"
ignoring nonexistent directory "/home/user/Android/nexus10/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/../../include/c++/4.7/arm-linux-androideabi"
ignoring nonexistent directory "/home/user/Android/nexus10/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/../../include/c++/4.7/backward"
ignoring duplicate directory "/home/user/Android/nexus10/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/../../lib/gcc/arm-linux-androideabi/4.7/include"
ignoring nonexistent directory "/tmp/toolchain-build-linux/prefix/sysroot/usr/local/include"
ignoring duplicate directory "/home/user/Android/nexus10/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/../../lib/gcc/arm-linux-androideabi/4.7/include-fixed"
ignoring nonexistent directory "/home/user/Android/nexus10/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/../../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/include"
ignoring nonexistent directory "/tmp/toolchain-build-linux/prefix/sysroot/usr/include"
#include "..." search starts here:
#include <...> search starts here:
/home/user/Android/nexus10/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/include
/home/user/Android/nexus10/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/include-fixed
End of search list.
GNU C++ (GCC) version 4.7 (arm-linux-androideabi)
compiled by GNU C version 4.6.x-google 20120106 (prerelease), GMP version 5.0.5, MPFR version 3.1.1, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: c3359b46636f5ec5014b000ecf7eb5d5
dalvik/vm/interp/Stack.cpp:23:20: fatal error: Dalvik.h: No such file or directory
compilation terminated.
Update#3:
I wrote a simple C++ program called inlineAsm.cpp that uses an inline assembly code as suggested by #Peter Cordes which is shown below:
main()
{
int time, t0, t1, a;
{int pmccntr;asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(pmccntr));t0=(pmccntr) * 64;}
a=1;
{int pmccntr;asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(pmccntr));t1=(pmccntr) * 64;}
time = (t1-t0);
}
I compiled the above code using the following command:
prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-g++ inlineAsm.cpp
Below are the compiler error messages that I get:
/home/user/Android/nexus10/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/bin/ld: error: cannot open crtbegin_dynamic.o: No such file or directory
/home/user/Android/nexus10/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/bin/ld: error: cannot open crtend_android.o: No such file or directory
/home/user/Android/nexus10/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lstdc++
/home/user/Android/nexus10/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lm
/home/user/Android/nexus10/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lc
/home/user/Android/nexus10/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ldl
collect2: error: ld returned 1 exit status
This is very strange because as I said before when I remove the inline assembly code that I added to the Android Stack.cpp source code, I can compile and build the ROM image for a Nexus10 which is ARM7a and the I can flash the image to the device and the image works fine with no problem.

"qmake" and "make" QtRemoteObjects (from git) for Qt 5.7 Android on Windows 7 does not work

I have cloned the QtRemoteObjects repository from: http://code.qt.io/cgit/playground/qtremoteobjects.git/
on my Windows 7 using GitBash.exe.
The project files are download to "D:\Daten\Android\qtremoteobjects\". Based on the article on this website: https://www.kdab.com/qt-android-create-android-service-using-qt/ I run this command in GitBash:
$ cd d:/Daten/Android/qtremoteobjects/
$ git c:/Qt5.7.0/5.7/android_armv7/bin/qmake -r && make && make install
QMAKE PART
For the qmake part these errors show up:
Reading D:/Daten/Android/qtremoteobjects/tests/auto/cmake/cmake.pro
Das System kann den angegebenen Pfad nicht finden.
meaning the system could not find the given path. And the next two errors are:
WARNING: Failure to find: rep_server_source.h
Project MESSAGE: cmake executable not found. Not running CMake unit tests
First question: Why doesnt the system find the path for cmake.pro and rep_server_source.h and why isnt the cmake executable not found even though I have separately installed CMake.
MAKE PART
The next error that shows up is:
bash: make: command not found
As a solution to this I separated the qmake and make process. I first just ran qmake
$ git c:/Qt5.7.0/5.7/android_armv7/bin/qmake -r
and when qmake is finished (and the same errors as above still show up) i run mingw32-make.exe from Qt5.7->Tools in the qtremoteobjects folder:
$ c:/Qt5.7.0/Tools/mingw530_32/bin/mingw32-make.exe
and this is the result:
cd src/ && ( test -e Makefile || C:/Qt5.7.0/5.7/android_x86/bin/qmake.exe
D:/Daten/Android/qtremoteobjects/src/src.pro -o Makefile ) && C:/Qt5.7.0/Tools/mingw530_32/bin/mingw32-make -f Makefile
mingw32-make[1]: Entering directory 'D:/Daten/Android/qtremoteobjects/src'
cd remoteobjects/ && ( test -e Makefile || C:/Qt5.7.0/5.7/android_x86/bin/qmake.exe D:/Daten/Android/qtremoteobjects/src/remoteobjects/remoteobjects.pro -o Makefile ) && C:/Qt5.7.0/Tools/mingw530_32/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'D:/Daten/Android/qtremoteobjects/src/remoteobjects'
D:\Daten\Android\android-ndk-r10e/toolchains/x86-4.9/prebuilt/windows/bin/i686-linux-android-g++ -c -ffunction-sections -funwind-tables -O2 -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -DANDROID -Wa,--noexecstack -std=c++11 -mfpmath=sse -O2 -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -Wno-psabi -W -Wvla -D_REENTRANT -fPIC -DQT_NO_XKBCOMMON -DQT_BUILD_REMOTEOBJECTS_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_URL_CAST_FROM_STRING -DQT_BUILD_REMOTEOBJECTS_LIB -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -Ic:/utils/openssl-android-master/include -I../../include -I../../include/QtRemoteObjects -I../../include/QtRemoteObjects/5.6.1 -I../../include/QtRemoteObjects/5.6.1/QtRemoteObjects -I. -IC:/Qt5.7.0/5.7/android_x86/include -IC:/Qt5.7.0/5.7/android_x86/include/QtNetwork -IC:/Qt5.7.0/5.7/android_x86/include/QtCore/5.7.0 -IC:/Qt5.7.0/5.7/android_x86/include/QtCore/5.7.0/QtCore -IC:/Qt5.7.0/5.7/android_x86/include/QtCore -I.moc -isystem D:/Daten/Android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem D:/Daten/Android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include -isystem D:/Daten/Android/android-ndk-r10e/platforms/android-9/arch-x86/usr/include -IC:/Qt5.7.0/5.7/android_x86/mkspecs/android-g++ -o .obj/qconnection_local_backend.obj qconnection_local_backend.cpp
Makefile:1720: recipe for target '.obj/qconnection_local_backend.obj' failed
process_begin: CreateProcess(NULL, D:\Daten\Android\android-ndk-r10e/toolchains/x86-4.9/prebuilt/windows/bin/i686-linux-android-g++ -c -ffunction-sections -funwind-tables -O2 -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -DANDROID -Wa,--noexecstack -std=c++11 -mfpmath=sse -O2 -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -Wno-psabi -W -Wvla -D_REENTRANT -fPIC -DQT_NO_XKBCOMMON -DQT_BUILD_REMOTEOBJECTS_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_URL_CAST_FROM_STRING -DQT_BUILD_REMOTEOBJECTS_LIB -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -Ic:/utils/openssl-android-master/include -I../../include -I../../include/QtRemoteObjects -I../../include/QtRemoteObjects/5.6.1 -I../../include/QtRemoteObjects/5.6.1/QtRemoteObjects -I. -IC:/Qt5.7.0/5.7/android_x86/include -IC:/Qt5.7.0/5.7/android_x86/include/QtNetwork -IC:/Qt5.7.0/5.7/android_x86/include/QtCore/5.7.0 -IC:/Qt5.7.0/5.7/android_x86/include/QtCore/5.7.0/QtCore -IC:/Qt5.7.0/5.7/android_x86/include/QtCore -I.moc -isystem D:/Daten/Android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem D:/Daten/Android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include -isystem D:/Daten/Android/android-ndk-r10e/platforms/android-9/arch-x86/usr/include -IC:/Qt5.7.0/5.7/android_x86/mkspecs/android-g++ -o .obj/qconnection_local_backend.obj qconnection_local_backend.cpp, ...) failed.
make (e=2): Das System kann die angegebene Datei nicht finden.
mingw32-make[2]: *** [.obj/qconnection_local_backend.obj] Error 2
mingw32-make[2]: Leaving directory 'D:/Daten/Android/qtremoteobjects/src/remoteobjects'
Makefile:44: recipe for target 'sub-remoteobjects-make_first-ordered' failed
mingw32-make[1]: *** [sub-remoteobjects-make_first-ordered] Error 2
mingw32-make[1]: Leaving directory 'D:/Daten/Android/qtremoteobjects/src'
Makefile:46: recipe for target 'sub-src-make_first' failed
mingw32-make: *** [sub-src-make_first] Error 2
Second Question Why is make not successful here? what do these errors mean? What is wrong with '.obj/qconnection_local_backend.obj'
Is it because I am running make on Windows?
Thanks,

QtCreator android wont deploy

I am trying to run a simple app in android simulator. When I compile, I get the following:
/Users/derek/software/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++ -c -pipe -std=gnu++0x -O2 -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Wall -Wno-psabi -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../Qt/5.2.1/android_armv7/mkspecs/android-g++ -I../SSLTunnel -I../SSLTunnel/qtquick2applicationviewer -I../../Qt/5.2.1/android_armv7/include -I../../Qt/5.2.1/android_armv7/include/QtQuick -I../../Qt/5.2.1/android_armv7/include/QtQml -I../../Qt/5.2.1/android_armv7/include/QtNetwork -I../../Qt/5.2.1/android_armv7/include/QtGui -I../../Qt/5.2.1/android_armv7/include/QtCore -I. -I../../software/android-ndk-r9d/sources/cxx-stl/gnu-libstdc++/4.8/include -I/Users/derek/software/android-ndk-r9d/sources/cxx-stl/gnu-libstdc++/4.8/libs/default/armeabi-v7a/include -I../../software/android-ndk-r9d/platforms/android-8/arch-arm/usr/include -I. -o main.o ../SSLTunnel/main.cpp
In file included from ../../software/android-ndk-r9d/sources/cxx-stl/gnu-libstdc++/4.8/include/algorithm:60:0,
from ../../Qt/5.2.1/android_armv7/include/QtCore/qglobal.h:82,
from ../../Qt/5.2.1/android_armv7/include/QtCore/qcoreapplication.h:45,
from ../../Qt/5.2.1/android_armv7/include/QtGui/qguiapplication.h:45,
from ../../Qt/5.2.1/android_armv7/include/QtGui/QGuiApplication:1,
from ../SSLTunnel/main.cpp:1:
../../software/android-ndk-r9d/sources/cxx-stl/gnu-libstdc++/4.8/include/utility:68:28: fatal error: bits/c++config.h: No such file or directory
#include <bits/c++config.h>
What is the problem here?
There has been known defects with this in the past it seems: Issue 35616
There was a comment in another post that says it will work if you are running gcc version 4.4:
standalone toolchain does not find c++ includes
I have the same problem before.And now I have solve it.
Add these system variables to you system envirenment:
ANDROID_HOME:D:/android_sdk/adt-bundle-windows-x86-20140321/adt-bundle-windows-x86-20140321/sdk(your android sdk)
ANDROID_NDK_HOST:windows
ANDROID_NDK_PLATFORM:android-19
ANDROID_NDK_ROOT:D:\android_ndk\android-ndk-r9d-windows-x86\android-ndk-r9d(your android ndk)
ANDROID_SDK_ROOT:D:/android_sdk/adt-bundle-windows-x86-20140321/adt-bundle-windows-x86-20140321/sdk(your android sdk)
and then reset qt-creator,rebuild your program .

Categories

Resources