Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#64174 closed defect (fixed)

gvisor-tap-vsock: file was built for unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) which is not the architecture being linked (x86_64)

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: judaew (Vadym-Valdis Yudaiev)
Priority: Normal Milestone:
Component: ports Version: 2.7.1
Keywords: sierra Cc:
Port: gvisor-tap-vsock

Description

https://build.macports.org/builders/ports-10.12_x86_64-builder/builds/165022/steps/install-port/logs/stdio

go build -ldflags '-s -w' -o bin/gvproxy ./cmd/gvproxy
go build -ldflags '-s -w' -o bin/qemu-wrapper ./cmd/qemu-wrapper
GOOS=linux CGO_ENABLED=0 go build -ldflags '-s -w' -o bin/vm ./cmd/vm
# github.com/containers/gvisor-tap-vsock/cmd/vm
loadinternal: cannot find runtime/cgo
/opt/local/lib/go/pkg/tool/darwin_amd64/link: running /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_net_gvisor-tap-vsock/gvisor-tap-vsock/work/compwrap/cc/usr/bin/clang failed: exit status 1
ld: warning: option -s is obsolete and being ignored
ld: warning: ignoring file /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_net_gvisor-tap-vsock/gvisor-tap-vsock/work/.tmp/go-link-2142907621/go.o, file was built for unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) which is not the architecture being linked (x86_64): /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_net_gvisor-tap-vsock/gvisor-tap-vsock/work/.tmp/go-link-2142907621/go.o
Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

make: *** [vm] Error 2
make: *** Waiting for unfinished jobs....

Change History (9)

comment:1 Changed 3 years ago by judaew (Vadym-Valdis Yudaiev)

Keywords: sierra added

Everything builds correctly on Monterey, so I add this keyword

comment:2 Changed 3 years ago by judaew (Vadym-Valdis Yudaiev)

0x45 0x4C 0x46 is ELF. I don't know why gvisor-tap-vsock create an object file in a other format.

comment:3 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Is there any way to make the build more verbose? I do not see, for example, the command that created go.o.

comment:4 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Oh, I do however see GOOS=linux which is surely wrong.

comment:5 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

According to the ports web page, the build is failing on Sierra and earlier and succeeding on High Sierra and later, but even where it succeeds it is using GOOS=linux...

comment:6 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

The portfile asks to build the target build, and the Makefile says:

.PHONY: build
build: gvproxy qemu-wrapper vm

.PHONY: gvproxy
gvproxy:
	go build $(LDFLAGS) -o bin/gvproxy ./cmd/gvproxy

.PHONY: qemu-wrapper
qemu-wrapper:
	go build $(LDFLAGS) -o bin/qemu-wrapper ./cmd/qemu-wrapper

.PHONY: vm
vm:
	GOOS=linux CGO_ENABLED=0 go build $(LDFLAGS) -o bin/vm ./cmd/vm

But then the port's destroot phase only installs gvproxy. So there doesn't seem to be any reason to build the qemu-wrapper and vm targets, the latter of which seems to be the source of the problem. Should the port be changed to use build target gvproxy instead?

comment:7 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

I am guessing that the reason why it fails on Sierra and earlier is that the golang portgroup is including the legacysupport portgroup, and that is trying to link things with the legacysupport library on Sierra and earlier, which for the ELF executable being built for the vm target would be a mismatch.

comment:8 Changed 3 years ago by Vadim-Valdis Yudaev <judaew@…>

Resolution: fixed
Status: assignedclosed

In f83cb3e2941ed7a72456b8a8de7279846e100d92/macports-ports (master):

gvisor-tap-vsock: Build only gvproxy

Closed: #64174

The Makefile also contains the "qemu-wrapper" and "vm" targets that we
are not using. "vm" is built only for Linux and throws a compile error
on macOS Sierra and below.

These changes do not change the files being installed, so revision is
unnecessary.

comment:9 Changed 3 years ago by judaew (Vadym-Valdis Yudaiev)

I'm sorry, I just saw your comments. But we both came to the same conclusion. Thanks so much for the help.

Note: See TracTickets for help on using tickets.