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

Arm and Mac M-Series Support for V8 #331

Open
MikeHawkesCapventis opened this issue Jul 29, 2024 · 2 comments
Open

Arm and Mac M-Series Support for V8 #331

MikeHawkesCapventis opened this issue Jul 29, 2024 · 2 comments
Labels
proposal Enhancement idea or proposal

Comments

@MikeHawkesCapventis
Copy link

Proposed change

I love the functionality of nex and would like to extend the V8 services to 'wrap' our own libraries. I can do this by editing v8.go (I almost raised an issue to suggest providing an abstraction to allow devs to add functions to the v8 layer, but guess that's beyond the scope of nex). However, the current build restricts v8 compilation to linux/amd64, so we're unable to develop lambda-style functions on Mac M-series or Arm machines without running something like Ubuntu emulations.

The lambda-style functions are extremely exciting to us - even more so if we can get it on different architectures.

Use case

V8 function development and deployment on NATS/Nex for Mac M-Series and Arm devices.

Contribution

Potentially looking at this - but not. yet. If you already have something in the pipeline, then I'd prefer to go with the official build.

@MikeHawkesCapventis MikeHawkesCapventis added the proposal Enhancement idea or proposal label Jul 29, 2024
@autodidaddict
Copy link
Contributor

The limitation on V8 execution is coming from the V8 library itself. It will only work in a small set of targets. We've been checking into the possibility of providing a more broadly supported JavaScript runtime. Until then, plugins are a workaround.

We now have pluggable workload execution providers, so one could be written that uses a different JavaScript hosting engine than what we're using now.

@MikeHawkesCapventis
Copy link
Author

Thanks for the reply - I get where you're coming from. The pluggable execution providers will definitely help.

Having had a delve, I managed to get everything compiling in a dev container on the Mac - the trick being to build the environment using a docker file with platform: linux/amd64 - that lets me build and run (in no_sandbox mode). With that I could then edit the v8.go to put an extra global object after the hostServices... you add. That brought our custom functions into the V8 environment without issue - the only downside being that I had to edit your v8.go to do it.

Overall, it's got to a good place ... with just a little inconvenience / hackery around extensions for V8. I appreciate it's a bit of a V8 vs Nex thing, but it is relatively easy to do. For the Arm and Mac executables, I think we might end up resorting to something like github.com/robertkrimen/otto just for the ease of adding functions in go natively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Enhancement idea or proposal
Projects
None yet
Development

No branches or pull requests

2 participants