chamburr / glance

🔎 All-in-one Quick Look plugin
MIT License
427 stars 16 forks source link

Contribution: Fail to compile Glance #20

Closed bpisano closed 2 years ago

bpisano commented 2 years ago

Hi everyone, I've been using Glance for a long time and I'm considering to contribute to this project since it is now open source ! I've tried to design a set of icons for the app to make it better match with the new Big Sur style of macOS. I wanted to try it in the app but I'm having trouble to compile it.

I've read the contribution section in the README, but I still fail to launch the app on my computer. I've installed go and I'm using Xcode 13.4.1. When compiling the Glance target, I'm facing this issue:

fatal error: lipo: can't open input file: htmlconverter-amd64.a (No such file or directory)
cp: htmlconverter-amd64.h: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code

This output comes from the QLPlugin script in its build phase:

cd ./HTMLConverter/
GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build --buildmode=c-archive -ldflags "-s -w" -o ./htmlconverter-amd64.a
GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build --buildmode=c-archive -ldflags "-s -w" -o ./htmlconverter-arm64.a
lipo -create -output htmlconverter.a htmlconverter-amd64.a htmlconverter-arm64.a
cp htmlconverter-amd64.h htmlconverter.h

This script fails to run even if go is installed and working on my Mac. Is there any step I've been missing to make it work ?

chamburr commented 2 years ago

Hello, could you let me know the output of the go build … commands?

bpisano commented 2 years ago

It seems that the go command could not be found.

Capture d’écran 2022-06-30 à 09 01 12

But typing go version in the terminal is working fine.

Capture d’écran 2022-06-30 à 09 02 51
chamburr commented 2 years ago

You would want to either symlink go to /usr/local/bin/go, or change $PATH in Xcode, or replace go with an absolute path.

bpisano commented 2 years ago

Thanks for your help. I installed Go using homebrew. On M1 Mac, you need to change the $PATH in Xcode so it can load the command. The script now looks like this:

export PATH="$PATH:/opt/homebrew/bin"

cd ./HTMLConverter/
GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build --buildmode=c-archive -ldflags "-s -w" -o ./htmlconverter-amd64.a
GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build --buildmode=c-archive -ldflags "-s -w" -o ./htmlconverter-arm64.a
lipo -create -output htmlconverter.a htmlconverter-amd64.a htmlconverter-arm64.a
cp htmlconverter-amd64.h htmlconverter.h