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

How to cross compile linux app binary in my macos machine? #367

Open
wymli opened this issue Jan 23, 2023 · 3 comments
Open

How to cross compile linux app binary in my macos machine? #367

wymli opened this issue Jan 23, 2023 · 3 comments
Labels
improvement New feature or request

Comments

@wymli
Copy link

wymli commented Jan 23, 2023

If I run CGO_ENABLED=0 GOOS=linux GOARCH=amd64 bud build, got an error:

# github.com/livebud/bud/internal/dag
../../.gvm/pkgsets/go1.18/global/pkg/mod/github.com/livebud/bud@v0.2.7/internal/dag/sqlite.go:345:27: undefined: sqlite3.Error
../../.gvm/pkgsets/go1.18/global/pkg/mod/github.com/livebud/bud@v0.2.7/internal/dag/sqlite.go:349:47: undefined: sqlite3.ErrReadonlyDbMoved
| exit status 2

but run bud build will build successfully.


❯ bud version
bud: 0.2.7
svelte: 3.47.0
react: 18.0.0

@matthewmueller
Copy link
Contributor

matthewmueller commented Jan 24, 2023

This is currently a limitation though thanks for the heads up on sqlite3. This is a recent addition and worth fixing.

Lurking behind this issue is that Bud's production version embeds V8 so it can perform SSR efficiently. V8 depends on CGO. I plan to provide more options to bring back cross-compilation in the future.

In the meantime to do cross-compilation, I'd suggest running bud build within a Linux docker. The contributing guide has an example Docker container. You could also go with xgo which is what I use to compile Bud.

@matthewmueller matthewmueller added the improvement New feature or request label Jan 24, 2023
@derkan
Copy link

derkan commented Nov 3, 2023

What about switching to https://gitlab.com/cznic/sqlite ? No CGO is needed.

@matthewmueller
Copy link
Contributor

matthewmueller commented Nov 6, 2023

What about switching to https://gitlab.com/cznic/sqlite

It's a good idea for SQLite. Unfortunately we'd still have V8 though.


I'm moving away from the CGO dependencies in the next iteration of Bud. Stay tuned!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants