I have a Problem on an emulated Android device. To be honest on every emulated Android Device. There is a mutex test from Android Bionic. It could be found under:
https://android.googlesource.com/platform/system/extras/+/froyo/tests/bionic/libc/bionic/test_mutex.c
So, when compiling this with CMake and the Android Toolchain for Android x86 or x86_64 it compiles fine.
Altough, when running the file it throws an error in line 90:
expect( pthread_mutex_trylock( &lock ), EDEADLK );
The error message:
generic_x86_arm:/data/local # ./test_mutex
/home/tjk/coding/oorexx/mutex/test_mutex.c:80: call returned 16 instead of 35: pthread_mutex_trylock( &lock )
If I delete this on line everything is fine and I get an "ok". Thats not a solution because I'm working on a big project and debugging tells me that there are problems and its very likely that the trylock function is the reason for that. So I need to fix that. The mutex test has to work.
What can I do? What could be the reason for that? Is it the device? Is it the Android Toolchain or is there something wrong with my CMake Command? My CMake Command:
cmake -H./ -B./build2 -DANDROID_NDK=~/coding/android-ndk-r22b/ -DCMAKE_TOOLCHAIN_FILE=~/coding/android-ndk-r22b/build/cmake/android.toolchain.cmake -DANDROID_ABI="x86" -DCMAKE_BUILD_TYPE=Release \ (base)
-DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX -DANDROID_NATIVE_API_LEVEL=30
The CMakeLists.txt:
cmake_minimum_required(VERSION 3.6.0)
project(test_mutex)
add_executable(test_mutex test_mutex.c)
I would really appreciate any useful tips. Thank you!
Best Regards Thomas
Related
While installing NVidia Android CodeWorks I have received an error at the very end of the installation process saying :
installing compile samples 4.0 failed nvidia
Return Code: 2Compile Samples failed. Please check the /home/user/NVPACK//_installer/compile.log. You can send it to TegraDeveloperPack-Users#nvidia.com if you can not resolve it.
Does anyone know how to solve this problem please
So that other people having the same problem might go on something for I have not found an optimal solution to this problem.
I have managed to solve it by simply copying my version of jdk (which is jdk1.8.0_101) to the specified Nvidia Codeworks folder and renaming to the one missing in the log (...\Nvidia\Codeworks_installer\compile.log - \Nvidia\Codeworks\jdk1.8.0_77" does not exist.) In my case it compiled successfully, however it must be noted that this is not a good solution. Messing around with the environment valuables might be a reasonable place to start otherwise.
If your log file shows:
Error: JAVA_HOME is not defined correctly.
make: *** [antbuild_Basic_debug] Error 1
We cannot execute /usr/bin/java
Makefile.Basic.mk:92: recipe for target 'antbuild_Basic_debug' failed
you can fix it by creating a soft link like this:
sudo ln -s $JAVA_HOME/bin/java /usr/bin/java
I am using this repository to build ffmpeg static library which includes x264,libpng and others, please
visit this link https://github.com/writingminds/ffmpeg-android
i am using windows 7 as host and ubuntu 15.10 (_64) as guest os using VMware Workstation 12 and
Android-ndk-r11b-linux-x86_64
i do have Prebuilt libraries , but now i want it without PIE support
i am getting this error in config.log in x264 folder while building
through
./android_build.sh
here is the log :
x264 configure script
Command line options: "--cross-prefix=/mnt/hgfs/uShare/ffmpeg-android/toolchain-android/bin/arm-linux
/mnt/hgfs/uShare/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi-gcc
checking whether /mnt/hgfs/uShare/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi-gcc
--sysroot=/mnt/hgfs/uShare/ffmpeg-android/toolchain-android/sysroot works... no
Failed commandline was:
--sysroot=/mnt/hgfs/uShare/ffmpeg-android/toolchain-android/sysroot conftest.c -Wall -I. -I$(SRCPATH) --sysroot=/mnt/hgfs/uShare/ffmpeg-android/toolchain-android/sysroot --sysroot=/mnt/hgfs/uShare/ffmpeg-android/toolchain-android/sysroot -lm -o conftest
/mnt/hgfs/uShare/ffmpeg-android/toolchain-android/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: fatal error:
conftest: Input/output error
Failed program was:
int main (void) { return 0; }
DIED: No working C compiler found.
ushare is my shared folder between windows and ubuntu
I have spend almost a week ,trying to solve every error i get.
these errors are like never ending , 1 solution give 10 more errors
i have researched a LOT for this library
thanks a lot in advance.
Also i thought that x264 library might have poroblem ,so i tried to disable it
but next library "libpng" also had Same log Error
i think problem is in Input/output error (obviously)
this line in log kind of confuses me (those /../../)
/mnt/hgfs/uShare/ffmpeg-android/toolchain-android/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: fatal error:
its like two folder overlaping address...
thanks a lot in advance.
please don't go harsh on me ,its my first time,all thanks to this thing...
Well i solved my problem. the problem was in NDK ,i extracted it in windows and was using it on ubuntu. Later i used ubuntu to extract ,and found the built to be working.
hope this help to new future users!
Hi I am trying to build compat-wireless component for Qualcom's APQ8064 on Yocto kernel.
When I build compat-wireless package provided by Qualcom as part of code-aroura android am able to see cfg80211.ko and ath6kl_sdio.ko ath6kl_usb.ko components are generated successfully.
But when I build compat-wireless package with Yocto kernel (ver 3.1.0) as standalone am seeing only wlan.o (i.e ath6kl_usb.ko) being generated. (I dont see cfg80211.ko and ath6kl_sdio.ko)
Enabling the CFG flags for ath6kl_sdio.ko support ends up with lot of compilation/dependency issues.
Has anyone faced the similar issue? Please provide suggestions. Also I am not able to understand, how android build resolves these dependencies and builds successfully.
Thanks in advance.
Try using bitbake with the -c menuconfig linux-yocto arguments. Then find you driver type 'h' for help and you should see the dependencies tree.
I have a problem running openCV samples project (3 - 4). Everytime that I run the program, I found the problem "Unforunately OpenCV Manager has stopped" displays in my Android emulator.
The problem occurs everytime that I call
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
I followed this page
http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html
This is the Warning Message that I have
/Applications/eclipse-android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld:
warning: hidden symbol '__aeabi_atexit' in
./obj/local/armeabi-v7a/libgnustl_static.a(atexit_arm.o) is referenced
by DSO
/Applications/eclipse-android/OpenCV-2.4.3-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_java.so
Logcat (from OpenCV sample4):
gralloc_goldfish, org.opencv.samples.tutorial4 Emulator without GPU
emulation detected.
Note:
I set java compliance level to 1.6 since I have some problem compiling OpenCV c++ file.
(followed this page: 'Must Override a Superclass Method' Errors after importing a project into Eclipse)
I install adb with both OpenCV_2.4.3_binary_pack_armv7a.apk and OpenCV_2.4.3_Manager_2.0_armeabi-v7a.apk
I used Samsung Galaxy S as my cellphone emulator
I run into the same problem:
hidden symbol '__aeabi_atexit' armeabi-v7a/libgnustl_static.a(atexit_arm.o) is referenced by DSO
I am using the opencv test in jni, with an application that worked before I have added it.
I have tried to change the ARMv7-A machine to armeabi in the "Application.mk'
I have also tried to add all the paths mentioned above to the Project -> Properties -> C/C++ General -> Path and Symbols.
It didn't work.
Thanks to my team leader, I have found the solution:
in Application.mk, You need to change the APP_STL := gnustl_static
to APP_STL := gnustl_shared. This is because the lib apparantly was compiled in shared instead of static.
In addition, add to the loadlibrary area the lib: System.loadLibrary("gnustl_shared");
This should be done in a static area, as followed:
static {
try{
System.loadLibrary("gnustl_shared");
//To do - add your static code
}
catch(UnsatisfiedLinkError e) {
Log.v(TAG, "Native code library failed to load.\n" + e);
}
catch(Exception e) {
Log.v(TAG, "Exception: " + e);
}
}
That's it! it solved my problem...
Hope it helped.
Inbal
Your problem might simply be emulator itself, try to get an actually device to test on.
There are a lot of things that emulator can't handle.
If you use Android 4.2 than change to 4.0.3 or to 4.1. There is a bug about that: http://code.opencv.org/issues/2537
I had problems this days running the two tutorials too.
On my machine I installed OpenCV 2.4.3, Android-sdk-21 and Android-ndk-r8c, Eclipse Juno. I perform my tests on an Asus Transformer tf101g running Android 4.0.3.
When I ran the tutorials it failed with a strange ClassNotFoundException. Checking the project properties I realized that the two projects look for headers in a wrong place. Go to Project -> Properties -> C/C++ General -> Path and Symbols. Here you can see the include directories used in the jni file.
The NDKROOT environment variable was not set in my system and I had to manually set it to point to the NDK root folder.
Then I had to change the stl include from
${NDKROOT}/sources/cxx-stl/gnu-libstdc++/include
to
${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/include
Hope this can help.
I too struggled with this for almost 4 hours, including downgrading target to 4.0.3 but did not work.
The solution was to download the latest openCV manager from google play to your device directly.
I got the same error and thought even though late,the solution might help for some in future.
The error "Unforunately OpenCV Manager has stopped" pops up if its version is not supported by the android device hardware(like armeabi-v7a (ARMv7-A + NEON) or Intel x86,etc). uninstall the current Manager and install the proper one.
Paste the following code before onCreate() Method:
static {
System.loadLibrary("opencv_java3");
}
it worked for me.
Hi
I'm in need to build OpenSSL lib for Android NDK r5b, today it will be second day of my ... useles fight. Here is short list what i've done
Downloaded: https://github.com/fries/android-external-openssl/
As i found here on StackOverflow fixed .S <->.s problem
Crypto gets builded... until i get this message:
/prebuilt/windows/bin/arm-linux-androideabi-
SharedLibrary : libcrypto.so
arm-linux-androideabi-g++.exe: CreateProcess: No such file or directory
make: * [/cygdrive/c/AndroidDev/AndroidOpenSSL/obj/local/armeabi/libcrypto.so]
Error 1*
It's 10 years when i last time used make, and i was sure it's problem with g++ path. Added some debug to toolchain, and got:
TOOLCHAIN_NAME: arm-linux-androideabi-4.4.3
TOOLCHAIN_PREFIX: /cygdrive/c/Android_NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi-
both looks fine for me, as /cygdrive/c/Android_NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/ does exist, and arm-linux-androideabi-g++.exe is right there :(
Any one ever had this same problem? I realy have no idea where to look any future :(
Will be appreciative for help
One solution is also to shorten the openssl build path, eg. from c:\code\openssl-android to just c:\ssl
Looks like only i had such problem. Here is a solution i found, mayby someone will figure out why this happend.
Saved command line to separate file called bild_data (output from ndk-build), then removed from it g++ call, this way my build file had only list of files and needed flags. Then i just executed from cygwin arm-linux-androideabi-g++ #build_data
After that i had my 'precious' libcrypto.so, ndk-build executed again with libcrypto.so alerdy builded from command line, builded openssl library.
For me it looks like command line that was over 31kb did not fit to cygwin buffer :(
I had the same problem building on Windows (cygwin), and shortening the path to the project directory (see mango's answer) is what worked for me.