ndk-build No rule to make target - android

This is my android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
FREETYPE_SRC_PATH :=
LOCAL_MODULE := freetype
LOCAL_CFLAGS := -DANDROID_NDK \
-DFT2_BUILD_LIBRARY=1
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include_all \
$(FREETYPE_SRC_PATH)include \
$(FREETYPE_SRC_PATH)src
LOCAL_SRC_FILES := \
$(FREETYPE_SRC_PATH)src/autofit/autofit.c \
$(FREETYPE_SRC_PATH)src/base/basepic.c \
$(FREETYPE_SRC_PATH)src/base/ftapi.c \
$(FREETYPE_SRC_PATH)src/base/ftbase.c \
LOCAL_LDLIBS := -ldl -llog
include $(BUILD_SHARED_LIBRARY)
And this is Application.mk:
APP_PLATFROM := android-20
APP_ABI := armeabi-v7a x86
After i hit ndk-build on the terminal Android Studio, i got an error message:
make: *** No rule to make target '/app/src/main/jni/src/base/basepic.c
I've checked android.mk:
$(FREETYPE_SRC_PATH)src/autofit/autofit.c \
$(FREETYPE_SRC_PATH)src/base/basepic.c \
there is no whitespace. But still got an error.
Gradle model version=6.0.1, NDK version=21.1.6352462
I need to ndk-build without problem.. any i can do to solve this issue?

In your android.mk file you have FREETYPE_SRC_PATH empty. I guess it must be assigned as /app/src/main/jni/.

Related

How to build Boost in Android NDK?

I am trying to debug v8 in my Android app.
I integrated v8 and it is currently running.
I've found this repo which seems to be interesting as a starting point:
https://github.com/ahmadov/v8_inspector_example
This implementation uses Boast.Beast for socket related operations.
I got a Boast.Beast build for Android by using:
https://github.com/moritz-wundke/Boost-for-Android
I already imported libs and includes into my project and now I am trying to build NDK, but I have some problems with headers' files.
My Android.mk looks like this:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := v8_monolith
LOCAL_SRC_FILES := v8-dist/dist/$(TARGET_ARCH_ABI)/libv8_monolith.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := boost
LOCAL_SRC_FILES := boost/dist/$(TARGET_ARCH_ABI)/lib/libboost_system-clang-1_80.a
LOCAL_CPPFLAGS := \
-fexceptions \
-frtti
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := en8
LOCAL_C_INCLUDES := \
$(LOCAL_PATH) \
$(LOCAL_PATH)/v8-dist/include
BOOST := $(wildcard $(LOCAL_PATH)/boost/include/*.hpp)
LOCAL_C_INCLUDES += $(BOOST:$(LOCAL_PATH)/%=%)
LOCAL_SRC_FILES := \
en8.cpp \
marshall.cpp \
instrument.cpp \
localstorage.cpp \
runtime.cpp \
cpu_profile.cpp \
page_size.cpp \
disk_cleanup.cpp
LOCAL_CPPFLAGS := \
-std=c++17 \
-Wall \
-Wextra \
-Wpedantic \
-Wno-unused-parameter \
-Wno-variadic-macros \
-Wno-gnu-include-next \
-DV8_DEPRECATION_WARNINGS \
-DLEVELDB_PLATFORM_ANDROID
# Pointer compression should be enabled for 64-bit archs
ifeq ($(TARGET_ARCH), $(filter $(TARGET_ARCH),arm64 x86_64))
LOCAL_CPPFLAGS += -DV8_COMPRESS_POINTERS
endif
LOCAL_LDLIBS := -llog
LOCAL_STATIC_LIBRARIES := v8_monolith leveldb boost
include $(BUILD_SHARED_LIBRARY)
I am trying to import this files:
#include <boost/beast/core.hpp>
#include <boost/beast/websocket.hpp>
#include <boost/asio/ip/tcp.hpp>
When building NDK I get: fatal error: 'boost/beast/core.hpp' file not found
Thanks.

Android Studio NDK Too many open files in system error

Currently working through compiling the freetype library for android ndk, but I am getting this error:
Android.mk:1: Android.mk: Too many open files in system
Android.mk:6: /Development/android-sdk-macosx/ndk-bundle/build/core/clear-vars.mk: Too many open files in system
Android.mk:22: /Development/android-sdk-macosx/ndk-bundle/build/core/build-shared-library.mk: Too many open files in system
/Development/android-sdk-macosx/ndk-bundle/build/core/build-shared-library.mk:34: /Development/android-sdk-macosx/ndk-bundle/build/core/build-module.mk: Too many open files in system
Structure:
src/
main/
java/
jni/
freetype/
include/
src/
Android.mk
...
src/
...
Android.mk
Application.mk
jni/Android.mk
include Android.mk
LOCAL_PATH := $(call my-dir)
# Project
include $(CLEAR_VARS)
LOCAL_MODULE := sanangeles
LOCAL_STATIC_LIBRARIES := freetype
LOCAL_LDLIBS := -landroid -lEGL -lGLESv2 -ldl -llog
LOCAL_CFLAGS := -DANDROID_NDK -DDISABLE_IMPORTGL
LOCAL_SRC_FILES := \
src/Gantt.cpp \
src/app.c \
src/importgl.c \
src/Helpers/ivec2.cpp \
src/Helpers/vec3.cpp \
src/Renderers/BoxRenderer.cpp \
src/Renderers/TextRenderer.cpp \
src/Renderers/Shader.cpp
include $(BUILD_SHARED_LIBRARY)
freetype/Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
FREETYPE_SRC_PATH := $(LOCAL_PATH)/
$(info Freetype path: '$(FREETYPE_SRC_PATH)')
LOCAL_MODULE := freetype
LOCAL_CFLAGS := -DANDROID_NDK \
-DFT2_BUILD_LIBRARY=1
LOCAL_C_INCLUDES := \
$(FREETYPE_SRC_PATH)include \
$(FREETYPE_SRC_PATH)src
LOCAL_SRC_FILES := \
$(FREETYPE_SRC_PATH)src/autofit/autofit.c \
$(FREETYPE_SRC_PATH)src/base/basepic.c \
...
$(FREETYPE_SRC_PATH)src/lzw/ftlzw.c
LOCAL_LDLIBS := -ldl -llog
include $(BUILD_SHARED_LIBRARY)
Edit:
Problem solved, accidentally added own file recursively, instead of the correct freetype/Android.mk. Anyone know how to add that one?

Compiling native android library with multiple c files using ndk build errors * No rule to make target

I am having an issue compiling a shared C library into a .so for android. I've copied all the .c and .h files into the jni folder. I posted a screenshot below to show the contents of the Android.mk file as well as the folder hierarchy.
below is the output of ndk-build run in the project root folder NTRUMLS
[kenway#jackdaw NTRUMLS]$ ndk-build
make: *** No rule to make target '/media/bigdata/Android/Sdk/ndk-bundle/build/core/crypto_hash_sha512.c', needed by 'obj/local/arm64-v8a/objs/ntrumls/crypto_hash_sha512.o'. Stop.
i checked for spaces and typo's. here's the contents of my Android.mk copied directly below.
include $(CLEAR_VARS)
LOCAL_ARM_MODE := arm
LOCAL_PATH := $(call my-dir)
LOCAL_MODULE := libntrumls
LOCAL_CFLAGS := -Werror
LOCAL_SRC_FILES := crypto_hash_sha512.c \
crypto_stream.c \
convert.c \
randombytes.c \
fastrandombytes.c \
pack.c \
pol.c \
params.c \
pqntrusign.c \
shred.c
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
Move
LOCAL_PATH := $(call my-dir)
to be the first statement of your Android.mk script.
Try following
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := arm
LOCAL_MODULE := libntrumls
LOCAL_CFLAGS := -Werror
LOCAL_SRC_FILES := Main_M1_play.cpp
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)

how to config android.mk when i need to export several native library

Now i export one native library and my folder is like this :
JNI\ANN*.cpp.
android.mk file is like this:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../
LOCAL_MODULE := libann
LOCAL_LDLIBS := -llog
NDK_TOOLCHAIN_VERSION := clang
LOCAL_CPPFLAGS += -std=c++11
LOCAL_SRC_FILES := \
ANN.cpp \
bd_pr_search.cpp \
bd_tree.cpp \
kd_pr_search.cpp \
kd_split.cpp \
kd_util.cpp \
bd_fix_rad_search.cpp \
bd_search.cpp \
brute.cpp \
kd_fix_rad_search.cpp \
kd_search.cpp \
kd_tree.cpp \
kd_dump.cpp \
perf.cpp\
sample.cpp
include $(BUILD_SHARED_LIBRARY)
Now i want to add some other cpp files and export another native lib.
for example, i add two files: graph.h,dijkstra,cpp
how should i config the android.mk file?
project/
liba/
srca.cpp
libb/
srcb.cpp
# TOP_PATH refers to the project root dir (project)
TOP_PATH := $(call my-dir)/.
# Build library a
include $(CLEAR_VARS)
LOCAL_PATH := $(TOP_PATH)/liba
LOCAL_MODULE := liba
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_SRC_FILES := srca.cpp
include $(BUILD_SHARED_LIBRARY)
# Build library b
include $(CLEAR_VARS)
LOCAL_PATH := $(TOP_PATH)/libb
LOCAL_MODULE := libb
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_SRC_FILES := srcb.cpp
include $(BUILD_SHARED_LIBRARY)

Android jni "No Rule to make Target issue"

I am trying to compile the project which i got from below link .
Github project fmpeg. But while compiling that to create .so files using andriod ndk version 5 i am getting the following issue . Please advice me to solve it .
make: *** No rule to make target `/cygdrive/D/Shakthi/jhotovy/jhotovy-android-ffmpeg-fab1412/Project/jni/ffmpeg/ffmpeg.c', needed by `/cygdrive/D/Shakthi/jhotovy/jhotovy-android-ffmpeg-fab1412/Project/obj/local/armeabi/objs/ffmpeg/ffmpeg/ffmpeg.o'. Stop.
My Android.mk file code.
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := ffmpeg
FFMPEG_LIBS := $(addprefix ffmpeg/, \
libavdevice/libavdevice.a \
libavformat/libavformat.a \
libavcodec/libavcodec.a \
libavfilter/libavfilter.a \
libswscale/libswscale.a \
libavutil/libavutil.a \
libpostproc/libpostproc.a )
OGG_LIBS := $(addprefix libogg/output/lib/, \
libogg.a )
VORBIS_LIBS := $(addprefix libvorbis/output/lib/, \
libvorbis.a \
libvorbisenc.a \
libvorbisfile.a )
THEORA_LIBS := $(addprefix libtheora/output/lib/, \
libtheora.a \
libtheoraenc.a \
libtheoradec.a )
LOCAL_CFLAGS += -g -Iffmpeg -Ivideokit -Wno-deprecated-declarations
LOCAL_LDLIBS += -llog -lz $(FFMPEG_LIBS) $(THEORA_LIBS) $(OGG_LIBS) x264/libx264.a
LOCAL_SRC_FILES := ffmpeg_android/ffmpeg_android.c ffmpeg/ffmpeg.c ffmpeg/cmdutils.c
include $(BUILD_SHARED_LIBRARY)
# Use to safely invoke ffmpeg multiple times from the same Activity
include $(CLEAR_VARS)
LOCAL_MODULE := ffmpeginvoke
LOCAL_SRC_FILES := ffmpeg_invoke/ffmpeg_invoke.c
LOCAL_LDLIBS := -ldl
include $(BUILD_SHARED_LIBRARY)
Did you follow the instructions in "How to build it"?

Categories

Resources