cdsoft/luax
2
23
Fork
You've already forked luax
0

crosscompile thoughts #5

Open
opened 2026年06月24日 11:14:54 +02:00 by coderofsalvation · 3 comments

will this work in theory on any platform with lua?

$ luax compile -t native -o hello hello.lua

Soon I'll try this on my x86 tinycorelinux, would be nice.
Also, I was wondering if you did some research towards crosscompiling to architecture X via architecture Y:

$ qemu-aarch64 luax.lua compile -t native -o hello hello.lua
$ qemu-x86 luax.lua compile -t native -o hello hello.lua

I guess you still need a lua runtime which is compiled for those architectures no?

Reason: would be great to use luax inside codeberg pipelines to build binaries for various architectures as releases

will this work in theory on **any** platform with lua? ```bash $ luax compile -t native -o hello hello.lua ``` Soon I'll try this on my x86 tinycorelinux, would be nice. Also, I was wondering if you did some research towards crosscompiling to architecture X via architecture Y: ``` $ qemu-aarch64 luax.lua compile -t native -o hello hello.lua $ qemu-x86 luax.lua compile -t native -o hello hello.lua ``` I guess you still need a lua runtime which is compiled for those architectures no? > Reason: would be great to use luax inside codeberg pipelines to build binaries for various architectures as [releases](https://github.com/jbaicoianu/janusweb/blob/master/.github/workflows/deploy.yml#L45-L46)

This will work on any platform supported by LuaX (see luax compile -t list):

  • linux-x86_64
  • linux-x86_64-musl
  • linux-aarch64
  • linux-aarch64-musl
  • macos-x86_64
  • macos-aarch64
  • windows-x86_64
  • windows-aarch64

Other platforms supported by Zig (e.g. 32-bit platforms) could in theory work, their support must be explicitly added to LuaX (some files must be updated: luax-targets.lua, sys.lua, install_zig.sh, and maybe more).

The build system compiles a runtime for each targets defined in luax-targets.lua.

ninja release will compile LuaX for all platforms supported by LuaX, each one being able to crosscompile to any platforms supported by LuaX.

Do you have some specific needs? (32-bit Linux?)

This will work on any platform **supported** by LuaX (see `luax compile -t list`): - linux-x86_64 - linux-x86_64-musl - linux-aarch64 - linux-aarch64-musl - macos-x86_64 - macos-aarch64 - windows-x86_64 - windows-aarch64 Other platforms supported by Zig (e.g. 32-bit platforms) could in theory work, their support must be explicitly added to LuaX (some files must be updated: `luax-targets.lua`, `sys.lua`, `install_zig.sh`, and maybe more). The build system compiles a runtime for each targets defined in `luax-targets.lua`. `ninja release` will compile LuaX for all platforms supported by LuaX, each one being able to crosscompile to any platforms supported by LuaX. Do you have some specific needs? (32-bit Linux?)

qemu-aarch64 luax.lua compile -t native -o hello hello.lua requires a lua interpreter for aarch64.

It's easier to use a native luax binary and explicit the target: luax compile -t linux-aarch64 -o hello hello.lua (luax must first be installed to be able to find the runtimes).

On the 32bit branch I've added support for linux-x86 and linux-x86-musl.

ninja release also builds luax compilers that contain all the runtimes (in .build/release/<version>/), which can be run without installing luax and its runtimes (libluax.xyz). E.g. if you are on Linux x86: luax-linux-x86 compile -t <target> -o hello hello.lua.

The full process to cross-compile Lua scripts would be:

  1. install LuaX (or use binaries from https://cdelord.fr/pub)
git clone https://codeberg.org/cdsoft/luax
cd luax
./build.lua && ninja install
  1. compile your scripts for each platform
luax compile -t linux-x86_64 -o hello hello.lua
luax compile -t linux-x86 -o hello hello.lua
luax compile -t linux-aarch64 -o hello hello.lua
...
`qemu-aarch64 luax.lua compile -t native -o hello hello.lua` requires a `lua` interpreter for aarch64. It's easier to use a native luax binary and explicit the target: `luax compile -t linux-aarch64 -o hello hello.lua` (luax must first be installed to be able to find the runtimes). On the `32bit` branch I've added support for `linux-x86` and `linux-x86-musl`. `ninja release` also builds luax compilers that contain all the runtimes (in `.build/release/<version>/`), which can be run without installing luax and its runtimes (`libluax.xyz`). E.g. if you are on Linux x86: `luax-linux-x86 compile -t <target> -o hello hello.lua`. The full process to cross-compile Lua scripts would be: 1. install LuaX (or use binaries from <https://cdelord.fr/pub>) ```sh git clone https://codeberg.org/cdsoft/luax cd luax ./build.lua && ninja install ``` 2. compile your scripts for each platform ```sh luax compile -t linux-x86_64 -o hello hello.lua luax compile -t linux-x86 -o hello hello.lua luax compile -t linux-aarch64 -o hello hello.lua ... ```

I've merged 32-bit Linux support to the master branche. LuaX should work on tinycorelinux.

I've merged 32-bit Linux support to the master branche. LuaX should work on tinycorelinux.
Sign in to join this conversation.
No Branch/Tag specified
master
dev
32bit
dev-ng
mbedtls
lua-5.5
pages
LibreSSL
isocline-freeze_and_memory_leak_issue_when_the_terminal_is_closed
optimizations-local_variables
djot
wasm
testing_teal
10.7.1
10.7
10.6.7
10.6.6
10.6.5
10.6.4
10.6.3
10.6.2
10.6.1
10.6
10.5
10.4.5
10.4.4
10.4.3
10.4.2
10.4.1
10.4
10.3.4
10.3.3
10.3.2
10.3.1
10.3
10.2.2
10.2.1
10.2
10.1.4
10.1.3
10.1.2
10.1.1
10.1
10.0.2
10.0.1
10.0
9.15.1
9.15
9.14.14
9.14.13
9.14.12
9.14.11
9.14.10
9.14.9
9.14.8
9.14.7
9.14.6
9.14.5
9.14.4
9.14.3
9.14.2
9.14.1
9.14
9.13.5
9.13.4
9.13.3
9.13.2
9.13.1
9.13
9.12.3
9.12.2
9.12.1
9.12
9.11.2
9.11.1
9.11
9.10.1
9.10
9.9.3
9.9.2
9.9.1
9.9
9.8.1
9.8
9.7.4
9.7.3
9.7.2
9.7.1
9.7
9.6.3
9.6.2
9.6.1
9.6
9.5.9
9.5.8
9.5.7
9.5.6
9.5.5
9.5.4
9.5.3
9.5.2
9.5.1
9.5
9.4.3
9.4.2
9.4.1
9.4
9.3
9.2.11
9.2.10
9.2.9
9.2.8
9.2.7
9.2.6
9.2.5
9.2.4
9.2.3
9.2.2
9.2.1
9.2
9.1.4
9.1.3
9.1.2
9.1.1
9.1
9.0
8.9.7
8.9.6
8.9.5
8.9.4
8.9.3
8.9.2
8.9.1
8.9
8.8.2
8.8.1
8.8
8.7.3
8.7.2
8.7.1
8.7
8.6.2
8.6.1
8.6
8.5
8.4
8.3
8.2.2
8.2.1
8.2
8.1.3
8.1.2
8.1.1
8.1
8.0.3
8.0.2
8.0.1
8.0
7.7.4
7.7.3
7.7.2
7.7.1
7.7
7.6.5
7.6.4
7.6.3
7.6.2
7.6.1
7.6
7.5.1
7.5
7.4.1
7.4
7.3.4
7.3.3
7.3.2
7.3.1
7.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2.9.1
2.9
2.8.5
2.8.4
2.8.3
2.8.2
2.8.1
2.8.0
2.7.7
2.7.6
2.7.5
2.7.4
2.7.3
2.7.2
2.7.1
2.7.0
2.6.2
2.6.1
2.6.0
2.5.2
2.5.1
2.5.0
2.4.1
2.4.0
2.3.0
2.2.3
2.2.2
2.2.1
2.2.0
2.1.3
2.1.2
2.1.1
2.1.0
2.0.3
2.0.2
2.0.1
2.0.0
1.15.1
1.15.0
1.14.5
1.14.4
1.14.3
1.14.2
1.14.1
1.14.0
1.13.1
1.13.0
1.12.10
1.12.9
1.12.8
1.12.7
1.12.6
1.12.5
1.12.4
1.12.3
1.12.2
1.12.1
1.12.0
1.11.0
1.10.1
1.10.0
1.9.1
1.9.0
1.8.0
1.7.2
1.7.1
1.7.0
1.6.3
1.6.2
1.6.1
1.6.0
1.5.0
1.4.0
1.3.0
1.2.0
1.1.3
1.1.2
1.1.1
1.1.0
1.0.0
0.15.0
0.14.0
0.13.0
0.12.0
0.11.4
0.11.3
0.11.2
0.11.1
0.11.0
0.10.1
0.10.0
0.9.1
0.9.0
0.8.0
0.7.7
0.7.6
0.7.5
0.7.4
0.7.3
0.7.2
0.7.1
0.7.0
0.6.3
0.6.2
0.6.1
0.6.0
0.5.3
0.5.2
0.5.1
0.5.0
0.4.0
0.3.2
0.3.1
0.3.0
0.2.1
0.2.0
0.1.0
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cdsoft/luax#5
Reference in a new issue
cdsoft/luax
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?