Hello, I’m trying to build a hello world app in golang following the docs here: MacOS - Ops
I tried with both amd64 and arm64, hope you can give me a hand.
% GOARCH=amd64 GOOS=linux go build .
% ops run --arch=amd64 hello
100% |████████████████████████████████████████|
running local instance
booting /Users/ernesto/.ops/images/hello ...
Could not allocate dynamic translator buffer
exit status 1
% file hello
hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=l7mZm8m5mDX469ZwcApu/WgpDpWI6ig4aqoU29Lme/BlENpzsteh5RDhVcqzih/W0xfzKheXrbDZC6jnDHn, with debug_info, not stripped
% rm hello
% GOARCH=arm64 GOOS=linux go build .
% ops run --arch=arm64 hello
100% |████████████████████████████████████████|
running local instance
booting /Users/ernesto/.ops/images/hello ...
Could not allocate dynamic translator buffer
exit status 1
% file hello
hello: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, Go BuildID=HzCWcvqS6jwMw9MUrc5H/GK5jrmhcgomxNGWUwvKW/gUSyYLwrd42D5gdS1MMV/zVh604LnjO8kqmSG11sz, with debug_info, not stripped
Here is my system info:
% sysctl kern.hv_support
kern.hv_support: 1
% uname -a
Darwin M1.local 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul 5 22:22:52 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T8103 arm64
% go version
go version go1.21.3 darwin/arm64
% brew info ops
==> nanovms/ops/ops: stable 0.1.39, HEAD
OPS - Build and Run Nanos Unikernels
https://nanos.org/
/opt/homebrew/Cellar/ops/0.1.39_1 (3 files, 90.5MB) *
Built from source on 2023-11-07 at 09:00:08
From: https://github.com/nanovms/homebrew-ops/blob/HEAD/Formula/ops.rb
License: Apache 2.0
==> Dependencies
Build: go ✔
Required: qemu ✔, bufbuild/buf/buf ✔, protoc-gen-go-grpc ✔
==> Options
--HEAD
Install HEAD version
When I installed ops and nanovms I already had the latest qemu version, but got a brew dependency/conflict error, so I unliked the latest one with this command: brew unlink qemu
I’m going to disable the old one and re-enable the latest one.
Yeh, you can ignore that ‘exit status 1’ - there’s no error. I think that was left in there on purpose for a test but it probably shouldn’t be shown to the user regardless as it’s confusing.
So it looks like you are on a m1 which is an arm machine and you don’t need to pass the arch flag. Can you try just a ‘ops run hello’ for that? If that doesn’t work can you paste ‘ops run hello -v --show-debug’ ?
% ops run hello
100% |████████████████████████████████████████|
running local instance
booting /Users/ernesto/.ops/images/hello ...
en1: assigned 10.0.2.15
frame 0x00ff800040ee0000 already full
Angel shutdown trap failed; shutting down with PSCI.
QEMU exit code will not reflect program exit code.
I saw Francesco fixed the issue, thank you very much.
So, do you know when a new release including this fix will be available?
I can try to build it from the source if there is no certain date as of now.
Hi Ernesto,
You don’t have to wait until a new release is available, you can always run the kernel nightly build by adding the -n command line flag to your ops run command. For example: ops run hello -n. This will automatically download the latest nightly build of the kernel (which is updated every day from the master branch of the Nanos repository) and use that in the image being created.
Regards,
Francesco