How to Build a Custom ping executable to use on Android? - android

On some Android devices, the executable binary /system/bin/ping seems to be removed.
I wonder if I can build a ping executable binary from the Android source code ping.c.
But when build it using ndk-build, some errors happened:
jni/ping.c:67:47: fatal error: private/android_filesystem_config.h: No such file or directory
#include <private/android_filesystem_config.h>
^
compilation terminated.
make: *** [obj/local/armeabi/objs/myping/ping.o] Error 1
ndk's include folder doesn't have file android_filesystem_config.h.
My question is how to build a ping executable to use?

Related

Error cross-compiling openconnect-8.08 for android

When i follow instructions here, i get this error when running latest instruction that is "make":
make[1]: Entering directory '/home/fasegiar/Downloads/openconnect-8.08'
CC libopenconnect_la-ssl.lo
In file included from ssl.c:41:
In file included from ./openconnect-internal.h:102:
In file included from /usr/include/libxml2/libxml/tree.h:1307:
In file included from /usr/include/libxml2/libxml/xmlmemory.h:218:
In file included from /usr/include/libxml2/libxml/threads.h:35:
In file included from /usr/include/libxml2/libxml/globals.h:18:
In file included from /usr/include/libxml2/libxml/parser.h:810:
/usr/include/libxml2/libxml/encoding.h:31:10: fatal error: 'unicode/ucnv.h' file not found
#include <unicode/ucnv.h>
^~~~~~~~~~~~~~~~
1 error generated.
Makefile:1037: recipe for target 'libopenconnect_la-ssl.lo' failed
make[1]: *** [libopenconnect_la-ssl.lo] Error 1
make[1]: Leaving directory '/home/fasegiar/Downloads/openconnect-8.08'
Makefile:749: recipe for target 'all' failed
make: *** [all] Error 2
The TARGET that i use is: armv7a-linux-androideabi
My TOOLCHAIN is: /home/fasegiar/Documents/android-ndk-r21/toolchains/llvm/prebuilt/linux-x86_64
Here is the output of the config.log after ./configure call
From the snippet you posted I can already tell you this is not going to work.
When cross-compiling you need to cross-compile all dependencies first for your target platform (ie Android) and then tell the configure script where to find the installed dependencies. For openconnect the dependencies are:
Required:
libxml2 (this in turn requires libicu, as your error points out)
zlib (this is bundled)
Either OpenSSL or GnuTLS (v3.2.10+) (see NDKPorts)
Optional:
p11-kit (for PKCS#11 support)
libp11 (also needed for PKCS#11 support if using OpenSSL)
libproxy
trousers (for TPMv1 support if using GnuTLS)
libtasn1 and either tss2-esys or IBM's TPM 2.0 TSS. (for TPMv2 support if using GnuTLS)
libstoken (for SecurID software token support)
libpskc (for RFC6030 PSKC file storage of HOTP/TOTP keys)
libpcsclite (for Yubikey hardware HOTP/HOTP support)

Compilation Python 3.6.5 static binary for arm32 fail

I'm trying, on Debian 9.4 x64, to compiling static Python binaries for arm32.
I have initialy:
downloaded the "Gzipped source tarball" source file from:
https://www.python.org/downloads/release/python-365/
extracted source files in: /python3.6.5/
downloaded and extract "binutils-gold-2.29.1-16.1.armv7hl.rpm" by cmd line:
rpm -qlp /python3.6.5/binutils-gold-2.29.1-16.1.armv7hl.rpm
try to compile the binary with this following command:
./configure --build=arm --prefix="$PWD"/out LDFLAGS="-static -static-libgcc -Wl,--unresolved-symbols=ignore-all -Wl,--export-dynamic" CPPFLAGS=-static CXXFLAGS=-static CFLAGS="-Os -static" LDFLAGS=-static LD=ld.gold
And i get this errors:
/usr/bin/ld: BFD assertion (GNU Binutils for Debian) 2.28 as failed ../../bfd/elflink.c:14098
/usr/bin/ld: BFD (GNU Binutils for Debian) 2.28 internal error, aborting at ../../bfd/elf64-x86-64.c:6137 in elf_x86_64_finish_dynamic_symbol
/usr/bin/ld: Thanks to report this anomaly.
collect2: error: ld returned 1 exit status
Makefile:561 : the recipe for the "python" target has failed
-make: *** [python] Error 1
I'm trying to find how i could fix this error, but unfortunatly the support webpage on Python website isn't helpfull (https://wiki.python.org/moin/BuildStatically).
Finally, I would like to compile Python 3.6.5 for all processor platforms on which Android can run (arm32, aarm64, x86_x64, mips, mipsx64,...), to ultimately get a single binary file (i will repeat tasks for all other archs when i will have done with arm32).
So one file for each architectures cited, not multiple files/folders.
In a static way to avoid any dependencies with external libraries.
I chose to carry out the build operations, but if other less hazardous and simpler solutions exist i am taker.
NB: all cmd line has been made through LXTerminal on root session by default.
Thanks by advance for help.

Linphone-android compilation error

I am compiling linphone for android.i have set ndk and sdk paths.and installed pre-requisites.i also have 32-bit libs in my ubuntu12.04-64-bits.But when i 'make' the source code.it gives me 'sqlite.3h' file not found.
it is my log
In file included from
jni/..//submodules/linphone/build/android/../../coreapi/account_creator.c:21:0:
jni/..//submodules/linphone/build/android/../../coreapi/private.h:55:21: fatal error: sqlite3.h: No such file or directory
#include "sqlite3.h"
^
compilation terminated.
make[1]: *** [obj/local/armeabi-v7a/objs/linphone/account_creator.o] Error 1
I successfully able to compile linphone-android on ubuntu 12.04lts 64-bits.Problem solved by downloading arm-2009q3(consists of arm libraries and executables)and export its bin path in bash file(i.e. export PATH=$PATH:/usr/local/arm-2009q3/bin).

Android NDK - Building Limbo Android returns fatal error: config.h: No such file or directory

I'm trying to rebuild Limbo Android. I'm on Linux Mint.
All I changed was android-config.mak NDK_ROOT, exported variables NDK_ROOT. I've also exported NDK_MODULE_PATH to /home/pathtoandroidndk/sources, as per README instructions.
From terminal I do cd limbo-android/jni and then make.
Building returns this error:
jni/glib/glib/./libcharset/localcharset.c:22:20: fatal error: config.h: No such file or directory
compilation terminated.
make: *** [obj/local/armeabi-v7a/objs-debug/glib-2.0/./libcharset/localcharset.o] Error 1
make: Leaving directory `/home/me/limbo-android'
I've tried modifing Android.mk following instructions from Android NDK - Additional Include Directories and Unable to find header files - Android NDK, without success.
I came to conclusion that each module inside limbo-android needs it's own config.h file, while libcharset does not have one.
How do I solve this error? Is there a generic config.h (the one from NDK maybe?)
NOTE: I can build it without any problems on Windows 8.1 using mingw.

opencv.hpp not found in NDK build on Windows

I am getting some issues here while I am trying to compile my code with Cgywin.
$ /cygdrive/c/native_work/android-ndk-r8b/ndk-build
Android NDK: WARNING: Unsupported source file extensions in jni/Android.mk for module main
Android NDK: NotePaperDetector.hpp
Install : libmain.so => libs/armeabi-v7a/libmain.so
so how I can compile the .hpp file ?
Now as #mah you said I have removed it from my Android.mk but now its showing some different error -
$ /cygdrive/c/native_work/android-ndk-r8b/ndk-build
Compile++ thumb : main <= NotePaperDetector.cpp
In file included from jni/NotePaperDetector.hpp:4:0,
from jni/NotePaperDetector.cpp:1:
jni/NoteLocation.hpp:4:30: fatal error: opencv2/opencv.hpp: No such file or directory
compilation terminated.
/cygdrive/c/native_work/android-ndk-r8b/build/core/build-binary.mk:255: recipe for target `obj/local/armeabi-v7a/objs/main/NotePaperDetector.o' failed
make: *** [obj/local/armeabi-v7a/objs/main/NotePaperDetector.o] Error 1
With the latest NDK releases you don't need Cygwin at all.
By the way a GNU/Linux platform is always the best for Android developers.

Categories

Resources