building android-ndk? - android-ndk

I want to build an off-line speech recognition application for android.For that i tried building android NDK.But when i give ndk-build command i get the following error.I have no idea what that means as i am very new to Linux environment..Anyone please help me.
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/home/cenuser/android/android-ndk-r7b/build/core/build-local.mk:130: *** Android NDK: Aborting . Stop.
and when i changed the location to i got this
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c:760:26: error: pocketsphinx.h: No such file or directory
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c:761:28: error: sphinxbase/err.h: No such file or directory
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c: In function 'new_Hypothesis':
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c:780: warning: initialization makes pointer from integer without a cast
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c:782: warning: assignment makes pointer from integer without a cast
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c:784: warning: assignment makes pointer from integer without a cast
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c: In function 'new_Config__SWIG_0':
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c:795: error: 'FALSE' undeclared (first use in this function)
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c:795: error: (Each undeclared identifier is reported only once
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c:795: error: for each function it appears in.)
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c: In function 'new_Config__SWIG_1':
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c:799: error: 'FALSE' undeclared (first use in this function)
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c: In function 'Config_getString':
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c:830: warning: return makes pointer from integer without a cast
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c: In function 'new_Decoder__SWIG_0':
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c:839: error: 'FALSE' undeclared (first use in this function)
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c: In function 'new_Decoder__SWIG_1':
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c:843: warning: initialization makes pointer from integer without a cast
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c: In function 'Decoder_getConfig':
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c:847: warning: return makes pointer from integer without a cast
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c: In function 'Decoder_getUttid':
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c:856: warning: return makes pointer from integer without a cast
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c: In function 'Decoder_getHyp':
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c:869: error: 'int32' undeclared (first use in this function)
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c:869: error: expected ';' before 'best_score'
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c:870: error: 'best_score' undeclared (first use in this function)
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c: In function 'Java_edu_cmu_pocketsphinx_pocketsphinxJNI_Decoder_1processRaw_1_1SWIG_10':
/home/cenuser/android/sphinx/PocketSphinxDemo/jni/pocketsphinx_wrap.c:1441: warning: assignment discards qualifiers from pointer target type
make: *** [/home/cenuser/android/sphinx/PocketSphinxDemo/obj/local/armeabi/objs-debug/pocketsphinx_jni/pocketsphinx_wrap.o] Error 1

Go to the ndk root folder from terminal
Type the command with your project path
ndk-build -C your_project_path
This will solve the problem. If you want more information on "ndk-build" command just type the command
ndk-build --help

This usually happens when you invoke ndk-build from incorrect diretory. You must be in folder which contains jni subdirectory.
Or alternatively do what error message tells you - specify NDK_PROJECT_PATH to correct folder.

you need to declare the path to the location while running the ndk-build command
1. cd
2. ndk-build NDK_PROJECT_PATH=

Go to /build/core
Change the NDK_PROJECT_PATH to app project path
Open terminal
Go to Project folder
Run the NDK_BUILD

This could be solves as follows:
I have faced the same problem. I was working on an text recognition application.
1- You should go the directory of your folder (which is inside the AndroidStudioProjects - "YOUR PROJECT",
2- There should be a jni (Java Native interface) folder. Search for this folder. whenever, this is found.
3- cd in cmd to that folder (The Parent folder of jni).
4- run **ndk-build**

Related

Crypto++ causes undefined reference in Qt Creator, but not in code::blocks

Nearly every function from Crypto++ produces undefined reference in Qt Creator, code::blocks however runs just great.
LIBS+= -lcryptopp
in .pro file seems to work as I can include needed files and declare variables unless constructor is overloaded.
For example
CryptoPP::Integer integer;
std::string str=CryptoPP::IntToString(integer, 10);
Throws
.../main.cpp:54: undefined reference to `std::string CryptoPP::IntToString<CryptoPP::Integer>(CryptoPP::Integer, unsigned int)'
collect2: error: ld returned 1 exit status
make: *** [PDBM] Error 1
07:10:21: The process "/usr/bin/make" exited with code 2.
cryptest.pro
Makefile
full rebuild //sorry, stackoverflow wants those links to be a code
/usr/lib/ contains libcrypto++.a, libcrypto++.so, libcryptopp.so and link to libcrypto++.a named libcryptopp.a
New findings: I have tried to compile this library before and now my project folder has all the .h and .cpp files in cryptopp folder. To provide all the code without showing the code new project has been created and more errors appeared:
In file included from /usr/include/cryptopp/secblock.h:7:0,
from /usr/include/cryptopp/integer.h:7,
from ../cryptest/main.cpp:7:
/usr/include/cryptopp/misc.h: In instantiation of ‘std::string CryptoPP::IntToString(T, unsigned int) [with T = CryptoPP::Integer; std::string = std::basic_string<char>]’:
../cryptest/main.cpp:54:54: required from here
/usr/include/cryptopp/misc.h:424:58: error: invalid cast from type ‘CryptoPP::Integer’ to type ‘char’
result = char((digit < 10 ? '0' : ('a' - 10)) + digit) + result;
^
Makefile:1113: recipe for target 'main.o' failed
Which means that cryptopp has been using those new .h files. So it is not only a problem with linker as I previously thought.
I'm on Ubuntu 16.04, using Qt 5.8 and Crypto++ from repository.
-lcryptopp
This option simply tells your linker that you want to link to a shared library called libcryptopp.so. However, it does not tell your linker where to find the shared library.
You must specify the folder which contains the developer's copy of the library, using the -L option. For example, if the library is in /usr/lib, then write this:
LIBS += -L/usr/lib/ -lcryptopp

building mDNSResponder-master fails on linux machine (ubuntu 32-bit)

I am building mDNSResponder-master on my linux machine (ubuntu 32-bit).
I did the following steps:
1. cd ./mDNSPosix
2. make os=linux
I get the following error message:
mDNSPosix.c: In function ‘mDNSPlatformTCPAccept’:
mDNSPosix.c:364:13: **error: ‘fd’ undeclared** (first use in this function)
mDNSPosix.c:364:13: note: each undeclared identifier is reported only once for each function it appears in
mDNSPosix.c:359:71: warning: unused parameter ‘sd’ [-Wunused-parameter]
mDNSPosix.c: In function ‘mDNSPlatformTCPConnect’:
mDNSPosix.c:375:115: warning: unused parameter ‘hostname’ [-Wunused-parameter]
make: *** [objects/prod/mDNSPosix.c.o] Error 1
When I look into ‘mDNSPlatformTCPAccept() function in mDNSPosix.c, I find the following affestation: sock->fd = fd; while fd isn't a global variable so the compiler seems to have right.
How can I fix such error while I shouldn't modify the source code?
Thanks in advance.
Regards,
Problem fixed when using the latest version of DNS Server provided here:
http://opensource.apple.com/tarballs/mDNSResponder/
Thanks for all

Unable to make Mod_mono in Red Hat even after configure has completed without errors

I have successfully run the configure script for mod_mono, but get multiple error messages while making mod_mono in my RHEL 5 server. I ran configure with the following options: ./configure --with-apr-config=/usr/local/bin/apr-1-config --with-apu-config=/usr/local/bin/apu-1-config --with-apxs=/usr/local/bin/apxs --prefix=/usr/local
I have apache 2.4.6 installed along with mono 2.10.2. These are my error messages from make:
mod_mono.c: In function âapache_get_useridâ:
mod_mono.c:389: error: âunixd_configâ undeclared (first use in this function)
mod_mono.c:389: error: (Each undeclared identifier is reported only once
mod_mono.c:389: error: for each function it appears in.)
mod_mono.c: In function âapache_get_groupidâ:
mod_mono.c:399: error: âunixd_configâ undeclared (first use in this function)
mod_mono.c: In function âapache_get_usernameâ:
mod_mono.c:409: error: âunixd_configâ undeclared (first use in this function)
mod_mono.c: In function âensure_dashboard_initializedâ:
mod_mono.c:488: warning: implicit declaration of function âunixd_set_global_mutex_permsâ
mod_mono.c: In function âconnection_get_remote_portâ:
mod_mono.c:854: warning: implicit declaration of function âapr_sockaddr_port_getâ
mod_mono.c:854: error: âconn_recâ has no member named âremote_addrâ
make[1]: *** [mod_mono_la-mod_mono.lo] Error 1
I am totally stuck at this point and have been searching for a solution for days, but to no avail. Any help in this regard would be much appreciated.
I have resolved my issue. The easiest way is to install monodevelop using yum by following the steps mentioned in the below url :
http://mostlylinux.com/tmp/?p=91

Can't Cross Compile GDBServer for MIPS n32

I'm having trouble cross compiling GDBServer for MIPS n32. I'm using GCC-4.7.2, binutils-2.22, glibc-2.11.1, glibc-ports-2.11, and linux-2.6.32.61. My host is x86_64-cross-linux-gnu. My target is mips64-elf-linux. The specific ABI for MIPS is n32.
When I go to make GDBserver, I get an error while compiling regcache.c. regcache.c is in the gdb/gdbserver/. There is a struct called 'reg' that gcc is trying to compile. I have included all of the mips include files. I can compile GDBServer for x86 however. I greped all of the include files in /usr/include/ to try to find "struct reg" and was unsuccessful on finding anything. I found this article and I changed the names hoping that it would correct the issue but that won't work because the reg struct in regcache.c has attributes like offset and value. I have also tried messing with pt_regs in ptrace.h. However I don't think I should have to mess with the files that come with GDBServer.
My configure command is:
CC=mips64-elf-linux-gcc configure --host=x86_64-cross-linux-gnu --target=mips64-elf-linux
Does anyone know why I can't comiple GDBServer for Mips n32?
Thanks,
UPDATE:
../gdb-7.6/gdb/gdbserver/regcache.c:207:7: error: invalid use of undefined type 'struct reg'
../gdb-7.6/gdb/gdbserver/regcache.c:207:7: error: dereferencing pointer to incomplete type
../gdb-7.6/gdb/gdbserver/regcache.c:208:7: error: invalid use of undefined type 'struct reg'
../gdb-7.6/gdb/gdbserver/regcache.c:208:7: error: dereferencing pointer to incomplete type
../gdb-7.6/gdb/gdbserver/regcache.c: In function 'find+_register_by_name'
../gdb-7.6/gdb/gdbserver/regcache.c:295:7: error: invalid use of undefined type 'struct reg'
../gdb-7.6/gdb/gdbserver/regcache.c:295:7: error: dereferencing pointer to incomplete type
../gdb-7.6/gdb/gdbserver/regcache.c: In function 'find_regno'
../gdb-7.6/gdb/gdbserver/regcache.c:315:7: error: invalid use of undefined type 'struct reg'
../gdb-7.6/gdb/gdbserver/regcache.c:315:7: error: dereferencing pointer to incomplete type

compiling rtmpdump for arm

I am trying to compile rtmpdump (http://rtmpdump.mplayerhq.hu/) for Qnap NAS 419p (arm)
I am not very exprenced with linux or compilation but am trying to learn.
make is complaining that it cant find openssl and im not sure where to start?
[/share/Qdownload/src] # ipkg install openssl
Package openssl (0.9.8v-2) installed in root is up to date.
Nothing to be done
Successfully terminated.
confirms that i have installed openssl
[/share/Qdownload/src] #
[/share/Qdownload/src] # ipkg install zlib
Package zlib (1.2.5-1) installed in root is up to date.
Nothing to be done
Successfully terminated.
[/share/Qdownload/src] #
confirms i have zlib the only other depenance i think i need.
[/share/Qdownload/src] # make linux
make[1]: Entering directory `/share/MD0_DATA/Qdownload/src'
g++ -Wall -O2 -c -o rtmp.o rtmp.cpp
In file included from rtmp.h:44,
from rtmp.cpp:42:
dh.h:22:24: error: openssl/bn.h: No such file or directory
dh.h:23:24: error: openssl/dh.h: No such file or directory
dh.h:25:25: error: openssl/sha.h: No such file or directory
dh.h:26:26: error: openssl/hmac.h: No such file or directory
dh.h:27:25: error: openssl/rc4.h: No such file or directory
In file included from rtmp.h:44,
from rtmp.cpp:42:
dh.h:34: error: 'BIGNUM' was not declared in this scope
dh.h:34: error: 'y' was not declared in this scope
dh.h:34: error: 'BIGNUM' was not declared in this scope
dh.h:34: error: 'p' was not declared in this scope
dh.h:34: error: 'BIGNUM' was not declared in this scope
dh.h:34: error: 'q' was not declared in this scope
dh.h:34: error: initializer expression list treated as compound expression
dh.h:35: error: expected constructor, destructor, or type conversion before '*' token
dh.h:36: error: 'DH' was not declared in this scope
dh.h:36: error: 'dh' was not declared in this scope
dh.h:37: error: 'DH' was not declared in this scope
dh.h:37: error: 'dh' was not declared in this scope
dh.h:37: error: expected primary-expression before '*' token
dh.h:37: error: 'pubkey' was not declared in this scope
dh.h:37: error: expected primary-expression before 'nPubkeyLen'
dh.h:37: error: initializer expression list treated as compound expression
dh.h:38: error: 'DH' was not declared in this scope
dh.h:38: error: 'dh' was not declared in this scope
dh.h:38: error: expected primary-expression before '*' token
dh.h:38: error: 'privkey' was not declared in this scope
dh.h:38: error: expected primary-expression before 'nPrivkeyLen'
dh.h:38: error: initializer expression list treated as compound expression
dh.h:39: error: 'DH' was not declared in this scope
dh.h:39: error: 'dh' was not declared in this scope
dh.h:39: error: expected primary-expression before '*' token
dh.h:39: error: 'pubkey' was not declared in this scope
dh.h:39: error: expected primary-expression before 'nPubkeyLen'
dh.h:39: error: expected primary-expression before '*' token
dh.h:39: error: 'secret' was not declared in this scope
dh.h:39: error: initializer expression list treated as compound expression
dh.h:40: error: variable or field 'DHFree' declared void
dh.h:40: error: 'DH' was not declared in this scope
dh.h:40: error: 'dh' was not declared in this scope
In file included from rtmp.cpp:42:
rtmp.h:97: error: ISO C++ forbids declaration of 'DH' with no type
rtmp.h:97: error: expected ';' before '*' token
rtmp.h:98: error: ISO C++ forbids declaration of 'RC4_KEY' with no type
rtmp.h:98: error: expected ';' before '*' token
rtmp.h:99: error: ISO C++ forbids declaration of 'RC4_KEY' with no type
rtmp.h:99: error: expected ';' before '*' token
rtmp.cpp: In member function 'int RTMP_LIB::CRTMP::ReadN(char*, int)':
rtmp.cpp:653: error: 'struct RTMP_LIB::LNK' has no member named 'rc4keyIn'
rtmp.cpp:654: error: 'struct RTMP_LIB::LNK' has no member named 'rc4keyIn'
rtmp.cpp:654: error: 'RC4' was not declared in this scope
rtmp.cpp: In member function 'bool RTMP_LIB::CRTMP::WriteN(const char*, int)':
rtmp.cpp:672: error: 'struct RTMP_LIB::LNK' has no member named 'rc4keyOut'
rtmp.cpp:674: error: 'struct RTMP_LIB::LNK' has no member named 'rc4keyOut'
rtmp.cpp:674: error: 'RC4' was not declared in this scope
make[1]: *** [rtmp.o] Error 1
make[1]: Leaving directory `/share/MD0_DATA/Qdownload/src'
make: *** [linux] Error 2
[/share/Qdownload/src] #
Thanks for any advice you can give.
Make sure to install the development versions of the openssl and zlib packages.
Also make sure that openssl directory is somewhere in standard system include directories which should be /usr/include and /usr/local/include and some others depending on your tool chain.
But don't take my word for it and execute cpp -v < /dev/null. It runs the GNU C Preprocessor with input from /dev/null. Should print the directory search paths. Look for "#include <...> search starts here:" followed by a list of standard include search paths. This is also the order of inclusion.
If you are compiling for ARM it is not enough to install libraries for your own distro... you need libraries and a cross-compiler which runs on your development machine (probably x86 or x86_64) but generates code for the target platform (ARM).
If you don't have a cross-compiler for this Qnap NAS, this link should help you generate one with crosstool-ng, which is a great tool which helps you build cross-compilers from scratch. Then you will probably need a root filesystem with libraries made for your target platform too.
Everything involving cross-compiling is non-trivial, but we can try to help. What distro are you running on your machine?

Resources