Skip to content

Conversation

@ahgamut
Copy link

@ahgamut ahgamut commented Apr 24, 2024

This PR adds a Github Action to build mle with Cosmopolitan Libc with every release. The Action uses the mle_vendor=1 and mle_static=1 to build the executable (thanks for vendoring the deps 🙂).
The built executable mle should work on x86_64 (Linux/Windows/BSDs/MacOS) and aarch64 (Linux/MacOS), as per the Cosmopolitan Libc README.

You can view the results here: https://github.com/ahgamut/mle/releases/tag/untagged-eedccd1be03a2a502de1
(edit: https://github.com/ahgamut/mle/releases/tag/v1.7.2-cosmo). Download the mle executable and chmod +x (rename to mle.exe on Windows) and run from the command line.

Example screenshot from downloaded mle:

@ahgamut
Copy link
Author

ahgamut commented Apr 24, 2024

I also fixed a makefile error with vendoring static lua (the wildcard function was returning an empty list because the repo hadn't been cloned yet).

JIT support for PCRE may be finicky on ARM, so maybe that can be disabled.

- fix makefile error with vendoring static lua
- JIT support for PCRE may be finicky on ARM
@xplshn
Copy link

xplshn commented Apr 25, 2024

This is looking good!

@adsr
Copy link
Owner

adsr commented Apr 27, 2024

Hi, thanks for the contribution. A while back I was playing around with providing static binaries compiled against musl libc. I'll merge in your cosmopolitan build when I get back to that.

You can view the results here: https://github.com/ahgamut/mle/releases/tag/untagged-eedccd1be03a2a502de1
Download the mle executable and chmod +x (rename to mle.exe on Windows) and run from the command line.

The link doesn't seem to be working anymore. Did it expire or something? I'd like to test it.

@ahgamut
Copy link
Author

ahgamut commented Apr 27, 2024

Try this link? https://github.com/ahgamut/mle/releases/tag/v1.7.2-cosmo

Maybe untagged releases aren't accessible 🤔

@adsr
Copy link
Owner

adsr commented Feb 1, 2025

Was looking at this (cosmo and musl libc) again tonight. For anyone wondering, the following command seems to successfully build mle and vendor deps (PCRE2 and Lua).

$ CC=~/cosmocc/bin/cosmocc AR=~/cosmocc/bin/cosmoar make clean all mle_vendor=1

Functional tests pass. Unit tests don't work as the main unit test program uses dlopen(3) but it's not supported:

SYS 3906751 3906751          1'462'404 dlopen(NULL, 2) → 0 [dlopen() isn't supported; consider using cosmo_dlopen() and read its docs]

If I swap in cosmo_dl* functions as suggested, it still seems to fail:

SYS 3914511 3914511          3'944'863 running dlopen importer 0x7fc7314d6b40...
SYS 3914511 3914511          4'266'888 cosmo_dlopen(NULL, 2) → 0x7fc7314f12e0 EEXIST
SYS 3914511 3914511          4'282'876 cosmo_dlsym(0x7fc7314f12e0, "test_bline_delete") → 0
SYS 3914511 3914511          4'291'136 cosmo_dlsym(0x7fc7314f12e0, "test_bline_delete_str") → 0
SYS 3914511 3914511          4'293'345 exit(1)

I'd bet this is due to the unit test's -rdynamic linker flag.

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.

3 participants