giltene / wrk2

A constant throughput, correct latency recording variant of wrk
Apache License 2.0
4.2k stars 377 forks source link

Error building luajit on aarch64 #104

Open prasun3 opened 3 years ago

prasun3 commented 3 years ago

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
t-lo commented 3 years ago

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.

gaozhangfei commented 3 years ago

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

AmpereTravis commented 3 years ago

@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:

  1. I clone the Kinvolk wrk2 fork with compatible LuaJIT version, here.
  2. 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.
  3. 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;
AmpereTravis commented 3 years ago

As a follow on, I created this fork that's cloneable and immediately buildable on aarch64: https://github.com/AmpereTravis/wrk2-aarch64

gaozhangfei commented 3 years ago

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

orefalo commented 2 years ago

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.

galderz commented 1 year ago

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

galderz commented 1 year ago

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