Android ndk file not found on github actions - android

I am trying to implement CI on app which contains native code in C++ using github actions
When i am running workflow it's says that there is no headers near the .cpp, but it is here and i have setted include directories in build.gradle and Android.mk file, the build is fine on local PC(windows)
[armeabi-v7a] Compile++ thumb: samp <= CAuthentication.cpp In file
included from
/home/runner/work/client/client/app/src/main/cpp/CAuthentication.cpp:3:
/home/runner/work/client/client/app/src/main/cpp/main.h:23:10: fatal
error: 'vendor\RakNet\SAMP\samp_netencr.h' file not found
#include "vendor\RakNet\SAMP\samp_netencr.h"
file CAuthentication.cpp is in the same directory as directory "vendor"
I also tried to set environment variable in github job but it does not help

If you're using backslashes in your include directives as the error seems to suggest, try to change them into forward slashes:
#include "vendor/RakNet/SAMP/samp_netencr.h"
Also check the path for case correctness. Windows has a case-insensitive filesystem, while the CI might be running some form of Linux.

Related

Android - file not found while building NDK library

I'm trying to build the SoundTouch library for Android, by following the guide provided within the source code:
Compiling
To compile the SoundTouch library source codes into an Android native
library, open Cygwin/bash shell, go to directory
"soundtouch/source/Android-lib/jni" and invoke the NDK compiler with
following command:
$NDK/ndk-build
This will build binaries for all the supported Android platforms
(arm-v5, arm-v7, X86, MIPS etc) of SoundTouch library, plus the JNI
wrapper interface as discussed below. The target binaries will be
built into the "libs" subdirectory. As long as all these .so binary
library versions are included in the APK Application delivery package,
the targer Android device can choose the correct library version to
use.
Notice that to allow Cygwin/bash to locate the NDK compile scripts,
you need to define the location of the NDK installation defined in
environment variable "NDK". That's easiest done by adding the NDK path
definition at end of your ~/.bash_profile file, for instance as
follows:
NDK=/cygdrive/d/Android/android-ndk-r6
to do this I go into Terminal in the SoundTouch/source/android-lib/jni directory and type the following commands:
export ANDROID_NDK=~/Android/Sdk/ndk-bundle
export NDK_ROOT=$ANDROID_NDK
export PATH=${PATH}:${ANDROID_NDK}
ndk-build
Then I get the following error:
[arm64-v8a] Compile++ : soundtouch <= soundtouch-jni.cpp
jni/soundtouch-jni.cpp:23:10: fatal error: '../source/SoundStretch/WavFile.h'
file not found
#include "../source/SoundStretch/WavFile.h"
^
1 error generated.
/home/daniele/Android/Sdk/ndk-bundle/build/core/build-binary.mk:499: recipe for target 'obj/local/arm64-v8a/objs/soundtouch/soundtouch-jni.o' failed
make: *** [obj/local/arm64-v8a/objs/soundtouch/soundtouch-jni.o] Error 1
If I go to that directory the file is there though. Here is a screenshot of the file with it's direcotry:

howto use the libcurl by ndk standalone tool chainon on android

now, i have a question: first of all i already get the ndk standalone tool chain ---arm-linux-androideabi-g++ sucessful; now i have to write a commandline c++ program which will use libcurl to do http requests, i can successful compile it on my mac( which has the libcurl default? ) use g++, but when i use the arm-linux-androideabi-g++ to compile it, it produce following error:
arm-linux-androideabi-g++ -std=c++11 -lcurl upload.cpp -o upload
upload.cpp:12:23: fatal error: curl/curl.h: no such file or directory
compilation terminated
i have a libcurl(include files and .a lib file) which can used in android, so howto configure the arm-linux-androideabi-g++ so that it can compile it successfully? thanks advance
I guess you include your header like
#include <curl/curl.h>
if you do that, arm-linux-androideabi-g++ searches header file in some specific location. and if arm-linux-androideabi-g++ does not point same directory with g++, headers can not be found. try to copy just header files of curl to your project, jni/curl folder, and use " instead of <
#include "curl/curl.h"
if you have right .a file, functions in header files will be pointed to lib file successfully.

Building AOSP master branch fails in Mac OSX

I am trying to build the master branch of AOSP, but it fails with following error:
host C++: validatekeymaps <= frameworks/base/tools/validatekeymaps/Main.cpp
In file included from frameworks/base/tools/validatekeymaps/Main.cpp:17:
In file included from frameworks/native/include/input/KeyCharacterMap.h:26:
In file included from frameworks/native/include/input/Input.h:25:
system/core/include/utils/Vector.h:20:10: fatal error: 'new' file not found
#include <new>
^
1 error generated.
make: *** [out/host/darwin-x86/obj/EXECUTABLES/validatekeymaps_intermediates/Main.o] Error 1
Does anyone has any idea on this? Where the "new" file should present? How would I solve this? Any help would be greatly appreciated.
I believe is a clang error. clang does not need .h header extensions. I wouldn't bet my life on it but I will suggest updating your host clang to the newest or newer version. It is definitely a host problem. I've seen it before, but don't remember all, plus I'm on Ubuntu and don't build AOSP. I do see a recent change added -Werror now into system/core so try doing a Host clang update... even if you already have that file, an update may fix HOST include paths.
One more thought. Try: echo $(HOST_TOOLCHAIN_ROOT)
If you don't get a location you may have a clang which is too new... my reason/reference:
https://android.googlesource.com/platform/build/+/master/core/combo/HOST_darwin-x86_64.mk:
# gcc location for clang; to be updated when clang is updated
# HOST_TOOLCHAIN_ROOT is a Darwin-specific define
HOST_TOOLCHAIN_FOR_CLANG := $(HOST_TOOLCHAIN_ROOT)

Compiling linked ( not copied ) files using NDK

I'm building an OpenGL based app - writing in native C/C++.
I want to have my native files in a single location and only linked to the project ( so when I edit them in XCode/Eclipse the other project already has the updated files ). However, I can't figure out how to get ndk-build to build files that aren't actually in the JNI folder. Symbolic links ( in OSX ) didn't do the trick.
I keep getting
make: *** No rule to make target `/Developer/SDKs/android-ndk-r7b/build/core/myfile.cpp', needed by `obj/local/armeabi/objs/glHelloArrow/myfile.o'. Stop.
Any ideas?
I build outside of JNI folder on Windows. My Android.mk includes a makefile in a different folder:
LOCAL_PATH := $(MY_WORKSPACE)/path/jni
include $(MY_WORKSPACE)/path/jni/Src.mk
where the actual sources are listed:
LOCAL_SRC_FILES := \
a.cpp \
b.cpp \
etc.
One caveat is - make does not work right with relative paths. Or rather, it does, but assumes the path to be relative to the current folder, which in case of the ndk-build process can be all over the place. Thus the env variable that denotes the root of the file location.
Some details here.
I have a similar issue with cross-platform codebase. I've not found any way to do this.
My workaround is to create a symlink from my source code root directory into jni, so I can give the NDK build system paths like jni/link/common/foo.c.
Just be sure that you remove the symlink if you ever need to run tools that do recursive directory traversals...

ndk-build error in cygwin

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?

Categories

Resources