I want to port libimobiledevice to android with ndk in order to make android device enable to communicate with iphone, and import data from iphone to android device. i found this project use autoconf. so i made cross compile use following command
./configure --build=x86_64-pc-linux-gnu --host=arm-linux-androideabi --target=arm-linux-androideabi CPPFLAGS="-I$ANDROID_NDK/platforms/android-14/arch-arm/usr/include -I$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/include -I$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include -I$ANDROID_NDK/sources/crystax/include" CFLAGS="-nostdlib" LDFLAGS="-Wl,-rpath-link=$ANDROID_NDK/platforms/android-14/arch-arm/usr/lib -L$ANDROID_NDK/platforms/android-14/arch-arm/usr/lib" LIBS="-lc"
but run into some error, can't find pthread python.
checking for pthread_create, pthread_mutex_lock in -lpthread... no
configure: error: libpthread is required to build libimobiledevice
checking for a version of Python >= '2.1.0'... yes
checking for the distutils Python package... yes
checking for Python include path... -I/usr/include/python2.7
checking for Python library path... -L/usr/lib/python2.7 -lpython2.7
checking for Python site-packages path... /usr/lib/python2.7/site-packages
checking python extra libraries... -ldl
checking python extra linking flags...
checking consistency of all components of python development environment... no
configure: error:
Could not link test program to Python. Maybe the main Python library has been
installed in some non-standard library path. If so, pass it to configure,
via the LDFLAGS environment variable.
Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
============================================================================
ERROR!
You probably have to install the development version of the Python package
for your distribution. The exact name of this package varies among them.
============================================================================
Related
I am pretty new to Qt (and linux for that matter), but need to build an Android app based on Qt with some basic bluetooth functionality. I have been able to build Qt for Android from source and develop a simple app, but QtBluetooth cannot be found.
Starting point:
Ubuntu 18.10 x64
Android NDK r18b
Android SDK (android-27)
OpenJDK v1.8.0_212
Qt 5.12.3
This is my configure command:
./configure -xplatform android-clang -android-ndk [path to NDK] -android-sdk [path to SDK] -android-ndk-host linux-x86_64 -android-toolchain-version 4.9 -no-warnings-are-errors -android-ndk-platform andoird-27 -opensource -confirm-license -v
The configure output shows that none of the Qt Bluetooth components are enabled, and that this is because
"None of [libbluetooth.so libbluetooth.a] could be found in [] and global paths."
"pkg-config use disabled globally"
This is really frustrating because I've installed those libraries: both of those files are in the /usr/lib/x86_65-linux-gnu/ directory! Also pkg-config is installed...
I have tried adding this path (/usr/lib/x86_64-linux-gnu/) to the configure command and copying these libraries into directories that I would have thought are already included, but these workarounds have been fruitless. I am using git to clean the submdodules and main directory between each attempt.
What am I missing?? It feels like this is sooo close to working.
In order to run the bluetooth C program on my ubuntu desktop I installed the libbluetooth-dev using
sudo apt-get install libbluetooth-dev
Then I compiled the code with
gcc -o simplescan simplescan.c -lbluetooth
and it executed just fine. However when I tried to cross compiled it for Android using
arm-linux-gnueabi-gcc -o simplescan simplescan.c -lbluetooth
It gave me the error
/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: cannot find -lbluetooth
collect2: error: ld returned 1 exit status​
I noticed there was similar post here: Bluetooth programming in Linux - cross compiler issue
But seems like it didn't give a solution, I am still confused how to install the libbluetooth-dev support for the cross compiler.
You cannot link the libbluetooth library that was compiled for a different architecture.
You need to build the libbluetooth library for the architecture your application will be build for.
How do you define the NDK installation that ndk-build uses? I used the r10e build for a good while, then updated my NDK and modified my $PATH to point to the new location, but when I build using the ndk-build command in Terminal it still uses the older android-ndk-r10e version.
I know this because I use the NDK_LOG=1 option when invoking ndk-build and it produces the following verbose information as it builds my project. Notice the references to "/NDKDev/android-ndk-r10e". That's my old installation.
~/Documents/MyNDKProject-- $ ndk-build NDK_LOG=1
HOST_OS=darwin
HOST_ARCH=x86_64
HOST_TAG=darwin-x86_64
GNUMAKE=/Users/user1/Documents/NDKDev/android-ndk-r10e/prebuilt/darwin-x86_64/bin/make (NDK prebuilt)
Android NDK: NDK installation path auto-detected: '/Users/user1/Documents/NDKDev/android-ndk-r10e'
Android NDK: GNU Make version 3.81 detected
Android NDK: Host OS was auto-detected: darwin
Android NDK: Host operating system detected: darwin
Android NDK: Host CPU was auto-detected: x86
Android NDK: HOST_TAG set to darwin-x86
Android NDK: Host tools prebuilt directory: /Users/user1/Documents/NDKDev/android-ndk-r10e/prebuilt/darwin-x86_64/bin
Android NDK: Host 'echo' tool: echo
. . .
Also note that when I enter echo $PATH at the Terminal prompt it gives:
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin/:/sbin:/usr/local/bin:/Applications/android-sdk-macosx/ndk-bundle:/Applications/android-sdk-macosx
and where you see /Applications/android-sdk-macosx/ndk-bundle is exactly where it used to refer to the android-ndk-r10e path, so I'm certain I've updated my PATH successfully. So anyhow, IF the PATH environment variable is not what ndk-build uses to determine the NDK installation to use, what does it use, and how can I modify it so that it uses my new installation which is at:
/Applications/android-sdk-macosx/ndk-bundle
Fixed. The problem was that when the .bash_profile file is successfully sourced in a given Terminal session it does not have any effect on other instances of Terminal that are open. I had two instances of Terminal open and because I hadn't closed the one with which I was calling ndk-build the changes to .bash_profile weren't being applied.
I am beginner with Android and I have to make a voip app and after searching I found that the better opensource library for that is PJSIP.
I download the below things to build the PJSIP library:
PJSIP from here
Android NDK
SWIG
...But I don't know how to start. I checked this link for the official PJSIP website but I didn't make any progress.
Which Directory do I have to put the Android NDK into?
How to use SWIG to build the PJSIP?!
which Directory i have to put the Android NDK ?
Put it where you want, later you will setup the path to it
$ export ANDROID_NDK_ROOT=/path_to_android_ndk_dir
how to use SWIG to build the PJSIP ?!
You don't need SWIG to compile the PJSIP sources, it's needed only if you want to build and and run the sample application PJSUA.
Updated
The steps to build sources are
Download sources from PJSIP site. Pay attention if you will compile on Windows machine download .zip file, if on Unix machine (including OS X) then download .bz2 file.
Go to pjlib/include/pj/ from the downloaded sources. Create (or overwrite) a file called config_site.h. Copy the following code snippet
#define PJ_CONFIG_ANDROID 1
#include <pj/config_site_sample.h>
Open Cmd or Terminal
Go to pjsip root folder (the downloaded sources)
$ cd /path/to/your/pjsip/dir
Export bash var ANDROID_NDK_ROOT as a environment variable. Variable value should be the path of android ndk directory.
$ export ANDROID_NDK_ROOT=/path_to_android_ndk_dir (Unix)
SET ANDROID_NDK_ROOT=/path_to_android_ndk_dir (Windows)
Perform build for target armeabi
$ ./configure-android
If you need to perform build for
target arm64-v8a do $ TARGET_ABI=armeabi-v8a ./configure-android --use-ndk-cflags
target armeabi-v7a do $ TARGET_ABI=armeabi-v7a ./configure-android --use-ndk-cflags
target x86 do $ TARGET_ABI=x86 ./configure-android --use-ndk-cflags
Compile sources
$ make dep && make clean && make
I am using Ubuntu 11.10 (x64), Using android NDK I am trying to build the stand alone tool chain using the following command line:
/%Some path%/android-ndk-r7b/build/tools/make-standalone-toolchain.sh' --platform=android-9 --install-dir=/%Some path%/Android/stand-aloone-toolchain
while trying to execute any of the resulting files, eg. './arm-linux-androideabi-gcc' I get 'bash: ./arm-linux-androideabi-gcc: No such file or directory'.
I have verified that the file has execute permissions, I have also verified it is a linux executable while checking that it starts with the 'ELF' notation...
Why my generated tool chain doesn't work, why do I get 'No such file or directory' while directly executing './arm-linux-androideabi-gcc' from it's local dir. ?
I am using Ubuntu (x64), it appears that the OS doesn't include the libc & libz x32 version by default, installing libc6-i386 & lib32z1 resolved the problem..