getting error in android NDK while using ndk-build - android

i am new in android ndk and i m making connection of java and c/c++ code and at last moment when i use ndk-build command then i got this error.
please help me to clear this problem.
I am working on ubuntu 12.04. and i got same error on both linux and windows and on windows i use using cygwin.
Error-
/home/saicomputer/android-ndk-r8e/build/core/add-application.mk:128: Android NDK: WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml
Compile thumb : myjni <= native.c
jni/native.c: In function 'Java_com_example_demo_MainActivity_hello':
jni/native.c:4:3: error: parameter name omitted
jni/native.c:4:3: error: parameter name omitted
jni/native.c:5:10: error: 'env' undeclared (first use in this function)
jni/native.c:5:10: note: each undeclared identifier is reported only once for each function it appears in
jni/native.c: In function 'Java_com_example_demo_MainActivity_add':
jni/native.c:9:3: error: parameter name omitted
jni/native.c:9:3: error: parameter name omitted
jni/native.c:9:3: error: parameter name omitted
jni/native.c:9:3: error: parameter name omitted
jni/native.c:10:9: error: 'value1' undeclared (first use in this function)
jni/native.c:10:18: error: 'value2' undeclared (first use in this function)
make: *** [obj/local/armeabi/objs/myjni/native.o] Error 1
please help me out to overcome this problem.
thanks.

Related

Kernel Compiling error

whenever i try to compile the samsung stock 4.4.2 kernel i m getting this error
CC arch/arm/mach-msm/board-8930-display.o
arch/arm/mach-msm/board-8930-display.c: In function 'mipi_dsi2lvds_cdp_panel_power':
arch/arm/mach-msm/board-8930-display.c:577:3: error: implicit declaration of function 'msm_xo_get' [-Werror=implicit-function-declaration]
arch/arm/mach-msm/board-8930-display.c:577:26: error: 'MSM_XO_TCXO_A1' undeclared (first use in this function)
arch/arm/mach-msm/board-8930-display.c:577:26: note: each undeclared identifier is reported only once for each function it appears in
arch/arm/mach-msm/board-8930-display.c:663:3: error: implicit declaration of function 'msm_xo_mode_vote' [-Werror=implicit-function-declaration]
arch/arm/mach-msm/board-8930-display.c:663:31: error: 'MSM_XO_MODE_ON' undeclared (first use in this function)
arch/arm/mach-msm/board-8930-display.c:671:31: error: 'MSM_XO_MODE_OFF' undeclared (first use in this function)
cc1: some warnings being treated as errors
make[1]: *** [arch/arm/mach-msm/board-8930-display.o] Error 1
make: *** [arch/arm/mach-msm] Error 2 }
this is the lines the terminal pointed to in board-8930-display.c
rfa_clock = msm_xo_get (MSM_XO_TCXO_A1, id); /create a handle for Aq buffer of XO/
msm_xo_mode_vote(rfa_clock, MSM_XO_MODE_ON); /Vote to turn ON the clock buffer/
3.msm_xo_mode_vote(rfa_clock, MSM_XO_MODE_OFF); /Vote to turn OFF the clock buffer/
how can this be fixed ?

How to cross-compile OpenSSH for ARM?

I am trying to compile OpenSSH using the Android NDK, but failing.
My attempt consists of the following steps:
cross-compile OpenSSL for Android and install headers / libraries to /home/me/arm
grab OpenSSH 6.2p1 from here
extract the archive and run ./configure:
./configure --prefix=/home/me/arm \
--host=arm-linux-androideabi \
--with-ssl-dir=/home/me/arm
...which resulted in the following error:
getrrsetbyname.c:166:2: error: unknown type name 'HEADER'
modify the ./configure command to include:
ac_cv_search_getrrsetbyname=yes
...which fixed the one problem but still aborted with another error:
/usr/include/linux/un.h:17:8: error: redefinition of 'struct sockaddr_un'
modify the ./configure command again to include:
ac_cv_header_sys_un_h=yes
...which got me even further but still aborted with an error:
channels.c: In function 'channel_prepare_select':
channels.c:2143:2: warning: implicit declaration of function 'howmany'
[-Wimplicit-function-declaration]
channels.c:2145:45: error: 'fd_mask' undeclared (first use in this function)
Now I'm stuck. I've cracked open Android's sys/select.h and discovered that fd_mask isn't defined anywhere. I also was unable to find a ./configure option to work around this. There's also the issue with howmany() being undefined.
What changes do I need to make to get the program to compile?
Edit: I've managed to get a little bit further now. I've added the following line to ./configure to get past the "undefined fd_mask" error:
--with-cflags=-Dfd_mask=int
I then received the following error:
error: 'struct passwd' has no member named 'pw_gecos'
Android's passwd struct does not have a pw_gecos member. This one was impossible to correct without creating an actual patch for the source code. The patch is here.
I am now stuck with the following error:
dns.c: In function 'dns_result_totext':
dns.c:56:7: error: 'ERRSET_SUCCESS' undeclared (first use in this function)
dns.c:56:7: note: each undeclared identifier is reported only once for each
function it appears in
dns.c:58:7: error: 'ERRSET_NOMEMORY' undeclared (first use in this function)
...
Edit: I've made some modifications to the patch above that eliminate quite a few of the errors so far. I've also added ldns. The configure command now looks like this:
patch -p0 <openssh.patch;
autoconf;
./configure --prefix=/home/me/arm \
--host=arm-linux-androideabi \
--with-ldns=/home/me/arm \
--with-ssl-dir=/home/me/arm \
ac_cv_header_sys_un_h=yes
...and here is the new patch. The errors I get now are:
loginrec.c: In function 'construct_utmp':
loginrec.c:665:17: error: 'DEAD_PROCESS' undeclared (first use in this function)
loginrec.c:665:17: note: each undeclared identifier is reported only once for
each function it appears in
loginrec.c: At top level:
loginrec.c:727:45: warning: 'struct utmpx' declared inside parameter list
[enabled by default]

CMU-Sphinx android build error

I recently using CMU-Sphinx for Android. When I try to build the sample project from the websites, I got the following error:
"Compile thumb : pocketsphinx_jni <= pocketsphinx_wrap.c
C:/CMUSphhinx/PocketSphinxAndroidDemo//jni/pocketsphinx_wrap.c: In function 'nbest_s_hyp':
C:/CMUSphhinx/PocketSphinxAndroidDemo//jni/pocketsphinx_wrap.c:793:6: warning: return makes pointer from integer without a cast [enabled by default]
C:/CMUSphhinx/PocketSphinxAndroidDemo//jni/pocketsphinx_wrap.c: In function 'ps_decoder_s_getHyp':
C:/CMUSphhinx/PocketSphinxAndroidDemo//jni/pocketsphinx_wrap.c:847:3: warning: return makes pointer from integer without a cast [enabled by default]
SharedLibrary : libpocketsphinx_jni.so
C:/CMUSphhinx/PocketSphinxAndroidDemo//obj/local/armeabi/objs/pocketsphinx_jni/pocketsphinx_wrap.o: In function nbest_s_hyp':
C:/CMUSphhinx/PocketSphinxAndroidDemo//jni/pocketsphinx_wrap.c:793: undefined reference tonew_Hypothesis'
C:/CMUSphhinx/PocketSphinxAndroidDemo//obj/local/armeabi/objs/pocketsphinx_jni/pocketsphinx_wrap.o: In function ps_decoder_s_getHyp':
C:/CMUSphhinx/PocketSphinxAndroidDemo//jni/pocketsphinx_wrap.c:847: undefined reference tonew_Hypothesis'
collect2: ld returned 1 exit status
make: * [C:/CMUSphhinx/PocketSphinxAndroidDemo//obj/local/armeabi/libpocketsphinx_jni.so] Error 1
I am using Windows with these tools:
eclipse Indigo.
android 2.2 sdk
android ndkbuild-r8b
swigwin-2.0.8
and this is my configuration on my eclipse:
SWIG:
Main: C:\swigwin-2.0.8\swig.exe
NDK-build:
Main:
C:\android-ndk-r8b\ndk-build.cmd
Try swig 1.3. There could be issues with 2.0. Check full build log for details.
pocketsphinx-0.7 is incompatible with the swig-2.0.8

libpcap static linking errors compiling with ndk toolchains for android

I have downloaded the libpcap in external folder from android source code using the Git and
repo. I used the toolcains of ndk (android-ndk-r5b) to compile the library following these
steps:
./configure --prefix=path-to-android-src/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin
make clean
make
make install
and then a file libpcap.a is produced.
I have make a simple sniffer using libpcap (sniffer.c). When I try to compile it, these errors occur:
agcc sniffer.c libpcap.a
sniffer.c:9:18: error: pcap.h: No such file or directory
sniffer.c:19: warning: 'struct pcap_pkthdr' declared inside parameter list
sniffer.c:19: warning: its scope is only this definition or declaration, which is probably not what you want
sniffer.c: In function 'processPacket':
sniffer.c:23: warning: incompatible implicit declaration of built-in function 'printf'
sniffer.c:24: error: dereferencing pointer to incomplete type
sniffer.c:26: error: dereferencing pointer to incomplete type
sniffer.c:33: error: dereferencing pointer to incomplete type
sniffer.c: In function 'main':
sniffer.c:45: error: 'pcap_t' undeclared (first use in this function)
sniffer.c:45: error: (Each undeclared identifier is reported only once
sniffer.c:45: error: for each function it appears in.)
sniffer.c:45: error: 'descr' undeclared (first use in this function)
sniffer.c:46: error: 'PCAP_ERRBUF_SIZE' undeclared (first use in this function)
sniffer.c:62: warning: incompatible implicit declaration of built-in function 'printf'
sniffer.c:66: warning: incompatible implicit declaration of built-in function 'fprintf'
sniffer.c:66: error: 'stderr' undeclared (first use in this function)
sniffer.c:72: warning: incompatible implicit declaration of built-in function 'fprintf'
when I try to produce the object code in advance:
agcc -c sniffer.o sniffer.c
the same errors occured.
Can someone explain me how to solve this problem?
here is the alias of agcc I use in bashrc file:
./configure --prefix=/home/petsas/projects/mobile-attacks/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/
Also, I have attached a file with the outputs of the commands above: configure, make and make install.
(I put the errors in code style because there were errors of alignment)
Thank you in advance!
-- update --
I used the options -I and -L to specify the include and library files, and these errors are gone now..
Here is my new error log:
agcc --static -I /home/petsas/projects/mobile-attacks/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/include -L /home/petsas/projects/mobile-attacks/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/lib -o sniffer sniffer.c libpcap.a
/home/petsas/projects/mobile-attacks/android-ndk-r5b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: libpcap.a(pcap-linux.o): Relocations in generic ELF (EM: 3)
/home/petsas/projects/mobile-attacks/android-ndk-r5b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: libpcap.a(pcap-linux.o): Relocations in generic ELF (EM: 3)
/home/petsas/projects/mobile-attacks/android-ndk-r5b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: libpcap.a(pcap-linux.o): Relocations in generic ELF (EM: 3)
libpcap.a: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
any ideas?
Heading
I couldn't find the solution following the way I describe above, but I made it through
writing a Android.mdk file and by using the ndk-build of android NDK.
I put the libpcap direcotry into the android-ndk-r5b/samples, I modified a bit the Android.mdk
and the structure of the direcotry, so as to look like the other ones inside the samples dir and
I used the ndk-build command inside the android-ndk-r5b direcory:
ndk-build -C samples/android-ndk-r5b
All worked fine! I was able to produce a libpicap.so file, and put it in the phone using the
commands:
in android (phone):
$ su
# mount -o,rw remount /dev/block/mtdblock4 /system/lib
in my Desktop:
$ adb push libpcap.so /system/lib/
I made a simple sniffer, I compiled and linked with the libpcap.so and works perfectly in
my HTC Hero! ;)

Problem building STLport NDK r5/ Android

I'm trying to build STLport for Android. I got the following steps, but they are not working:
1 - Clone STLport repository using:
git clone git://stlport.git.sourceforge.net/gitroot/stlport/stlport
2 - Configure environment using :
./configure --target=arm-eabi --with-extra-cxxflags="-fshort-enums"
--with-extra-cflags="-fshort-enums"
3 - From src directory build it using
make SYSROOT"{MY NDK path}/platforms/android-5/arch-arm/" release-static
But I got the following errors:
In file included from ../stlport/stl/_alloc.h:45,
from ../stlport/memory:29,
from dll_main.cpp:41:
../stlport/stl/_new.h:45:24: error: new: No such file or directory
In file included from ../stlport/stl/_limits.h:36,
from ../stlport/limits:29,
from dll_main.cpp:48:
../stlport/stl/_cwchar.h:26:30: error: cstddef: No such file or directory
In file included from ../stlport/stl/_utility.h:35,
from ../stlport/utility:35,
from dll_main.cpp:40:
../stlport/type_traits:889: error: 'declval' was not declared in this scope
../stlport/type_traits:889: error: expected primary-expression before '>' token
../stlport/type_traits:889: error: expected primary-expression before ')' token
../stlport/type_traits:889: error: 'declval' was not declared in this scope
../stlport/type_traits:889: error: expected primary-expression before '>' token
../stlport/type_traits:889: error: expected primary-expression before ')' token
../stlport/type_traits:889: error: ISO C++ forbids declaration of 'decltype' with no type
../stlport/type_traits:889: error: ISO C++ forbids in-class initialization of non-const static member 'decltype'
../stlport/type_traits:889: error: template declaration of 'int std::tr1::detail::decltype'
../stlport/type_traits:942: error: ISO C++ forbids declaration of 'decltype' with no type
../stlport/type_traits:942: error: ISO C++ forbids in-class initialization of non-const static member 'decltype'
../stlport/type_traits:942: error: template declaration of 'int std::tr1::detail::decltype'
make: *** [obj/arm-eabi-gcc/so/dll_main.o] Error 1
Is there any include dir or configuration I´m missing?
Thanks,
Sergio
Android NDK r5 now has STL support, just add APP_STL := stlport_staticto your Android.mk file, valid options for APP_STL variable are;
stlport_static
stlport_shared
gnustl_static
Note that only gnustl_static variant supports exceptions.
I've manage to compile STL-Port on Android NDK R3 using STLPort GIT repository. A few "adaptations" are necessary however. You can find a description on the procedure here. It should work for NDK R5 too.
Hope that helps.
The last version on git seems to be broken. Try use a previous version (I've used the one from Wed, Dec 1st 2010 and it worked fine).

Categories

Resources