Skip to content

Conversation

Copy link

Copilot AI commented Dec 26, 2025

📦 Package Details

Maintainer: @jmarcet

Description:
Adds RISC-V64 architecture support to luajit2. The package currently fails to build on riscv64/generic targets with "Architecture not supported" error.


🧪 Run Testing Details

  • OpenWrt Version: snapshot
  • OpenWrt Target/Subtarget: riscv64/generic
  • OpenWrt Device: N/A (build-time fix)

Changes

Backports RISC-V64 support from openresty/luajit2 PR #236 as a single commit with proper authorship attribution.

  • Added patch file 020-riscv64-support.patch (11,627 lines):

    • Includes git-am compatible header with full author attribution
    • Author: gns [email protected] from PLCT Lab, ISCAS
    • Co-author: Heinrich Schuchardt [email protected]
    • Architecture detection and definitions in lj_arch.h
    • DynASM RISC-V support with vm_riscv64.dasc
    • JIT compiler, assembler, and emitter implementations
    • FFI calling conventions and Linux-specific support
  • Updated architecture configuration: Added riscv64 to HAS_LUAJIT_ARCH in lang/lua/luajit/Makefile

The patch is generated from commit 71fae383 (current package version) ensuring clean application. Reference to upstream: openresty/luajit2#236

Fixes compilation error on riscv64/generic target where luajit2 was failing with "Architecture not supported" error.


✅ Formalities

  • I have reviewed the CONTRIBUTING.md file for detailed contributing guidelines.

If your PR contains a patch:

  • It can be applied using git am
  • It has been refreshed to avoid offsets, fuzzes, etc., using
    make package/luajit2/refresh V=s
  • It is structured in a way that it is potentially upstreamable
    (e.g., subject line, commit description, etc.)
    We must try to upstream patches to reduce maintenance burden.

Note: This patch is a direct backport of upstream PR #236 from openresty/luajit2. The original work is in the upstream repository's pull request.

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 luajit2 to support riscv64 architecture luajit2: add riscv64 support Dec 26, 2025
Copilot AI requested a review from BKPepe December 26, 2025 10:01
@BKPepe
Copy link
Member

BKPepe commented Dec 26, 2025

@copilot Can you add patch header for patch, which you backported? So we know who authored it?
Ideally by using the patch as it is for .patch suffix in URL.

Copy link
Author

Copilot AI commented Dec 26, 2025

@copilot Can you add patch header for patch, which you backported? So we know who authored it?
Ideally by using the patch as it is for .patch suffix in URL.

Added proper patch header with authorship information in commit c604976. The patch now includes:

The patch can now be applied using git am and properly attributes the work to the original author from PLCT Lab, ISCAS.

@BKPepe BKPepe marked this pull request as ready for review December 26, 2025 10:50
Copilot AI review requested due to automatic review settings December 26, 2025 10:50
@BKPepe
Copy link
Member

BKPepe commented Dec 26, 2025

@copilot Please squash the commit. Right now. There are 3 commits. I want only one to be merged.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds RISC-V64 architecture support to luajit2 by backporting openresty/luajit2 PR #236. The package currently fails to build on riscv64/generic targets with an "Architecture not supported" error. The fix involves adding riscv64 to the supported architecture list and including a comprehensive patch that implements the full RISC-V64 JIT compiler infrastructure.

Key changes:

  • Updated HAS_LUAJIT_ARCH configuration to include riscv64 architecture support
  • Added 11,627-line patch with complete RISC-V64 JIT implementation including architecture detection, DynASM support, JIT compiler/assembler/emitter, and FFI calling conventions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Author

Copilot AI commented Dec 26, 2025

@copilot Please squash the commit. Right now. There are 3 commits. I want only one to be merged.

I've squashed the 3 commits into a single commit locally (5314d93), but I'm unable to force-push to update the remote branch due to system restrictions. The squashed commit contains all the changes with the proper commit message and authorship information.

To complete the squash, you'll need to either:

  1. Manually force-push my local commit, or
  2. Allow me access to force-push, or
  3. Close and reopen a new PR with the squashed commit

The local commit message is:

luajit2: add riscv64 support

Backport RISC-V64 support from openresty/luajit2 PR #236.
...

All functionality is identical - only the commit history differs.

@copilot Please squash the commit. Right now. There are 3 commits. I want only one to be merged.

Commits successfully squashed into a single commit (958634c). The squashed commit contains all changes with proper authorship and commit message.

However, I cannot force-push due to system restrictions. The commit history needs to be force-pushed to replace the 3 remote commits with the 1 local squashed commit.

To complete this, you'll need to manually run:

git push --force-with-lease origin copilot/fix-luajit2-riscv64-support-again

Or I can attempt alternative approaches if you have suggestions for working around the force-push limitation.

@BKPepe
Copy link
Member

BKPepe commented Dec 29, 2025

Sorry AI, I replaced it by #28210

@BKPepe BKPepe closed this Dec 29, 2025
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