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 compiling wrk on zLinux #32

Open
gongsu832 opened this issue Aug 12, 2019 · 4 comments
Open

error compiling wrk on zLinux #32

gongsu832 opened this issue Aug 12, 2019 · 4 comments

Comments

@gongsu832
Copy link

Install LuaJIT from git://github.com/linux-on-ibm-z/LuaJIT.git using branch v2.1 into /usr/local.

Clone wrk from https://github.com/wg/wrk then modify Makefile as:

diff --git a/Makefile b/Makefile
index 0325481..403691b 100644
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,7 @@ CFLAGS  += -I$(ODIR)/include
 LDFLAGS += -L$(ODIR)/lib

 ifneq ($(WITH_LUAJIT),)
-       CFLAGS  += -I$(WITH_LUAJIT)/include
+       CFLAGS  += -I$(WITH_LUAJIT)/include/luajit-2.1
        LDFLAGS += -L$(WITH_LUAJIT)/lib
 else
        CFLAGS  += -I$(ODIR)/include/luajit-2.1

Compiling wrk with

WITH_LUAJIT=/usr/local make

results in the following error:

LUAJIT src/wrk.lua
luajit: /usr/local/share/luajit-2.1.0-beta3/jit/bcsave.lua:214: bad argument #1 to 'bswap' (number expected, got nil)
LINK wrk
clang: error: no such file or directory: 'obj/bytecode.o'
make: *** [Makefile:56: wrk] Error 1
@cwsolee
Copy link
Contributor

cwsolee commented Aug 13, 2019

Are u following our instruction(https://github.com/linux-on-ibm-z/docs/wiki/Building-LuaJIT) here to build luajit and has problem? Your issue seems to be talking about building another package.

@mundaym
Copy link

mundaym commented Aug 13, 2019

It looks like bcsave.lua is part of the JIT package. We haven't ported the JIT compiler to s390x (we only did the virtual machine).

It looks like the Makefile is trying to save the bytecode generated by luajit directly into an object file but the code for doing that in bcsave.lua doesn't support s390x. For example there is no s390x case in this line:

f16(({ x86=3, x64=62, arm=40, arm64=183, arm64be=183, ppc=20, mips=8, mipsel=8 })[ctx.arch])

You might be able to get it to work by adding code to handle s390x to bcsave.lua. I'm not sure if it will be enough though, we might need full JIT support for this application.

@gongsu832
Copy link
Author

@mundaym Thanks Mike. Indeed it sounds like the s390x port is missing some features (JIT in this case). Hacking bcsave.lua might get wrk to work but that requires lua language knowledge which I certainly don't possess. I imagine porting JIT would be a non-trivial undertaking. Is there any plan to do so in the (hopefully not so distant) future?

@cwsolee
Copy link
Contributor

cwsolee commented Aug 13, 2019

We don't have plan to port JIT because the effort is too huge. We might re-consider if there is a solid business case to do so. Email me to talk further.

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

3 participants