how to build openssl on android - android

I am trying to build openssl on android (got from https://github.com/guardianproject/openssl-android). need to make .so file of this and use in another android project actually. When I try to add all folders of downloaded openssl and build in prompt through ndk-build command, I get an error like this:
Android NDK: Trying to define local module 'openssl' in workspace/project/apps/Android.mk.
Android NDK: But this module is was already defined by workspace/project/apps/Android.mk.
android-ndk-r8b/build/core/build-module.mk:34:
*** Android NDK: Aborting.. Stop.
Please let me know how to build .so file!!

Please check Android.mk, which is the make file for android. I think there is a silly mistake on that file.

Related

How to generate .so file for all architecture from cpp code android

i am using this library for live camera filter . I want to generate a .so file via Cpp on windows for all architecture (armeabi-v7a, armeabi,x86,x86_64) and got .so file generate now I have cross compile this .so file for Android ARM so I have to comiple it via Android NDK so that new genrated .so can be used in my android project .
i already have (armeabi-v7a, armeabi,x86) this architecture .so file, but unable to generate x86_64 architecture .so file ,
So can anyone help me how to generate .so file for x86_64 architecture from cpp code.
I hope my question is clear to you all, if not please tell me.
Please help me. Thanks in advance
If you have an NDK project file Android.mk that builds different versions of your .so, you only need to specify APP_ABI=arm64-v8a to get the missing one. If you use some other build system, you need to find the equivalent setting. Note that armeabi can probably be dropped, and it is not longer supported by the latest NDK r18.

How to add prebuilt .so files in android studio1.3

I have 2 .so files libA.so & libB.so and few header files which I am trying to add to my project and currently I am getting an error "undefined reference to <function name>" linker failed to link module. please let me know the correct process to link them as gradle has changed to 2.5 for android studio 1.3

How to build host static library with Android NDK?

I'm trying to build android adb tool from the sources. Since file Android.mk is presented i'm running ndk-build tool to build it. But unfortunately i'm having following errors:
/Users/user/Documents/dev/tmp/adb/jni/Android.mk:95: /softdev/android-ndk-r10c/build/core/build-host-static-library.mk: No such file or directory
/Users/user/Documents/dev/tmp/adb/jni/Android.mk:183: /softdev/android-ndk-r10c/build/core/build-host-executable.mk: No such file or directory
Android NDK: Trying to define local module 'adbd' in /Users/user/Documents/dev/tmp/adb/jni/Android.mk.
Android NDK: But this module was already defined by /Users/user/Documents/dev/tmp/adb/jni/Android.mk.
/softdev/android-ndk-r10c/build/core/build-module.mk:34: *** Android NDK: Aborting. . Stop.
I've checked files (build-host-*-*.mk) are absent for some reason. I've found them in someone's git repo, but it's for windows. After copying build-host-*-*.mk to my local ndk folder i'm getting another errors:
Android NDK: /Users/user/Documents/dev/tmp/adb/jni/Android.mk:adb: Unknown LOCAL_MODULE_CLASS value: HOST_STATIC_LIBRARY
/softdev/android-ndk-r10c/build/core/build-module.mk:29: *** Android NDK: Aborting . Stop.
So it seems that just copying that files is not enough. How can i make it built?
adb is a host tool (which runs on your PC rather than on the Android device), and NDK has no support for building host executables. It does provide some stubs but the feature was never fully implemented.
The git repo you are linking to is not the official NDK r7b but a patched version with host target support added. This includes a bit more than just a single file – see the full diff here.
You will need to apply this patch (or copy all the scripts which were modified) to your local NDK setup. If you are running an NDK version other than r7b, you may have to make some additional modifications.
See also my question, in which I basically ran into the same issue.

Unable to make and compile my NDK project on eclipse with Ubuntu

I have followed tutorials to implement NDK functionality in a test project. Created jni folder and added .mk and .c file. NDK is linked and the C++ make file has link to ndk-build file in NDK folder.
On building project i am getting this error :-
Build of configuration Default for project HomeTestingNDK **
/home/falooka/adt-bundle-linux-x86-20130917/ndk/ndk-build all
Compile thumb : HomeTestingNDK <= native.c
make: /home/falooka/adt-bundle-linux-x86-20130917/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: Command not found
make: * [obj/local/armeabi/objs/HomeTestingNDK/native.o] Error 127
Build Finished **
Now the issue is that 'make' is going for arm-linux-androideabi-gcc while this file doesn't exist in the folder and instead there is arm-linux-androideabi-gcc-4.6. Now I am totally struck how to solve this issue after googling for a while now.
Thanks in advance.
I was able to resolve my issue by following these multiple steps :
1) For some stupid reason, arm-linux-androideabi-gcc was missing in the ndk directory. So i tried re-installing the zip and extracted it inside the home folder instead of my drive to avoid ownership errors. Now file was there and this error was gone !
2) Then i was getting "Android NDK java.lang.UnsatisfiedLinkError: findLibrary returned null" error which had something to do with libraries missing. After reading some posts, it was prominent that the libs/ folder in project directory should have .so files which were not there. I am using OpenCv with my project so i updated the environment links and put explicit path to ndk-build file in 'make' to make sure it finds ndk-build.
3) I also did this : https://stackoverflow.com/a/7646921/1016544
So finally its compiling and shows building of .so files before installing and runs perfectly.

How do you use the build_native.sh tool?

I followed this tutorial on raywenderlich.com and I came into a stop on the part where I need to build the native C++ libraries for Android Development.
I am using Mac OS,Cocos2d-x v2.0.1 (latest version), have my Android SDK and NDK set up, and my Eclipse (Helios) with the correct plug-ins needed for C/C++. Now I'm have trouble building the Cocos2d-x libraries for Android development. I'm using the build-native.sh tool. If I use it on the terminal like so:
xxxxx-xxxxx-imac:proj.android xxxxx$ ./build-native.sh
I get the following:
Using prebuilt externals
Android NDK: WARNING: Ignoring unknown import directory: /Users/xxxxx/Desktop/LANCE/COCOS2DX/cocos2d-2.0-rc2-x-2.0.1/cocos2dx/platform/third_party/android/prebuilt
Android NDK: /Users/xxxxx/Desktop/LANCE/COCOS2DX/cocos2d-2.0-rc2-x-2.0.1/CocosDenshion/android/Android.mk: Cannot find module with tag 'cocos2dx' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:
make: Entering directory `/Users/xxxxx/Desktop/LANCE/COCOS2DX/cocos2d-2.0-rc2-x-2.0.1/testproj2/proj.android'
jni/Android.mk:19: *** Android NDK: Aborting. . Stop.
make: Leaving directory `/Users/xxxxx/Desktop/LANCE/COCOS2DX/cocos2d-2.0-rc2-x-2.0.1/testproj2/proj.android'
I looked at /Users/xxxxx/Desktop/LANCE/COCOS2DX/cocos2d-2.0-rc2-x-2.0.1/cocos2dx/platform/third_party/android/prebuilt but this directory does not exist (the platform folder is missing from the cocos2dx folder)
How do I fix this?
Thanks in advance.
EDIT: After looking through the scripts, I noticed that the cocos2dx folder in the cocos2dx root folder does not have an Android.mk file.
A re-unpacking of the Cocos2d-x ZIP did the trick. Turns out the files needed were deleted (for some reason) in the Cocos2d-x root folder.
build_native tool is obsolete now, Cocos2d-Console is used instead.

Categories

Resources