ghz icon indicating copy to clipboard operation
ghz copied to clipboard

Can ghz run on arm linux?

Open luochen52 opened this issue 4 years ago • 6 comments

Can ghz run on arm linux? If it can, how can I compile an arm binary, and why not offer arm release binaries officially

luochen52 avatar May 29 '20 09:05 luochen52

This should be possible using cross compile (tutorial). Simply install go, clone the repository, and then compile:

$ cd cmd/ghz
$ CGO_ENABLED=0 GOOS=linux GOARCH=arm go build .

This should work. I will look into possibly providing prebuilt binaries, but this should be sufficient until then.

bojand avatar Jun 02 '20 01:06 bojand

Hi @bojand

I have worked on building aarch64 binaries for ghz, please have a look at the steps for creating the binary:

1. export CGO_ENABLED= 0 2. mkdir ./dist/ 3. mkdir ./dist/linux-aarch64 4. go build -ldflags="-s -w -X 'main.version=v0.110.0' -X 'main.commit=f6b700a0a7fa0d3b404f8a45085facd934463a7b' -X 'main.date=2022-09-05T18:03:19.914Z'" -o ./dist/linux-aarch64/ ./cmd/ghz/...

Please have a look at the steps for creating ghz-web binary:

1. export CGO_ENABLED=1 2. go build -ldflags="-s -w -X 'main.version=refs/tags/v0.110.0' -X 'main.commit=f6b700a0a7fa0d3b404f8a45085facd934463a7b' -X 'main.date=2022-09-05T18:03:19.914Z'" -o ./dist/linux-aarch64/ ./cmd/ghz-web/...

I am able to successfully create ghz and ghz-web aarch64 binaries by following the above steps. I have explored and it looks like ghz and ghz-web binaries are getting released through Github actions.

Do you have any plans for supporting arm64 platform?

It will be helpful if arm64 binaries are released. Please share your thoughts on this.

odidev avatar Oct 17 '22 11:10 odidev

Hi @bojand, a gentle reminder - can you please share your opinion.

odidev avatar Dec 20 '22 10:12 odidev

Hello, can you try the arm64 builds in v0.112.0-pre.1 and let me know if these binaries work.

bojand avatar Jan 02 '23 02:01 bojand

Hi @bojand, Thanks for your response and releasing the arm64 binaries. I checked the arm64 binaries and it looks like the ghz-web binary present inside the tar file is of x86-64 only and not arm64, please have a look below: 

ubuntu@ip-172-31-38-39:~/ghz $ file ghz-web 
ghz-web: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=f73a62a5d9c6e7677afef03df0690b775c7e1919, for GNU/Linux 3.2.0, stripped 
ubuntu@ip-172-31-38-39:~/ghz$ ./ghz-web --help 
-bash: ./ghz-web: cannot execute binary file: Exec format error 

I suppose we need to provide arm64 ghz-web binary in it.

odidev avatar Jan 02 '23 10:01 odidev

Hello, I thought the issue was only related to the ghz binary... This is proving to be a little trickier for the ghz-web project as it requires CGO_ENABLED=1, which fails to build properly for arm. I will have to investigate this further.

bojand avatar Jan 02 '23 15:01 bojand