Skip to content

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

@sammy-hughes

Description

@sammy-hughes

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions