cbednarski / hostess

An idempotent command-line utility for managing your /etc/hosts file.
MIT License
846 stars 40 forks source link

RaspberryPi Zero W not supported? #46

Open CamDavidsonPilon opened 3 years ago

CamDavidsonPilon commented 3 years ago

Hi @cbednarski, your precompiled assets work well for the traditional Rpis I have (Rpi 3 & 4), but I get an error when using them with my RPi Zero W. Here's my test script:

wget https://github.com/cbednarski/hostess/releases/download/v0.5.2/hostess_linux_arm
chmod a+x hostess_linux_arm
sudo ./hostess_linux_arm rm raspberrypi

errors with Illegal instruction.

cbednarski commented 3 years ago

Hey @CamDavidsonPilon, thanks for the note. I don't have a Raspberry Pi Zero to test on, but I did some reading online and I found some info.

First, it appears that the Raspberry Pi Zero uses ARMv6 -- this refers to the CPU instructions on the chipset. Second, Go has compiler environment option to target different ARM chips. I didn't specify anything when I compiled so I guess the default is ARMv7, and the error seems to indicate that the program is trying to call a CPU instruction that the Raspberry Pi Zero doesn't have.

You may be able to solve this by compiling from source using the following:

git clone https://github.com/cbednarski/hostess
cd hostess
GOOS=linux GOARCH=arm GOARM=6 go build .

If this resolves the issue for you let me know. I'm also curious whether the ARMv6 builds work on the Raspberry Pi 3 and 4. I would guess so, but I was not even aware of this issue until you brought it up!

Assuming this all works out I can add this env var to the makefile for the next release.

CamDavidsonPilon commented 3 years ago

That worked! I had to slightly modify your script:

GOOS=linux GOARCH=arm GOARM=6 go build -o hostess_build .