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

luajit: fix aarch64 cross-compile #2480

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RomainNaour
Copy link
Contributor

Unlike CMAKE_SYSTEM_PROCESSOR which identifies aarch64
as a valid architecture, luajit does not recognize it.
luajit defines aarch64 as arm64.

Signed-off-by: Jugurtha BELKALEM jugurtha.belkalem@smile.fr
Signed-off-by: Romain Naour romain.naour@smile.fr

@yonghong-song
Copy link
Collaborator

[buildbot, test this please]

@yonghong-song
Copy link
Collaborator

build failed.

[ 23%] Generating bcc.o
luajit: unknown architecture
make[2]: *** [src/lua/CMakeFiles/bcc-lua.dir/build.make:62: src/lua/bcc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:633: src/lua/CMakeFiles/bcc-lua.dir/all] Error 2

Look likes luajit does not recognized the x86_64 architecture? Or something else wrong?

@RomainNaour
Copy link
Contributor Author

Hi Yonghong,

Indeed, this patch is not complete... sorry for that.

CMake and LuaJIT doesn't use the same naming for the architecture:
# mips -> mips
# mipsel -> mipsel
# powerpc -> ppc
# arm -> arm
# x86_64 -> x64
# i*86 -> x86
# aarch64_be -> arm64be
# aarch64 -> arm64

See :
https://github.com/LuaJIT/LuaJIT/blob/f0e865dd4861520258299d0f2a56491bd9d602e1/src/jit/bcsave.lua#L30
https://github.com/LuaJIT/LuaJIT/blob/f0e865dd4861520258299d0f2a56491bd9d602e1/src/jit/bcsave.lua#L65

It's not great to have to convert CMAKE_SYSTEM_PROCESSOR in the BCC buildsystem to provide the correct ${LUAJIT_TARGET_ARCH}.
Note: This is only useful while cross-compiling (when CMAKE_CROSSCOMPILING is true).

Thoughts?

Best regards,
Romain

@yonghong-song
Copy link
Collaborator

I guess the best you can do is to check CMAKE_CROSSCOMPILING and then further check architecture for aarch64 => arm64, aarch64_be => arm64be?

…ompiling

Unlike CMAKE_SYSTEM_PROCESSOR which identifies aarch64
as a valid architecture, luajit does not recognize it.
luajit defines aarch64 as arm64.

LuaJIT doesn't use usual arch naming, so we have to convert
between CMake and Luajit for each architectures while
cross-compiling.

Signed-off-by: Jugurtha BELKALEM <jugurtha.belkalem@smile.fr>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
v2: Do the same for other architecture supported by LuaJIT.
iovisor#2480
@RomainNaour RomainNaour force-pushed the bcc-fix-luajit-cross-build-aarch64 branch from 6f9f5d9 to 5a5b0f0 Compare August 8, 2019 16:07
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

Successfully merging this pull request may close these issues.

None yet

3 participants