I'm starting to use the android ndk (r8c), and for that I have installed a fresh version of Ubuntu 12.10 (32bit)
Problem, whatever I try to build, I got freaky errors that drive me crazy...
~/workspace/Test$ ndk-build
Compile thumb : Test <= Test.c
SharedLibrary : libTest.so arm-linux-androideabi-g++: error:
./obj/local/armeabi/objs/Test/Test.o: No such file or directory make:
* [obj/local/armeabi/libTest.so] Error 1
So here, I try to run ndk-build on a simple hello world in jni. I can't understand the problem, as I thought the ndk-build command was suppose to create Test.o itself...
So I tried the same thing with ndk-r7 (we never know), and it is even uglier...
~/workspace/Test$ ~/Code/android-ndk-r7/ndk-build
Compile thumb :
Test <= Test.c Messages de l'assembleur: Erreur fatale: option -march=
invalide: « armv5te » make: * [obj/local/armeabi/objs/Test/Test.o]
Erreur 1
I can't find any answer that seems to help. (I've also tried to build hello-jni sample the same way, but the output was the same.
Please, someone save my hair... Hope I've been clear enough.
So I decided to reinstall my ubuntu, and it worked well this time.
I still have no idea why it didn't the first time, as I think I have done exactly the same manipulation (I went to Ubuntu 12.04 instead of 12.10 though).
Related
I am new to this build system, but I've spent dozens of hours trying to get qmake + clang to produce a working android binary. I would appreciate any help or advice. Here is as simple an example as I can come up with:
First, here is a working build command. It gives me a shared object that I can call from android (with Unity, using C# native interops):
C:\Users\deltav\AppData\Local\Android\Sdk2\ndk\21.3.6528147\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe ^
-target aarch64-none-linux-android21 -shared -v ^
-DANDROID_ABI=arm64-v8a -DANDROID_ARM_MODE=arm -DANDROID ^
M:\simpleExample\simpleExample.c ^
-o M:\simpleExample\libsimpleExample.so
Here is the verbose output of running that command: https://pastebin.com/18HcnDYh
On the other hand, here is the simpleExample.pro file that is NOT giving me a good binary: https://pastebin.com/wxrx6Myc
Here is the qmake output for building in release mode: https://pastebin.com/KWavwrb7
As you will know, qmake uses a kit to execute the project. My kit: https://imgur.com/a/Ehtmgin
The specific issue that has pushed me down this debugging path is from C# trying to load my shared object like this:
[DllImport("simpleExample")]
public static extern float getSpeedY();
The error that I get is this:
"DllNotFoundException: Unable to load DLL 'simpleExample': The
specified module could not be found."
Again, this error is not an issue if I just build from the CLI without qmake. I do not beleive this is a unity or C# error, as I worked the problem from that side first.
What I have tried so far:
I have used multiple ELF & DWARF tools to compare the ABIs of the generated binaries, which all told me the binaries were identical.
I tweaked and shaved down the clang calls that qmake generated until I got a vaild build command. Unfortunately I can't just replace qmake with the complile command because there are other projects that I need to apply this fix to.
QMake version 3.1
Ironically, CMake basically works out of the box.
Answer: Looking at the clang linking call, you can see QMake 3.1 was adding "libc++shared" as a dependency. I'm not sure why, as this was a C project.
The equivalent CMake project did not do this.
Packaging libc++shared with my binary fixed the issue.
I'm new to Android programming and NDK, so i've followed this tutorial:
http://mindtherobot.com/blog/452/android-beginners-ndk-setup-step-by-step/ to
install and config cygwin and NDK. The problem appears when I try to execute
ndk-build command. It displays the following error message:
$ $NDK/ndk-build
Android NDK: WARNING: APP_PLATFORM android-18 is larger than android:minSdkVersion 3in ./AndroidManifest.xml
Gdbserver : [arm-linux-androideabi-4.6] libs/armeabi/gdbserver
install: nie można wykonać stat na `/cygdrive/d/Programowanie/Tools/ADT/NDK/prebuilt/android-arm/gdbserver/gdbserver': No such file or directory
/cygdrive/d/Programowanie/Tools/ADT/NDK/build/core/setup-toolchain.mk:155: polecenia dla obiektu 'libs/armeabi/gdbserver' nie powiodły się
make: *** [libs/armeabi/gdbserver] Błąd 1
Error messages are written in polish so here's my translation, however I'm not sure whether
it's fully correct:
$ $NDK/ndk-build
Android NDK: WARNING: APP_PLATFORM android-18 is larger than android:minSdkVersion 3in ./AndroidManifest.xml
Gdbserver : [arm-linux-androideabi-4.6] libs/armeabi/gdbserver
install: Cannot execute stat on `/cygdrive/d/Programowanie/Tools/ADT/NDK/prebuilt/android-arm/gdbserver/gdbserver': No such file or directory
/cygdrive/d/Programowanie/Tools/ADT/NDK/build/core/setup-toolchain.mk:155: commands for object 'libs/armeabi/gdbserver' didn't succeed.
make: *** [libs/armeabi/gdbserver] Error 1
I honestly have no idea what could have caused such an error, so I'm counting that
You can help me anyhow.
Thanks :-)
Modern versions of NDK do not need cygwin. Try to run you build from normal cmd prompt. To be on the safe side, remove cygwin\bin from PATH.
I have fixed my issue with NDK by downloading it again and reinstalling.
It seems like I haven't downloaded entire NDK package, and that it caused
the problem. Sorry for trouble, I should have checked whether reinstall
could help in this case on the beginning, but this idea must have slept
my mind.
Thanks for letting me know that I don't need cygwin for NDK anymore :-)
Best regards, Buyuk.
I am trying to compile android-NDK project which uses L2CAP Bluetooth profile.When I compile in eclipse with android-ndk-r8d-windows and android-sdk-4.2 I am getting following error
arm-linux-androideabi-g++: error: libbluetooth.so: No such file or directory
make: *** [obj/local/armeabi/libl2cap_BTComm.so] Error 1
Please help me in solving this
I got the same problem in Ubuntu 12.04 while building the ndk project using ndk-build.
The problem is the missing g++ compiler. After install a GNU C++ compiler it works now.
Interestingly, when I recompile the whole project from fresh it got the same complain again.
(before I was using cygwin and ubuntu to compile the same project and it was working)
Its been over a year now since the last reply but I think the answer is to use the -l option of g++ to add the directory with the lib to g++'s search paths.
I'm having a hard time setting up PowerVR SDK for Android on Windows 8 64, assuming I met all requirements:
Android SDK (fresh Eclipse)
Android NDK
Cygwin (with make)
PowerVR Android SDK 3.0
I can perfectly make and run an Android NDK sample. However, the same process fails for building any PowerVR sample (from the SDK). Here's the output when I try to run the makefile:
$ ndk
Compile++ thumb : OGLES2Texturing <= OGLES2Texturing.cpp
arm-linux-androideabi-g++.exe: error: C:/cygwin///cygdrive/c/Users/stfn/workspaces/android/03_Texturing/jni/OGLES2Texturing.cpp: No such file or directory
arm-linux-androideabi-g++.exe: fatal error: no input files
compilation terminated.
/cygdrive/c/android-ndk-r8d/build/core/build-binary.mk:269: recipe for target `obj/local/armeabi/objs/OGLES2Texturing//cygdrive/c/Users/stfn/workspaces/android/03_Texturing/jni/OGLES2Texturing.o' failed
make: * [obj/local/armeabi/objs/OGLES2Texturing//cygdrive/c/Users/stfn/workspaces/android/03_Texturing/jni/OGLES2Texturing.o] Error 1
I suppose the error should be related to a wrong path given to the compiler. To me it looks like a mixture of standard Windows and Cygwin/Unix paths: * C:/cygwin///cygdrive/c/Users/stfn/...*
If been through so many makefiles now trying to resolve this issue but I just don't know where else to look. This is the first time I tried messing with the NDK. I'm afraid this could be my last.
Any help would be greatly appreciated
1.in the Android.mk file, for the PVRSDKDIR, set the path of your project folder in your workspace.
2.Copy the build, tools, and shell folders from the powervr sdk folder to your project folder
I am following the steps as in http://mindtherobot.com/blog/452/android-beginners-ndk-setup-step-by-step/comment-page-2/#comment-32553 to install ndk using cygwin and eclipse.
I installed all the required packages and software, including cygwin, gnuwin32, gcc, make, and android-ndk. Then I created a test android project, ndkfoo. Once I type /cygdrive/c/Android/android-ndk/ndk-build, I get the following error messages, see the bottom. I am guessing there is something wrong with my path setting, but I do not how to make the change. In the example, the first line from the console should looks like "Compile thumb : ndkfoo <= /cygdrive/c/Users/workspace/ndkfoo.c"
Does anyone have a clue where I should start? Thanks a lot.
Compile thumb : ndkfoo <= ndkfoo.c
arm-linux-androideabi-gcc.exe: C:/Users/workspace/ndkfoo/obj/local/armeabi/objs/ndkfoo/ndkfoo.o: No such file or directory
arm-linux-androideabi-gcc.exe: no input files
make: *** `[/cygdrive/c/Users/workspace/ndkfoo/obj/local/armeabi/objs/ndkfoo/ndkfoo.o] Error 1`
Looks like the problem is in your make file. Are you using Windows paths there by any chance?