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

Cannot perform cross-platform builds darwin/arm64->linux/amd64 #363

Open
sammy-hughes opened this issue Sep 24, 2024 · 0 comments
Open

Cannot perform cross-platform builds darwin/arm64->linux/amd64 #363

sammy-hughes opened this issue Sep 24, 2024 · 0 comments

Comments

@sammy-hughes
Copy link

sammy-hughes commented Sep 24, 2024

I'm trying to build a package for a project which will be deployed to amd64/linux targets.

An example of the command I'm trying to run: GOOS=linux GOARCH=amd64 gopy pkg -dynamic-link=true --output=httpygo/__pkg/job -vm=python3 ./pkg/job

That causes the following log output:

(venv) eixvc@WUST049416 httpy-go % make build
rm -R ./httpygo/__pkg
GOOS=linux GOARCH=amd64 gopy pkg -dynamic-link=true --output=httpygo/__pkg/job -vm=python3  ./pkg/job
go build -v ./pkg/job
stat /Users/~/githubrepos/location360-fld-dev-resources/proof-of-concept/httpy-go/httpygo/__pkg/job/pkg/job: directory not found
2024/09/23 19:53:18 Note: there was an error building [./pkg/job] -- will continue but it may fail later: exit status 1

--- skipping dir with no go files or only doc.go: ./pkg/job -- []

--- building package ---
gopy pkg -dynamic-link=true --output=httpygo/__pkg/job -vm=python3 ./pkg/job
goimports -w job.go
go build -mod=mod -buildmode=c-shared -o job_go.so .
cmd had error: exit status 1  output:
package github.com/bayer-int/location360-fld-dev-resources/proof-of-concept/httpy-go/httpygo/__pkg/job/job: build constraints exclude all Go files in /Users/eixvc/githubrepos/location360-fld-dev-resources/proof-of-concept/httpy-go/httpygo/__pkg/job/job

Note that I tried adding the dynamic-linking flag in case it statically linking resulted in linking errors, but it had no effect. I'm not entirely sure I understand what is actually happening.

EDIT: I just noticed that the error mesasge reports that the path is wrong. It looks like, when you specify GOOS and GOARCH, it changes the path it searches for source, appending them together. I adjusted for this by copying the source file contents into the output folder, which works without conflict. Unfortunately, the build still fails as shown here.

@sammy-hughes sammy-hughes changed the title Cannot build on arm64/darwin for amd64/linux Cannot perform cross-platform builds darwin/arm64->linux/amd64 Sep 24, 2024
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

1 participant