Error building luajit on aarch64
Build fails on aarch64 because luajit version included does not support aarch64. Able to build LuaJIT 2.1.0-beta3 on the same machine
$ make
==== Building LuaJIT 2.0.5 ====
.
.
lj_arch.h:55:2: error: #error "No support for this architecture (yet)"
#error "No support for this architecture (yet)"
^~~~~
lj_arch.h:294:2: error: #error "No target architecture defined"
#error "No target architecture defined"
^~~~~
.
.
.
Makefile:109: recipe for target 'default' failed
make: *** [default] Error 2
Wrk2 seems to be using luajit-2.0.3.
We've upgraded our wrk2 fork to luajit-2.1.0-beta3 a while ago; maybe the commit can be cherry-picked to upstream?
Please note that the commit referenced also enables luajit's 64bit garbage collector by default. 64bit address space support (which allows LUA scripts to handle significantly more data) was our main reason for upgrading.
On aarch64, after applying this patch, I still got error src/hdr_histogram.c:10:23: fatal error: x86intrin.h: No such file or directory
@gaozhangfei @t-lo
I ran into this same issue and was able to get wrk2 to build and run on my aarch64 system. There were two additional code changes I had to make. Here's how I tied it together on a bare-metal aarch64 system:
- I clone the Kinvolk wrk2 fork with compatible LuaJIT version, here.
- The hdr_histogram.c file imports x86 intrinsics, which aren't available on aarch64. It simply needed to be ifdef'd out (see below). -- EDIT: sorry, this one is already done in the Kinvolk repo, but it is the answer to the above comment.
- I don't fully understand this one because I'm far from a C programmer, but there was an issue with how the command line was being parsed and the variable declaration for "c" needed to be changed to a signed char. I found this fix referenced here.
With these changes I'm able to successfully build wrk2 natively on aarch64.
My change to src/wrk.c line 746:
from
char c, **header = headers;
to
signed char c, **header = headers;
As a follow on, I created this fork that's cloneable and immediately buildable on aarch64: https://github.com/AmpereTravis/wrk2-aarch64
As a follow on, I created this fork that's cloneable and immediately buildable on aarch64: https://github.com/AmpereTravis/wrk2-aarch64
Thanks AmpereTravis,
I can build on aarch64 with fix 9e5f897 isrc/hdr_histogram.c, docker/prometheus: fix / add ARM64 support But app still can not run
With the fix: bf8133e Update parse_args to use explicitly signed char to avoid argparse bugs. The app can run on aarch64
Thanks
I can't get neither this fork to compile nor the one from Kinvolk. Not a C expert, would gladly take how to. got gcc ,make, openssl install via brew.
Duplicating work appears to be game in wrk2 town, so to add to the pile, here's a comment for the issue I found on a popular search engine when trying to build wrk2 on M1. Oh btw, it links 2 PRs to fix this. I've verified one of them. Good luck all! https://github.com/giltene/wrk2/issues/121#issuecomment-1196809472
As a follow on, I created this fork that's cloneable and immediately buildable on aarch64: https://github.com/AmpereTravis/wrk2-aarch64
👆 fails to build on latest darwin/aarch64, so if you're on that combo see my comment above:
In file included from src/wrk.c:3:
src/wrk.h:11:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
^~~~~~~~~~~~~~~
1 error generated.
make: *** [obj/wrk.o] Error 1