go-astilectron-demo: Unable to bundle - Help Needed !!
When trying to build, i am getting this error.
FATA[0018] bundling failed: bundling for environment linux/amd64 failed: building failed: # github.com/asticode/go-astilectron-demo
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: i386 architecture of input file `/tmp/go-link-847150656/000000.o' is incompatible with i386:x86-64 output
collect2: error: ld returned 1 exit status
1. I have not updated bundler.json to build for any specific architecture
"app_name": "Astilectron demo",
"icon_path_darwin": "resources/icon.icns",
"icon_path_linux": "resources/icon.png",
"icon_path_windows": "resources/icon.ico",
"output_path": "output"
}
2. go version go1.10 linux/amd64
3. I was able to build it for linux before, but then i tried to build it for windows architecture {“arch”: “386”, “os”: “windows”} . It threw error and on subsequent attempt it didnt even build for linux. I guess somewhere i messed up my environments . Any help ??
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 44 (17 by maintainers)
Ok I got everything to work by doing
go get github.com/mattn/go-colorable
and changingbundler.json
:Adding the
ldflags
seemed to be the root cause for not building on linux/arm64.I had an error because I linked sqlite3 (github.com/mattn/go-sqlite3) and the solution was to set linkmode as external (https://github.com/mattn/go-sqlite3/issues/414#issuecomment-297887898)
Works for building linux now. And it works for building Darwin, but I’ve noticed that building for Darwin fails if it follows building for windows.
So this fails for darwin:
“environments”: [{ “arch”: “amd64”, “os”: “linux” }, { “arch”: “amd64”, “os”: “windows” }, { “arch”: “amd64”, “os”: “darwin” }]
DEBU[0020] Bundling for environment darwin/amd64
DEBU[0020] Binding data
DEBU[0020] Removing /tmp/astibundler/bind
DEBU[0020] Creating /tmp/astibundler/bind
DEBU[0020] Creating /tmp/astibundler/bind/vendor_astilectron_bundler DEBU[0020] Creating /tmp/astibundler/cache
DEBU[0020] /tmp/astibundler/cache/astilectron-0.30.0.zip already exists, skipping download of https://github.com/asticode/astilectron/archive/v0.30.0.zip DEBU[0020] Copying /tmp/astibundler/cache/astilectron-0.30.0.zip to /tmp/astibundler/bind/vendor_astilectron_bundler/astilectron.zip DEBU[0020] /tmp/astibundler/cache/electron-darwin-amd64-4.0.1.zip already exists, skipping download of https://github.com/electron/electron/releases/download/v4.0.1/electron-v4.0.1-darwin-x64.zip DEBU[0020] Copying /tmp/astibundler/cache/electron-darwin-amd64-4.0.1.zip to /tmp/astibundler/bind/vendor_astilectron_bundler/electron.zip DEBU[0020] Creating /tmp/astibundler/bind/resources
DEBU[0020] Copying /home/steve/go/src/github.com/asticode/go-astilectron-demo/resources to /tmp/astibundler/bind/resources DEBU[0020] Generating /home/steve/go/src/github.com/asticode/go-astilectron-demo/bind_darwin_amd64.go DEBU[0022] Removing /home/steve/go/src/github.com/asticode/go-astilectron-demo/output/darwin-amd64 DEBU[0022] Creating /home/steve/go/src/github.com/asticode/go-astilectron-demo/output/darwin-amd64 DEBU[0022] Building for os darwin and arch amd64
DEBU[0022] Executing go build -ldflags -H windowsgui -X “main.AppName=Astilectron demo” -X “main.BuiltAt=2019-02-07 13:15:58.085929556 -0800 PST m=+2.716369126” -X “main.AppName=Astilectron demo” -X “main.BuiltAt=2019-02-07 13:16:07.473656292 -0800 PST m=+12.104095852” -X “main.AppName=Astilectron demo” -X “main.BuiltAt=2019-02-07 13:16:18.010867955 -0800 PST m=+22.641307535” -linkmode internal -o /home/steve/go/src/github.com/asticode/go-astilectron-demo/output/darwin-amd64/binary github.com/asticode/go-astilectron-demo FATA[0030] bundling failed: bundling for environment darwin/amd64 failed: building failed: # github.com/asticode/go-astilectron-demo adddynlib: unsupported binary format : exit status 2
but this will succeed:
“environments”: [{ “arch”: “amd64”, “os”: “linux” }, { “arch”: “amd64”, “os”: “darwin” }]
Thanks.