Skip to content

Conversation

Copy link

Copilot AI commented Oct 27, 2025

LuaJIT2 fails to compile on riscv64 targets with "Architecture not supported" error.

Changes

  • lang/luajit/Makefile: Add riscv64 to HAS_LUAJIT_ARCH config (shared by luajit and luajit2)
  • lang/luajit2/patches/020-riscv64-support.patch: Backport openresty/luajit2#236 adding:
    • RISC-V 64-bit architecture detection and definitions
    • DynASM RISC-V backend and JIT compiler
    • RISC-V instruction disassembler
    • Build system integration

Patch applies cleanly to luajit2 v2.1-20250529 (afc74313).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/openresty/luajit2/pulls/236
    • Triggering command: curl -s REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>luajit2: does not support riscv64</issue_title>
<issue_description>### Package Name

luajit2

Maintainer

@jmarcet

OpenWrt Version

snapshot

OpenWrt Target/Subtarget

riscv64/generic

Steps to Reproduce

Click here: https://downloads.openwrt.org/snapshots/faillogs/riscv64_generic/packages/luajit2/compile.txt


Applying /builder/shared-workdir/build/sdk/feeds/packages/lang/luajit2/patches/010-lua-path.patch using plaintext: 
patching file src/luaconf.h
make[4]: Entering directory '/builder/shared-workdir/build/sdk/build_dir/target-riscv64_generic_musl/luajit2-2.1.2025.05.29'
==== Building LuaJIT 2.1 ====
make -C src
make[5]: Entering directory '/builder/shared-workdir/build/sdk/build_dir/target-riscv64_generic_musl/luajit2-2.1.2025.05.29/src'
lj_arch.h:73:2: error: #error "Architecture not supported (in this version), see: https://luajit.org/status.html#architectures"
   73 | #error "Architecture not supported (in this version), see: https://luajit.org/status.html#architectures"
      |  ^~~~~
lj_arch.h:475:2: error: #error "No target architecture defined"
  475 | #error "No target architecture defined"
      |  ^~~~~
Makefile:273: *** Unsupported target architecture.  Stop.
make[5]: Leaving directory '/builder/shared-workdir/build/sdk/build_dir/target-riscv64_generic_musl/luajit2-2.1.2025.05.29/src'
make[4]: *** [Makefile:127: default] Error 2
make[4]: Leaving directory '/builder/shared-workdir/build/sdk/build_dir/target-riscv64_generic_musl/luajit2-2.1.2025.05.29'
make[3]: *** [Makefile:100: /builder/shared-workdir/build/sdk/build_dir/target-riscv64_generic_musl/luajit2-2.1.2025.05.29/.built] Error 2
time: package/feeds/packages/luajit2/compile#0.52#0.42#1.08

Actual Behaviour

You need to backport this: openresty/luajit2#236 to fix it

Confirmation Checklist

  • The package is maintained in this repository.
  • I understand that issues related to the base OpenWrt repository or LuCI repository will be closed.
  • I am reporting an issue for OpenWrt, not an unsupported fork.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Fix LuaJIT 2 support for riscv64 architecture luajit2: add riscv64 architecture support Oct 27, 2025
Copilot AI requested a review from BKPepe October 27, 2025 09:39
Copilot finished work on behalf of BKPepe October 27, 2025 09:39
@BKPepe
Copy link
Member

BKPepe commented Oct 27, 2025

Hmm, it can not pass the formality test. 😭 However, for such simply task, it looks like it is working. Not bad at all.
Yeah, there can be some improvements like using the original author in the patch and the commit subject could be improved as well, but still it is progress.

cc: @jmarcet as luajit2 maintainer here. 👀

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.

luajit2: does not support riscv64

2 participants