From a35baf98fe8e8ef8a94259f8ffdad717f644c125 Mon Sep 17 00:00:00 2001 From: Yuri Oliveira <2575359+yuriploc@users.noreply.github.com> Date: Sat, 16 Aug 2025 21:11:09 -0300 Subject: [PATCH 1/2] fix: nerves target on macos host A dirty fix when compiling for a nerves system in a darwin host. --- c_src/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/c_src/Makefile b/c_src/Makefile index 69c6ca8..191e822 100644 --- a/c_src/Makefile +++ b/c_src/Makefile @@ -66,7 +66,12 @@ endif C_SRC_NIF_FILE = $(C_SRC_NIF)$(C_SRC_SHARED_EXTENSION) -ifeq ($(PLATFORM),msys2) +ifneq (,$(and $(findstring nerves,$(CROSSCOMPILE)),$(findstring darwin,$(PLATFORM)))) + CC = $(CROSSCOMPILE)-gcc + CFLAGS += -O3 -std=c11 -fstack-protector -Wall -Wmissing-prototypes + CXXFLAGS += -O3 -std=c++11 -fstack-protector -Wall + LDFLAGS += -shared +else ifeq ($(PLATFORM),msys2) # We hardcode the compiler used on MSYS2. The default CC=cc does # not produce working code. The "gcc" MSYS2 package also doesn't. CC = /mingw64/bin/gcc From fe713e1057314c7b3818efdb5b50dcb81595db68 Mon Sep 17 00:00:00 2001 From: Yuri Oliveira <2575359+yuriploc@users.noreply.github.com> Date: Thu, 28 Aug 2025 21:38:50 -0400 Subject: [PATCH 2/2] feat: check if the darwin is in an arm platform --- c_src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c_src/Makefile b/c_src/Makefile index 191e822..7eca277 100644 --- a/c_src/Makefile +++ b/c_src/Makefile @@ -66,7 +66,7 @@ endif C_SRC_NIF_FILE = $(C_SRC_NIF)$(C_SRC_SHARED_EXTENSION) -ifneq (,$(and $(findstring nerves,$(CROSSCOMPILE)),$(findstring darwin,$(PLATFORM)))) +ifneq (,$(and $(findstring nerves,$(CROSSCOMPILE)),$(findstring darwin,$(PLATFORM)),$(filter arm64,$(ARCH)))) CC = $(CROSSCOMPILE)-gcc CFLAGS += -O3 -std=c11 -fstack-protector -Wall -Wmissing-prototypes CXXFLAGS += -O3 -std=c++11 -fstack-protector -Wall