Closed nanu-c closed 3 years ago
Indeed this logic may not be up to date. Can you provide both your GOOS
and GOARCH
?
Here you go:
echo "Build linux amd64"
mkdir -p build/linux-amd64/axolotl-web
env GOOS=linux GOARCH=amd64 go build -o build/linux-amd64/axolotl .
cp axolotl-web/dist build/linux-amd64/axolotl-web -r
echo "Build linux arm7"
mkdir -p build/linux-arm7/axolotl-web
env GOOS=linux GOARCH=arm GOARM=7 go build -o build/linux-arm7/axolotl .
cp axolotl-web/dist build/linux-arm7/axolotl-web -r
echo "Build linux arm64"
mkdir -p build/linux-arm64/axolotl-web
env GOOS=linux GOARCH=arm64 go build -o build/linux-arm64/axolotl .
cp axolotl-web/dist build/linux-arm64/axolotl-web -r
echo "Build windows amd64"
mkdir -p build/windows-amd64/axolotl-web
env GOOS=windows GOARCH=amd64 go build -ldflags -H=windowsgui -o build/windows-amd64/axolotl.exe .
cp axolotl-web/dist build/windows-amd64/axolotl-web -r
echo "Build darwin amd64"
mkdir -p build/darwin-amd64/axolotl-web
env GOOS=darwin GOARCH=amd64 go build -o build/darwin-amd64/axolotl .
cp axolotl-web/dist build/darwin-amd64/axolotl-web -r
I've added arm64
handling. Can you fetch the last change (or tag v0.15.0
) and confirm this is working properly ?
Hi @asticode,
I tried to build an app for darwin
/arm64
with the go 1.16 beta, but it is downloading the wrong Electron version:
2021/01/06 20:47:21 Bundling for environment darwin/arm64
2021/01/06 20:47:21 Binding data
2021/01/06 20:47:21 Removing /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/astibundler/bind
2021/01/06 20:47:21 Creating /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/astibundler/bind
2021/01/06 20:47:21 Creating /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/astibundler/bind/vendor_astilectron_bundler
2021/01/06 20:47:21 Creating /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/astibundler/cache
2021/01/06 20:47:21 /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/astibundler/cache/astilectron-0.42.0.zip already exists, skipping download of https://github.com/asticode/astilectron/archive/v0.42.0.zip
2021/01/06 20:47:21 Copying /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/astibundler/cache/astilectron-0.42.0.zip to /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/astibundler/bind/vendor_astilectron_bundler/astilectron.zip
2021/01/06 20:47:21 Downloading https://github.com/electron/electron/releases/download/v11.1.1/electron-v11.1.1-darwin-x64.zip into /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/astibundler/cache/electron-darwin-arm64-11.1.1.zip
2021/01/06 20:47:21 astikit: sending GET request to https://github.com/electron/electron/releases/download/v11.1.1/electron-v11.1.1-darwin-x64.zip (1/1)
2021/01/06 20:47:22 Copying /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/astibundler/cache/electron-darwin-arm64-11.1.1.zip to /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/astibundler/bind/vendor_astilectron_bundler/electron.zip
2021/01/06 20:47:23 Creating /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/astibundler/bind/resources
2021/01/06 20:47:23 Copying /Users/runner/work/kubenav/kubenav/cmd/electron/resources to /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/astibundler/bind/resources
2021/01/06 20:47:24 Generating /Users/runner/work/kubenav/kubenav/cmd/electron/bind_darwin_arm64.go
2021/01/06 20:47:28 Removing /Users/runner/work/kubenav/kubenav/cmd/electron/output/darwin-arm64
2021/01/06 20:47:28 Creating /Users/runner/work/kubenav/kubenav/cmd/electron/output/darwin-arm64
2021/01/06 20:47:28 Building for os darwin and arch arm64 astilectron: 0.42.0 electron: 11.1.1
2021/01/06 20:47:28 Executing go build -ldflags --X "github.com/kubenav/kubenav/pkg/version.Version=3.3.0" --X "github.com/kubenav/kubenav/pkg/version.Revision=c81990189cf50673852650bea2e12162101f0800" --X "github.com/kubenav/kubenav/pkg/version.Branch=HEAD" --X "github.com/kubenav/kubenav/pkg/version.BuildUser=runner" --X "github.com/kubenav/kubenav/pkg/version.BuildDate=2021-01-06@20:45:50" -X "main.AppName=kubenav" -X "main.BuiltAt=2021-01-06 20:47:28.95676 +0000 UTC m=+97.746582423" -X "main.VersionAstilectron=0.42.0" -X "main.VersionElectron=11.1.1" -o /Users/runner/work/kubenav/kubenav/cmd/electron/output/darwin-arm64/binary .
2021/01/06 20:48:55 Creating /Users/runner/work/kubenav/kubenav/cmd/electron/output/darwin-arm64/kubenav.app/Contents/MacOS
2021/01/06 20:48:55 Moving /Users/runner/work/kubenav/kubenav/cmd/electron/output/darwin-arm64/binary to /Users/runner/work/kubenav/kubenav/cmd/electron/output/darwin-arm64/kubenav.app/Contents/MacOS/kubenav
2021/01/06 20:48:56 Chmoding /Users/runner/work/kubenav/kubenav/cmd/electron/output/darwin-arm64/kubenav.app/Contents/MacOS/kubenav
2021/01/06 20:48:56 Creating /Users/runner/work/kubenav/kubenav/cmd/electron/output/darwin-arm64/kubenav.app/Contents/Resources
2021/01/06 20:48:56 Copying /Users/runner/work/kubenav/kubenav/cmd/electron/resources/icon.icns to /Users/runner/work/kubenav/kubenav/cmd/electron/output/darwin-arm64/kubenav.app/Contents/Resources/kubenav.icns
2021/01/06 20:48:56 Adding Info.plist to /Users/runner/work/kubenav/kubenav/cmd/electron/output/darwin-arm64/kubenav.app/Contents/Info.plist
I think the following logic must be adjusted again https://github.com/asticode/go-astilectron/blob/c1e97058ea53ac7777e0499420c56ac8104a541b/paths.go#L135
I think the logic can be adjusted as follows, but this would break backward compatibility and doesn't work, when no arch is provided (https://github.com/asticode/go-astilectron/blob/c1e97058ea53ac7777e0499420c56ac8104a541b/paths_test.go#L44).
if strings.ToLower(arch) == "amd64" {
a = "x64"
} else if strings.ToLower(arch) == "arm64" && o == "darwin" {
a = "arm64"
} else if strings.ToLower(arch) == "arm" && o == "linux" {
a = "armv7l"
} else if strings.ToLower(arch) == "arm64" && o == "linux" {
a = "arm64"
}
So I'm not sure if this should be the solution or if there is a better/preferred way to implement this. Can you take a look at this please?
@ricoberger I don't think this is linked to the go
version but to the custom electron
version you provided. Indeed, in v11.1.1
it seems they've added arm64
to darwin
version.
I don't mind bumping electron version to v11.1.1
and updating the path logic, but I want to be sure all features are still working in v11.1.1
. Can you confirm?
Hi, we are using Electron v11.1.1 since one month now and haven't seen any problems so far.
Since we are not using all available features, I'm not sure if everything is compatible. Maybe this can also be implemented without bumping the default Electron version:
if strings.ToLower(arch) == "arm64" && o == "darwin" {
a = "arm64"
} else if strings.ToLower(arch) == "arm" && o == "linux" {
a = "armv7l"
} else if strings.ToLower(arch) == "arm64" && o == "linux" {
a = "arm64"
} else {
a = "x64"
}
This should just fail for older Electron versions, when the darwin
/arm64
is used as build target and it should be compatible with existing setups, since it would also use x64
when the arch
option isn't set for darwin
.
Maybe this can also log a warning, that darwin
/arm64
is only supported for Electron v11.x.
FYI I've decided to bump electron
to v11.1.0
. This version seems to be compatible.
I've created tags for astilectron
ecosystem accordingly.
Thank you, I tried the new version and the build looks good 🙂
It should show smth. like
instead it shows
but the path is correct
electron/vendor/electron-linux-arm64