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

FFI Module is not supported on several platforms #1165

Open
LeviSchuck opened this issue May 28, 2023 · 5 comments
Open

FFI Module is not supported on several platforms #1165

LeviSchuck opened this issue May 28, 2023 · 5 comments

Comments

@LeviSchuck
Copy link

Hello,

The change in 398833e is no longer building on the following platforms, based upon an alpine docker image, such as 3.18.

  • linux/386 / linux/i386
  • linux/arm64
  • linux/arm/v6
  • linux/arm/v7

The current master branch is a -dev build for now, I understand. This issue is to inform you of the affected platforms for later review with FFI improvements and support.

The build process responds with the following:

Starting suite 0...
Finished suite 0 in 0.037 seconds - 190 of 190 tests passed.
Starting suite 1...
Finished suite 1 in 0.112 seconds - 167 of 167 tests passed.
.... snipped .... 
Finished suite 11 in 0.421 seconds - 23 of 23 tests passed.
Starting suite 12...
error: calling convention not supported
  in ffi/call [src/core/ffi.c] on line 1355
  in memcpy [test/suite0012.janet] on line 38, column 3
  in _thunk [test/suite0012.janet] (tailcall) on line 42, column 3
make: *** [Makefile:232: test] Error 1

The following platforms still compile and work as expected:

  • linux/amd64

I am lead to believe that the FFI module is designed for 64 bit x86 environments only.
Therefore I recommend a revert of this commit until other platforms are considered and enabled in an allow-list fashion.

By reverting commit 398833e, an automated janet-docker build process I have was able to push a new image, see LeviSchuck/janet-docker@4908e03 if interested.

Best wishes,
Levi

@bakpakin
Copy link
Member

So the issue here is that the tests were never updated to work on these platforms - there is some functionality in the FFI module that is useful and works on these architectures even without the calling convention support. I don't want to disable completely for that reason, but instead detect this in the test and skip testing for unsupported platforms.

@bakpakin
Copy link
Member

Also, #1162 might help address issues like this.

@Techcable
Copy link
Contributor

Maybe use libffi or dyncall to support these other architectures?

@bakpakin
Copy link
Member

bakpakin commented Jun 7, 2023

One of the design goals is to not link to anything besides libc to make embedding easier, so vetoing libffi and dyncall in the core

bakpakin added a commit that referenced this issue Jun 8, 2023
…g testing.

Query at runtime which calling conventions are supported, including
a placeholder :none.
@iacore
Copy link
Contributor

iacore commented Sep 20, 2023

I think it can link libffi statically. Like how it's possible to link mimalloc statically.

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

4 participants