Android cmake cannot find -lpthread - android

I'm trying to compile a shared library using cmake. I followed the instruction on this tutorial to change the toolchain for android NDK.
However, I'm getting the following output error:
/home/usr/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lpthread
collect2: error: ld returned 1 exit status
make[2]: *** [../libs/armeabi-v7a/libutils.so] Error 1
make[1]: *** [src/CMakeFiles/utils.dir/all] Error 2
make: *** [all] Error 2
A bit of googling around and I stumble upon this stackoverflow post. So I modified my CMakeLists.txt to add:
set(CMAKE_CXX_FLAGS"-DHAVE_PTHREADS")
but it seems like it still doesn't work. Am I going about this the wrong way?
Thanks!

Related

AndroidGuiExample failed compiling

I'm trying to get acquainted with openFrameworks and Android application. I installed both Android SDK and NDK (r10e) and I tried to compile the AndroidGuiExample.
Unfortunately, this is what the terminal returned at the end:
undefined reference to 'std::__throw_out_of_range_fmt(char const*, ...)'
collect2: error: ld returned 1 exit status
make[2]: *** [libs/armeabi-v7a/libOFAndroidApp.so] Error 1
make[1]: *** [Debug] Error 2
make: *** [AndroidDebug] Error 2
I have not sincerely a clear idea of what happened.
Anyone could help me in understanding the error and finding a solution?
Thanks everyone!
Have you configured NDK ?
With a text editor, edit the file
libs/openFrameworksCompiled/project/android/paths.make
and set the NDK path to the correct folder:
NDK_ROOT=/path/to/the/ndk
So it looks like this
NDK_ROOT=/Developer/android-ndk-r10e
happy coding ! :)

Running AOSP on MAC: stdarg.h error

I have the source code for android-5.0.0_r7.0.1. After doing:
make -j4
I keep getting this:
error: stdarg.h: No such file or directory
In file included from system/core/include/cutils/log.h:1,
from system/core/include/utils/KeyedVector.h:24,
from frameworks/native/include/input/Input.h:26,
from frameworks/native/include/input/InputDevice.h:20,
from frameworks/native/libs/input/InputDevice.cpp:23:
system/core/include/log/log.h:35:20: error: stdarg.h: No such file or directory
make: *** [out/host/darwin-x86/obj32/EXECUTABLES/validatekeymaps_intermediates/Main.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [out/host/darwin-x86/obj32/STATIC_LIBRARIES/libinput_intermediates/Keyboard.o] Error 1
make: *** [out/host/darwin-x86/obj32/STATIC_LIBRARIES/libinput_intermediates/InputDevice.o] Error 1
make: *** [out/host/darwin-x86/obj32/STATIC_LIBRARIES/libinput_intermediates/Input.o] Error 1
#### make failed to build some targets (01:32 (mm:ss)) ####
I have looked at the google groups and other stack overflow questions, but I cannot seem to figure out what is going wrong.
#Meteorite
Well, ultimately after googling I discovered the AOSP for some reason did not support the latest version of Xcode tools and OS X. I dualbooted windows 7 with ubuntu, and did the whole process. And when I did the make command on ubuntu I typed: make -k -i -B. That is, I gave it the keep going, ignore make errors and build unconditionally flags.

arm-linux-androideabi/bin/ld: fatal error: -soname: must take a non-empty argument

I am cross compiling gdcm with cmake android it goes till end of compilation but at last I get following error. how do you guys set -soname in cmake-gui or cmake while compiling libraries so that we can avoid below kind of error.
/opt/android/android-ndk-r10c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux- androideabi/bin/ld: fatal error: -soname: must take a non-empty argument
collect2: error: ld returned 1 exit status
make[2]: *** [/home/likewise-open/SLKTECHLABS/kirtan.patel/Desktop/GDCM/GDCMSource/libs/armeabi-v7a/libgdcmjni.so] Error 1
make[1]: *** [Wrapping/Java/CMakeFiles/gdcmjni.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/home/kirtan.patel/Desktop/GDCM/GDCMSource/Source/MediaStorageAndFileFormat/gdcmImageWriter.h:36: Warning 822: Covariant return types not supported in Java. Proxy method will return gdcm::Pixmap const &.
/home/kirtan.patel/Desktop/GDCM/GDCMSource/Source/MediaStorageAndFileFormat/gdcmImageCodec.h:45: Warning 473: Returning a pointer or reference in a director method is not recommended.
As Romanski pointed out CMake versions 3.2 and 3.0 have different behaviour because of difference in UseSWIG.cmake files. In 3.2 NO_SONAME property enabled by default looks like it raises conflict in android build producing invalid linking option -Wl,-soname, with empty TARGET_SONAME.
There are two ways to fix build with 3.2 version
string(REPLACE "<CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME>" "" CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}") eliminates broken linking option at all
set_target_properties(${MY_TARGET} PROPERTIES NO_SONAME OFF) fix broken linking option with correct so-name.

Building Pocketsphinx On Android on Windows

I have been following this Building Pocketsphinx on android for days now and I am very confused what to do now. I will be telling what I have done step by step so you will know what I have done wrong.
I am using Windows 7 64-bit.
First of all I have downloaded PocketSphinx and Sphinxbase and I have unpack it in C:\Sphinx. Then I have downloaded mingw from MINGW DOWNLOAD only that. after I downloaded this stuffs, I started the mingw.exe and as a amateur I am, I tried sudo -i only and that did not do anything so I gone to the next instructions installing swig.
I tried typing apt-get install swig and yum install swig as the same as last time it did not work. Then I have tried mingw-get install swig and the result is mingw-get.exe: *** ERROR *** swig: unknown package. So with that I tried again the next intructions installation of sphinxbase.
In installing sphinxbase, I have gone to sphinxbase directory - C:\Sphinx\sphinxbase and I typed ./autogen.sh. So with that it compiled without problems and I typed ./configure It compiled good as well. the next is make this is where I got a problem, it compiled but it got errors. the error is:
make[3]: *** [pio.lo] Error 1
make[3]: Leaving directory `/c/sphinx/sphinxbase/src/libsphinxbase/util`
make[2]: *** [All-recursive] Error 1
make[2]: Leaving directory `/c/sphinx/sphinxbase/src/libsphinxbase`
make[1]: *** [All-recursive] Error 1
make[1]: Leaving directory `/c/sphinx/sphinxbase/src`
make: *** [all-recursive] Error 1
this is the problem I got until now. Then I have tried downloading pio.lo from pio.lo download. So it fix the error but another error appeared. Second Error:
collect2.exe: error: ld returned 1 exit status
make[2]: *** [sphinx_fe.exe] Error 1
make[2]: Leaving directory `/c/sphinx/sphinxbase/src/sphinx_fe`
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/c/sphinx/sphinxbase/src`
make: *** [all-recursive] Error 1
This is where I got stuck. I have tried copying sphinx_fe from sphinxbase-0.7-win32.zip after doing that nothing happens. The compilation would only delete the sphinx_fe.exe.
My question is What Should I do now?
If it is not clear feel free to comment and ask. Thank you for the help.
MinGW is not supported for now, try to use Cygwin instead.
Actually you don't need to run autogen.sh and make, it's enough to unpack sources
sudo, yum and other commands are Unix only commands, you need to search for their analog on windows.
For more information about SWIG on windows see
http://www.swig.org/Doc2.0/Android.html

"cannot open linker script file" when compiling GameKit for Android

When I built Gamekit for Android, I got the follow error:
...(deleted)
[ 98%] Built target OgreKitCore
Linking CXX executable ../../../bin/StripBlend
/usr/local/android-ndk-r8b/toolchains/mipsel-linux-android-4.6/prebuilt/linux-x86/bin/../lib/gcc/mipsel-linux-android/4.6.x-google/../../../../mipsel-linux-android/bin/ld: cannot open linker script file /usr/local/android-ndk/toolchains/mipsel-linux-android-4.6/mipself.x: No such file or directory
collect2: ld returned 1 exit status
make[2]: *** [../bin/StripBlend] Error 1
make[1]: *** [FileTools/Strip/CMakeFiles/StripBlend.dir/all] Error 2
make: *** [all] Error 2
I google it and found a related post:
https://groups.google.com/forum/#!msg/doubango/TVOUjTxfbtA/y6eaikfcTu0J
They just rollback NDK version to fix this problem.
However, I have to build an Android Gamekit library for MIPS CPU, so I need NDK-r8 or NDK-r8b.
Is there any suggestion to fix this problem?
PS: GameKit is http://code.google.com/p/gamekit/
Copy mipself.x and mipself.xsc, which can be downloaded from the Internet,
into /toolchains/mipsel-linux-android-4.6/ folder, and then fix this problem.

Categories

Resources