Skip to content

Compilation failure of node-ffi-napi for musl/arm platform #1520

@kesslerm

Description

@kesslerm

Due to a hardcoded gnu suffix, the node-ffi-napi package fails to compile for other targets than libc.
This could be resolved by using the $(TARGET_SUFFIX) variable, which resolves to gnu on platforms that use glibc and are not arm or armeb, but to e.g. muslgnueabi on a target platform using the musl libc library on arm or armeb.

diff --git a/node-ffi-napi/Makefile b/node-ffi-napi/Makefile
index cad3be7b..b3610937 100644
--- a/node-ffi-napi/Makefile
+++ b/node-ffi-napi/Makefile
@@ -44,7 +44,7 @@ NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst
 TMPNPM:=$(shell mktemp -u XXXXXXXXXX)
 NPM_CACHE_DIR:=$(if $(call qstrip,$(CONFIG_NODEJS_NPM_CACHE_DIR)),$(call qstrip,$(CONFIG_NODEJS_NPM_CACHE_DIR)),$(TMP_DIR))

-TARGET_CFLAGS+=$(FPIC) -I$(BUILD_DIR)/libffi-$(PKG_LIBFFI_VERSION)/$(GNU_TARGET_NAME)-gnu
+TARGET_CFLAGS+=$(FPIC) -I$(BUILD_DIR)/libffi-$(PKG_LIBFFI_VERSION)/$(GNU_TARGET_NAME)-$(TARGET_SUFFIX)
 TARGET_CPPFLAGS+=$(FPIC)

 define Build/Compile

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions