Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error building luajit on aarch64 #104

Open
prasun3 opened this issue Dec 10, 2020 · 8 comments
Open

Error building luajit on aarch64 #104

prasun3 opened this issue Dec 10, 2020 · 8 comments

Comments

@prasun3
Copy link

prasun3 commented Dec 10, 2020

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
Copy link
Collaborator

t-lo commented Dec 10, 2020

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
Copy link

gaozhangfei commented Jan 14, 2021

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
Copy link

AmpereTravis commented Mar 13, 2021

@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
Copy link

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

@gaozhangfei
Copy link

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
Copy link

orefalo commented Jun 6, 2022

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
Copy link

galderz commented Jul 27, 2022

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! #121 (comment)

@galderz
Copy link

galderz commented Jul 27, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants