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?
Related
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.
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/.
While building the AOSP (Oreo)source tree, The following error occurs
build/core/dynamic_binary.mk:17: error: packages/apps/TerminalTest/jni:
LOCAL_MODULE not defined before call to local-intermediates-dir.
18:25:16 ckati failed with: exit status 1
#### failed to build some targets (26 seconds) ####
Application Source tree
jni
Android.mk
src
res
Android.mk
Main Android.mk
LOCAL_PATH:= $(call my-dir)
include $(call all-subdir-makefiles)
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := TerminalTest
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libjni_terminal
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4
LOCAL_JNI_SHARED_LIBRARIES := libjni_terminalTest
# TODO: enable proguard once development has settled down
#LOCAL_PROGUARD_FLAG_FILES := proguard.flags
LOCAL_PROGUARD_ENABLED := disabled
include $(BUILD_PACKAGE)
jni/Android.mk
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
jni_init.cpp \
com_android_terminal_Terminal.cpp \
LOCAL_C_INCLUDES += \
external/libvterm/include \
libcore/include \
frameworks/base/include
LOCAL_SHARED_LIBRARIES := \
libandroidfw \
libandroid_runtime \
liblog \
libnativehelper \
libutils
LOCAL_STATIC_LIBRARIES := \
libvterm
LOCAL_CFLAGS := \
-Wno-unused-parameter \
LOCAL_MODULE := libjni_terminal
LOCAL_MODULE_TAGS := optional
include $(BUILD_SHARED_LIBRARY)
Any help will appreciate
If you use LOCAL_MODULE := libjni_terminal in any other project this error will happen.
When using the same LOCAL_MODULE name in different places lead to problems while creating and accessing intermediate files.
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)
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)