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

Go Image build failing with segmentation fault #18719

Closed
anishasthana opened this issue May 28, 2023 · 3 comments
Closed

Go Image build failing with segmentation fault #18719

anishasthana opened this issue May 28, 2023 · 3 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. macos MacOS (OSX) related

Comments

@anishasthana
Copy link

Bug description

I've run into an image build failure using podman desktop on an M1 mac with the go build step getting segmentation faults. The same image build is succeeding when I run in a fedora environment. (Logs pasted below). The only difference in the command being called is that in Mac I'm calling podman build -t <tag> . --arch=amd64, whereas in fedora I'm just calling podman build -t <tag> .

Mac details

➜  go version
go version go1.17 darwin/arm64
➜  uname
Darwin
➜  uname -r
22.4.0

➜ podman version
Client:       Podman Engine
Version:      4.5.0
API Version:  4.5.0
Go Version:   go1.20.3
Git Commit:   75e3c12579d391b81d871fd1cded6cf0d043550a
Built:        Fri Apr 14 13:28:20 2023
OS/Arch:      darwin/arm64

Server:       Podman Engine
Version:      4.5.0
API Version:  4.5.0
Go Version:   go1.20.2
Built:        Fri Apr 14 15:41:12 2023
OS/Arch:      linux/arm64

Fedora details

$go version
go version go1.17 linux/amd64
$ uname -r
5.18.13.200.fc36.x86_64
$ podman version
podmanClient:       Podman Engine
Version:      4.3.1
API Version:  4.3.1
Go Version:   go1.18.7
Built:        Fri Nov 11 10:24:13 2022
OS/Arch:      linux/amd64

Operating system

Apple Sillicon

Version

1.0.x

Steps to reproduce

I am building this dockerfile: https://github.com/anishasthana/kuberay/blob/update_makefile/ray-operator/Dockerfile

The command is generally run through a makefile, but the makefile is just calling podman under the hood. The only difference in the command being called is that in Mac I'm calling podman build -t <tag> . --arch=amd64, whereas in fedora I'm just calling podman build -t <tag> .

Relevant log output

[1/2] STEP 9/9: RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
go build k8s.io/api/rbac/v1: /usr/local/go/pkg/tool/linux_amd64/compile: signal: segmentation fault (core dumped)
go build k8s.io/client-go/tools/record: /usr/local/go/pkg/tool/linux_amd64/compile: signal: segmentation fault (core dumped)
Error: building at STEP "RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go": while running runtime: exit status 1

make: *** [docker-image] Error 1


### Additional context

_No response_
@anishasthana anishasthana added the kind/bug Categorizes issue or PR as related to a bug. label May 28, 2023
@benoitf benoitf transferred this issue from podman-desktop/podman-desktop May 28, 2023
@github-actions github-actions bot added the macos MacOS (OSX) related label May 28, 2023
@benoitf
Copy link
Contributor

benoitf commented May 28, 2023

Transferring the issue to podman repository as Podman Desktop is not involved here.

I think it might link to a qemu issue ( cross compilation and go have segmentation issues)

@vrothberg
Copy link
Member

@flouthoc PTAL

@flouthoc flouthoc self-assigned this Jul 11, 2023
@flouthoc
Copy link
Collaborator

flouthoc commented Jul 11, 2023

Hi @anishasthana ,

You machine VM is runnin on arm64 afaics, and you want to build an image for amd64 this will need emulation so you have to make sure if podman machine VM contains qemu-user-static if not then you must install it manually on the VM.

or you can do

podman machine ssh
sudo -i
rpm-ostree install qemu-user-static
systemctl reboot

Irrespective of this I think there is a plan to add this by default in the machine.

Also I think it should work if you don't add --arch=amd64 but now it will build image for arm64.

I am closing this issue since this is a qemu-user-static missing case, but please feel free to re-open if you think something is unresolved.

See-also: #16148

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Oct 10, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. macos MacOS (OSX) related
Projects
None yet
Development

No branches or pull requests

4 participants