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

JPM new-c-project dynamic loading not supported #93

Open
lenzj opened this issue Nov 21, 2024 · 2 comments
Open

JPM new-c-project dynamic loading not supported #93

lenzj opened this issue Nov 21, 2024 · 2 comments

Comments

@lenzj
Copy link

lenzj commented Nov 21, 2024

I'm not sure if this is a jpm issue or a janet issue, but putting it here for now.

I'm using the latest commits for janet and jpm, and am using alpine linux on an x86 laptop and PostmarketOS on an arm laptop (an alpine linux derivative).

The following error crops up on my arm aarch64 laptop.

$ jpm new-c-project ctest
author?
description?
$ cd ctest
$ jpm build
compiling c/module.c to build/c__module.0...
generating meta file build/ctest-native.meta.janet...
creating native module build/ctest-native.so...
compiling c/module.c to build/c__module.static.o...
creating static library build/ctest-native.a...
$ jpm test
running test/basic.janet ...
Hello!
running test/native.janet ...
error: could not load native build/ctest-native.so: Dynamic loading not supported
  in native [src/core/corelib.c] on line 288
  in native-loader [boot.janet] on line 3060, column 40
  in require-1 [boot.janet] on line 3088, column 18
  in import* [boot.janet] (tail call) on line 3121, column 15
non-zero exit code in test/native.janet:
x Failing test scripts:

When running the same scenario on my x86 laptop it completes the jpm test without any errors.

P.S.: Thank you by the way for all the work in creating / maintaining Janet and tools. I'm enjoying it greatly so far.

@bakpakin
Copy link
Member

"Dynamic loading not supported" indicates either your version of libc isn't configured for dynamic loading or that we are missing some flags somewhere. Not sure exactly, I would need to investigate to debug this. I think it has less to do with aarch64 vs x86 than it has to do with the operating system here.

@lenzj lenzj changed the title JPM new-c-project works on x86 but not on arm JPM new-c-project dynamic loading not supported Nov 25, 2024
@lenzj
Copy link
Author

lenzj commented Nov 25, 2024

I think you are correct that it is an OS issue more than an aarch64 vs. x86 issue. I created a clean alpine linux container using podman on both operating systems and it worked fine without issues. I changed the issue title accordingly. I can close this as I assume that dynamic loading is a fundamental requirement to be able to load a c module in a janet script. If you think there is something worth investigating here let me know and I will leave the issue open and help where I can.

As a workaround I plan on compiling my janet scripts to static linked executables within a container on the PostmarketOS system.

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

No branches or pull requests

2 participants