saleyn / erlexec

Execute and control OS processes from Erlang/OTP
https://hexdocs.pm/erlexec/readme.html
Other
525 stars 139 forks source link

Compile fails on arm #175

Closed springmeyer closed 4 months ago

springmeyer commented 4 months ago

I'm building erlexec on arm64 and seeing:

g++ -g -std=c++11 -finline-functions -Wall -DHAVE_PTRACE -MMD -DUSE_POLL=1 -O3 -DNDEBUG -mavx2 -DHAVE_SETRESUID -DHAVE_PIPE2 -I/root/.asdf/installs/erlang/26.1.2/erts-14.1.1/include -I/root/.asdf/installs/erlang/26.1.2/lib/erl_interface-5.4/include -c -o ei++.o ei++.cpp g++: error: unrecognized command-line option '-mavx2' make: *** [Makefile:126: ei++.o] Error 1

Could the '-mavx2' flag be applied conditionally? It looks like it was added in https://github.com/saleyn/erlexec/commit/4407acffd535234ce48c0086c9f126173f5a0ec1?

saleyn commented 4 months ago

Could you provide the output of:

  1. g++ --version
  2. uname -a
  3. gcc -march=native -dM -E - </dev/null | grep -E -i '(avx|arm)'
saleyn commented 4 months ago

Also could you please try to pull the master branch and build again?

springmeyer commented 4 months ago

Also could you please try to pull the master branch and build again?

Yes, will try in a moment, thanks!

Just in case its still helpful:

g++ --version
g++ (Ubuntu 13.2.0-4ubuntu3) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
uname -a
Linux 439b3950c4ad 6.6.16-linuxkit #1 SMP Fri Feb 16 11:54:02 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
#define __ARM_SIZEOF_WCHAR_T 4
#define __ARM_FEATURE_ATOMICS 1
#define __ARM_FEATURE_RCPC 1
#define __ARM_64BIT_STATE 1
#define __ARM_FEATURE_AES 1
#define __ARM_FEATURE_IDIV 1
#define __ARM_FP 14
#define __ARM_SIZEOF_MINIMAL_ENUM 4
#define __ARM_FEATURE_DOTPROD 1
#define __ARM_ALIGN_MAX_PWR 28
#define __ARM_FP16_FORMAT_IEEE 1
#define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
#define __ARM_FP16_ARGS 1
#define __ARM_FEATURE_CLZ 1
#define __ARM_FEATURE_SHA512 1
#define __ARM_FEATURE_QRDMX 1
#define __ARM_FEATURE_FMA 1
#define __ARM_FEATURE_SHA2 1
#define __ARM_ARCH_PROFILE 65
#define __ARM_PCS_AAPCS64 1
#define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1
#define __ARM_ARCH 8
#define __ARM_FEATURE_FP16_FML 1
#define __ARM_ARCH_8A 1
#define __ARM_FEATURE_UNALIGNED 1
#define __ARM_FEATURE_SHA3 1
#define __ARM_FEATURE_CRC32 1
#define __ARM_NEON 1
#define __ARM_ALIGN_MAX_STACK_PWR 16
#define __ARM_FEATURE_PAUTH 1
#define __ARM_FEATURE_NUMERIC_MAXMIN 1
#define __ARM_ARCH_ISA_A64 1
springmeyer commented 4 months ago

Confirmed that this is now fixed:

# make
===> Verifying dependencies...
make[1]: Entering directory '/app/erlexec/c_src'
g++ -g -std=c++11 -finline-functions -Wall -DHAVE_PTRACE -MMD -DUSE_POLL=1 -O3 -DNDEBUG -DHAVE_SETRESUID -DHAVE_PIPE2  -DHAVE_CAP  -I/root/.asdf/installs/erlang/26.1.2/erts-14.1.1/include -I/root/.asdf/installs/erlang/26.1.2/lib/erl_interface-5.4/include  -c -o ei++.o ei++.cpp
g++ -g -std=c++11 -finline-functions -Wall -DHAVE_PTRACE -MMD -DUSE_POLL=1 -O3 -DNDEBUG -DHAVE_SETRESUID -DHAVE_PIPE2  -DHAVE_CAP  -I/root/.asdf/installs/erlang/26.1.2/erts-14.1.1/include -I/root/.asdf/installs/erlang/26.1.2/lib/erl_interface-5.4/include  -c -o exec.o exec.cpp
g++ -g -std=c++11 -finline-functions -Wall -DHAVE_PTRACE -MMD -DUSE_POLL=1 -O3 -DNDEBUG -DHAVE_SETRESUID -DHAVE_PIPE2  -DHAVE_CAP  -I/root/.asdf/installs/erlang/26.1.2/erts-14.1.1/include -I/root/.asdf/installs/erlang/26.1.2/lib/erl_interface-5.4/include  -c -o exec_impl.o exec_impl.cpp
mkdir -p "/app/erlexec/priv/aarch64-linux-gnu/"
g++ ei++.o exec.o exec_impl.o -lcap -L/root/.asdf/installs/erlang/26.1.2/lib/erl_interface-5.4/lib -lei -o /app/erlexec/priv/aarch64-linux-gnu/exec-port
make[1]: Leaving directory '/app/erlexec/c_src'
===> Analyzing applications...
===> Compiling erlexec

cc @axelson