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

resolves #170 build v8go for musl libc #350

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ggrossetie
Copy link

What I Did

  • create a new workflow to build GN on Alpine (build dependency of v8)
    • it will automatically create a pull request
    • if you don't trust the compiled file available at deps/alpine_x84_64/gn, you can run the workflow again to replace this file
  • add a new workflow to build v8 on Alpine
    • get v8 dependencies from the GitHub runner (ubuntu-20.04) because the script does not work on Alpine
    • use Docker to build v8 on Alpine
    • copy files from the Docker container and create a pull request
  • introduce two Python scripts to split the build task since we cannot get v8 dependencies from Alpine
    • get_v8deps.py : get v8 dependencies
    • compile_v8.py : compile v8
    • build.py uses functions from the get_v8deps.py and compile_v8.py scripts to get dependencies and compile v8 (in one go)
  • add cgo directive for deps/alpine_x86_64 (disclaimer: I don't know what I'm doing 🐶)
    • as far as I understand, it would allow to pass an environment variable CC=musl-gcc to install v8go on Alpine?
  • create a module deps/alpine_x84_64/vendor.go

resolves #170

@ggrossetie
Copy link
Author

Note : I'm currently building libv8.a for Alpine on my fork

@ggrossetie
Copy link
Author

I've added deps/alpine_x86_64/libv8.a. How can I test that everything is running fine on Alpine?

@ggrossetie
Copy link
Author

Yay! tests are running fine on Alpine 🎉
I'm using a Docker container to run the test + coverage on Go 1.17.13 alpine3.16 and 1.19.3 alpine3.16.

You can see the result on my fork: https://github.com/Mogztter/v8go/pull/1

@Vaelatern
Copy link

Will this fix 32 bit arm too? Or is there perhaps a way to put the build workflow in the process, so don't need to pre-vendor?

@ggrossetie
Copy link
Author

Not really but you can use the same approach to compile V8 on arm32 using Docker.

@wuzyk
Copy link

wuzyk commented Jun 14, 2023

Yay! tests are running fine on Alpine 🎉 I'm using a Docker container to run the test + coverage on Go 1.17.13 alpine3.16 and 1.19.3 alpine3.16.

You can see the result on my fork: https://github.com/Mogztter/v8go/pull/1

@ggrossetie Hi there! The link for the result is not working. Could you please share the working example?

@ggrossetie
Copy link
Author

@ggrossetie Hi there! The link for the result is not working. Could you please share the working example?

I was trying to build a native binary for D2 but they are now using another library so I've deleted my fork 😞

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.

Build v8go for musl libc (e.g. for alpine linux)
3 participants