Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Unable to bundle - Help Needed !! #28

Closed
HIMANSHURANJAN2015 opened this issue Mar 27, 2018 · 44 comments
Closed

Unable to bundle - Help Needed !! #28

HIMANSHURANJAN2015 opened this issue Mar 27, 2018 · 44 comments
Assignees

Comments

@HIMANSHURANJAN2015
Copy link

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 ??

@asticode
Copy link
Owner

Mmm this is weird, could you execute the bundling with the -v flag and paste the logs here?

@asticode asticode self-assigned this Mar 27, 2018
@HIMANSHURANJAN2015
Copy link
Author

Thanks for the reply. Here is the logs.

DEBU[0000] Resetting
DEBU[0000] Creating /tmp/astibundler
DEBU[0000] Creating /home/himanshu/Desktop/go-workspace/src/github.com/asticode/go-astilectron-demo/output
DEBU[0000] Bundling for environment linux/amd64
DEBU[0000] Removing /home/himanshu/Desktop/go-workspace/src/github.com/asticode/go-astilectron-demo/output/linux-amd64
DEBU[0000] Creating /home/himanshu/Desktop/go-workspace/src/github.com/asticode/go-astilectron-demo/output/linux-amd64
DEBU[0000] Binding data
DEBU[0000] Removing /home/himanshu/Desktop/go-workspace/src/github.com/asticode/go-astilectron-demo/vendor_astilectron_bundler
DEBU[0000] Creating /home/himanshu/Desktop/go-workspace/src/github.com/asticode/go-astilectron-demo/vendor_astilectron_bundler
DEBU[0000] /tmp/astibundler/astilectron-0.15.0.zip already exists, skipping download of https://github.com/asticode/astilectron/archive/v0.15.0.zip
DEBU[0000] Copying /tmp/astibundler/astilectron-0.15.0.zip to /home/himanshu/Desktop/go-workspace/src/github.com/asticode/go-astilectron-demo/vendor_astilectron_bundler/astilectron.zip
DEBU[0000] Downloading https://github.com/electron/electron/releases/download/v1.8.1/electron-v1.8.1-linux-x64.zip into /tmp/astibundler/electron-linux-amd64-1.8.1.zip
DEBU[0175] Copying /tmp/astibundler/electron-linux-amd64-1.8.1.zip to /home/himanshu/Desktop/go-workspace/src/github.com/asticode/go-astilectron-demo/vendor_astilectron_bundler/electron.zip
DEBU[0175] Generating /home/himanshu/Desktop/go-workspace/src/github.com/asticode/go-astilectron-demo/bind_linux_amd64.go
DEBU[0181] Building for os linux and arch amd64
DEBU[0181] Executing go build -ldflags -s -X "main.AppName=Astilectron demo" -X "main.BuiltAt=2018-03-28 07:54:18.128436481 +0530 IST m=+181.678486615" -o /home/himanshu/Desktop/go-workspace/src/github.com/asticode/go-astilectron-demo/output/linux-amd64/binary github.com/asticode/go-astilectron-demo
FATA[0195] 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-755944944/000000.o' is incompatible with i386:x86-64 output
collect2: error: ld returned 1 exit status

: exit status 2

@asticode
Copy link
Owner

A few more questions:

  • can you send the output of go env?
  • did you add any cgo to the project?

@asticode
Copy link
Owner

(for future references, it may be linked to this issue)

@HIMANSHURANJAN2015
Copy link
Author

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/himanshu/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/himanshu/Desktop/go-workspace"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build682013582=/tmp/go-build -gno-record-gcc-switches"

@asticode
Copy link
Owner

@HIMANSHURANJAN2015 I've added a fix in a specific branch in the bundler project. Could you:

  • cd $GOPATH/src/github.com/asticode/go-astilectron-bundler
  • git pull --rebase
  • git checkout test-link
  • make
  • cd $GOPATH/src/github.com/asticode/go-astilectron-demo
  • astilectron-bundler -v

And tell me whether it's working?

@HIMANSHURANJAN2015
Copy link
Author

Thanks..that worked for the go-astilectron-demo app. I tried building it for darwin-amd64 ,linux-amd64 and windows-386. I have the executables for all the 3 environments :) .

But for my Project, which i have developed following go-astilectron-demo app, is still not building.
I am getting the following error, while bundling my "test-app"

DEBU[0000] Resetting                                    
DEBU[0000] Creating /tmp/astibundler                    
DEBU[0000] Creating /home/himanshu/Desktop/go-workspace/projects/test-app/output 
DEBU[0000] Bundling for environment linux/amd64         
DEBU[0000] Removing /home/himanshu/Desktop/go-workspace/projects/test-app/output/linux-amd64 
DEBU[0000] Creating /home/himanshu/Desktop/go-workspace/projects/test-app/output/linux-amd64 
DEBU[0000] Binding data                                 
DEBU[0000] Removing /home/himanshu/Desktop/go-workspace/projects/test-app/vendor_astilectron_bundler 
DEBU[0000] Creating /home/himanshu/Desktop/go-workspace/projects/test-app/vendor_astilectron_bundler 
DEBU[0000] /tmp/astibundler/astilectron-0.15.0.zip already exists, skipping download of https://github.com/asticode/astilectron/archive/v0.15.0.zip 
DEBU[0000] Copying /tmp/astibundler/astilectron-0.15.0.zip to /home/himanshu/Desktop/go-workspace/projects/test-app/vendor_astilectron_bundler/astilectron.zip 
DEBU[0000] /tmp/astibundler/electron-linux-amd64-1.8.1.zip already exists, skipping download of https://github.com/electron/electron/releases/download/v1.8.1/electron-v1.8.1-linux-x64.zip 
DEBU[0000] Copying /tmp/astibundler/electron-linux-amd64-1.8.1.zip to /home/himanshu/Desktop/go-workspace/projects/test-app/vendor_astilectron_bundler/electron.zip 
DEBU[0000] Generating /home/himanshu/Desktop/go-workspace/projects/test-app/bind_linux_amd64.go 
DEBU[0004] Building for os linux and arch amd64         
DEBU[0004] Executing go build -ldflags -linkmode internal -s -X "main.AppName=Test APP" -X "main.BuiltAt=2018-03-28 16:50:35.967433336 +0530 IST m=+4.825384522" -o /home/himanshu/Desktop/go-workspace/projects/test-app/output/linux-amd64/binary  
FATA[0018] bundling failed: bundling for environment linux/amd64 failed: building failed: # _/home/himanshu/Desktop/go-workspace/projects/test-app
/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-512167027/000000.o' is incompatible with i386:x86-64 output
collect2: error: ld returned 1 exit status

: exit status 2 
 

This is my bundler.json

{
  "app_name": "Test APP",
  "icon_path_darwin": "resources/icon.icns",
  "icon_path_linux": "resources/icon.png",
  "icon_path_windows": "resources/icon.ico",
  "output_path": "output",
  "environments": [
    {"arch": "amd64", "os": "linux"}
  ]
}

Any clue of how to debug, this!!
I am trying very hard but all in vain.

Thanks again.

@asticode
Copy link
Owner

this is weird because this is the same error as before... therefore the fix I've pushed for the bundler is not working and I can't explain why it worked bundling the demo...

@HIMANSHURANJAN2015
Copy link
Author

I have even tried clearing my cache for bundler.

But i am unable to understand as to why is it building for i386, when i have mentioned amd64 and linux in my bundler.json.
Is there some temp file which is causing the issue.?

@asticode
Copy link
Owner

you could try to remove all content in your /tmp folder and see whether it's working

@HIMANSHURANJAN2015
Copy link
Author

I tried deleting entire files of /tmp folder.

  • cd /tmp
  • sudo rm -rf *

Still it dint work. Something is weird with my project-config, which i am unable to figure out.
However, go-astilectron-demo is still bundling successfully.

@asticode
Copy link
Owner

could you try rolling back the bundler to the previous version and try again?

  • cd $GOPATH/src/github.com/asticode/go-astilectron-bundler
  • git checkout master
  • make
  • cd $GOPATH/src/github.com/asticode/go-astilectron-demo
  • astilectron-bundler -v

@fazil-amir
Copy link

I'm having the same issue

@JWD42
Copy link

JWD42 commented May 21, 2018

I believe I may be having the same issue.
first time compiling go-astilectron-demo worked great... ran the resulting file under .../output/linux-amd64 just fine.
altered bundler.json by adding:
"environments": [ {"arch": "amd64", "os": "linux"}, {"arch": "386", "os": "windows"} ]

astilectron-bundler -v
failed with:
FATA[0019] bundling failed: bundling for environment linux/amd64 failed: building failed: # github.com/asticode/go-astilectron-demo

removing the Linux entry results in a working Windows executable ... but now removing the entire "environments" key (original bundler.json) so that it attempts to compile as the native linux-amd64 still results in the above error... but as I said it compiled fine at first.
The only suggestions I've tried thus far is toggling CGO_ENABLED and using `astilectron-bundler -v

uname -ro
4.10.0-33-generic GNU/Linux

ld --version
GNU ld (GNU Binutils for Ubuntu) 2.26.1

go version
go version go1.10.2 linux/amd64

@asticode asticode reopened this May 24, 2018
@eelcocramer
Copy link

eelcocramer commented Jan 2, 2019

I'm experiencing the same issue but fixed it adding the following line to bind.go:

// +build ignore

@asticode
Copy link
Owner

asticode commented Jan 2, 2019

@eelcocramer I don't think this is the same issue since as indicated in the doc, you're supposed to delete the bind.go file which will cause issues if you don't.

@eelcocramer
Copy link

You are right. I'm sorry about the confusion.

@mastern2k3
Copy link

mastern2k3 commented Feb 5, 2019

also experiencing the same

DEBU[0000] Creating /home/nitzan/Projects/kafkaf/electron/output 
DEBU[0000] Bundling for environment linux/amd64         
DEBU[0000] Binding data                                 
DEBU[0000] Removing /tmp/astibundler/bind               
DEBU[0000] Creating /tmp/astibundler/bind               
DEBU[0000] Creating /tmp/astibundler/bind/vendor_astilectron_bundler 
DEBU[0000] Creating /tmp/astibundler/cache              
DEBU[0000] /tmp/astibundler/cache/astilectron-0.30.0.zip already exists, skipping download of https://github.com/asticode/astilectron/archive/v0.30.0.zip 
DEBU[0000] Copying /tmp/astibundler/cache/astilectron-0.30.0.zip to /tmp/astibundler/bind/vendor_astilectron_bundler/astilectron.zip 
DEBU[0000] /tmp/astibundler/cache/electron-linux-amd64-4.0.1.zip already exists, skipping download of https://github.com/electron/electron/releases/download/v4.0.1/electron-v4.0.1-linux-x64.zip 
DEBU[0000] Copying /tmp/astibundler/cache/electron-linux-amd64-4.0.1.zip to /tmp/astibundler/bind/vendor_astilectron_bundler/electron.zip 
DEBU[0000] Creating /tmp/astibundler/bind/resources     
DEBU[0000] Copying /home/nitzan/Projects/kafkaf/electron/resources to /tmp/astibundler/bind/resources 
DEBU[0000] Generating /home/nitzan/Projects/kafkaf/electron/bind_linux_amd64.go 
DEBU[0003] Removing /home/nitzan/Projects/kafkaf/electron/output/linux-amd64 
DEBU[0003] Creating /home/nitzan/Projects/kafkaf/electron/output/linux-amd64 
DEBU[0003] Building for os linux and arch amd64         
DEBU[0003] Executing go build -ldflags -X "main.AppName=Astilectron demo" -X "main.BuiltAt=2019-02-05 15:17:48.569057432 +0200 IST m=+3.830103241" -o /home/nitzan/Projects/kafkaf/electron/output/linux-amd64/binary . 
FATA[0012] bundling failed: bundling for environment linux/amd64 failed: building failed: # github.com/mastern2k3/kafkaf/electron
/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-222776290/000000.o' is incompatible with i386:x86-64 output
collect2: error: ld returned 1 exit status

: exit status 2 

tried pulling the latest github.com/asticode/go-astilectron-bundler master, still getting the same.

tried deleting /tmp/astibundler still not working.

1st time i tried it everything worked great. dunno what suddenly changed, will be glad to provide further info.

@mastern2k3
Copy link

BREAKING NEWS:
as said before, using changes in test-link work (commit asticode/go-astilectron-bundler@d15d34e)

kkthx great show nice job 🥇

@asticode
Copy link
Owner

asticode commented Feb 5, 2019

@mastern2k3 since adding ldflags fixes this problem, bare in mind that you can inject your own ldflags in the bundler.json using the ldflags key which should be a map[string][]string.

In this case, adding "ldflags": {"linkmode": ["internal"]} should fix the problem when using the master branch.

Can you confirm?

@sgehrman
Copy link

sgehrman commented Feb 7, 2019

I tried the ldflags thing and it still fails.

@asticode
Copy link
Owner

asticode commented Feb 7, 2019

test-link and the ldflags should do exactly the same thing. Did you fetch the last changes on the bundler master branch and rebuild it ? Can you paste the logs when you run the bundler with the -v flag ?

@sgehrman
Copy link

sgehrman commented Feb 7, 2019

I'll try, I'm kind of new to go.

I did try and do the test-link thing and got this:

bundler.go:20:2: cannot find package "github.com/asticode/go-astitools/zip" in any of:
/usr/local/go/src/github.com/asticode/go-astitools/zip (from $GOROOT)
/home/steve/go/src/github.com/asticode/go-astitools/zip (from $GOPATH)

that package doesn't exist it seems.

@sgehrman
Copy link

sgehrman commented Feb 7, 2019

DEBU[0000] Creating /home/steve/go/src/github.com/asticode/go-astilectron-demo/output
DEBU[0000] Bundling for environment linux/amd64
DEBU[0000] Binding data
DEBU[0000] Removing /tmp/astibundler/bind
DEBU[0000] Creating /tmp/astibundler/bind
DEBU[0000] Creating /tmp/astibundler/bind/vendor_astilectron_bundler
DEBU[0000] Creating /tmp/astibundler/cache
DEBU[0000] /tmp/astibundler/cache/astilectron-0.30.0.zip already exists, skipping download of https://github.com/asticode/astilectron/archive/v0.30.0.zip
DEBU[0000] Copying /tmp/astibundler/cache/astilectron-0.30.0.zip to /tmp/astibundler/bind/vendor_astilectron_bundler/astilectron.zip
DEBU[0000] /tmp/astibundler/cache/electron-linux-amd64-4.0.1.zip already exists, skipping download of https://github.com/electron/electron/releases/download/v4.0.1/electron-v4.0.1-linux-x64.zip
DEBU[0000] Copying /tmp/astibundler/cache/electron-linux-amd64-4.0.1.zip to /tmp/astibundler/bind/vendor_astilectron_bundler/electron.zip
DEBU[0000] Creating /tmp/astibundler/bind/resources
DEBU[0000] Copying /home/steve/go/src/github.com/asticode/go-astilectron-demo/resources to /tmp/astibundler/bind/resources
DEBU[0000] Generating /home/steve/go/src/github.com/asticode/go-astilectron-demo/bind_linux_amd64.go
DEBU[0002] Removing /home/steve/go/src/github.com/asticode/go-astilectron-demo/output/linux-amd64
DEBU[0002] Creating /home/steve/go/src/github.com/asticode/go-astilectron-demo/output/linux-amd64
DEBU[0002] Building for os linux and arch amd64
DEBU[0002] Executing go build -ldflags -X "main.AppName=Astilectron demo" -X "main.BuiltAt=2019-02-07 03:01:02.791702799 -0800 PST m=+2.789778396" -o /home/steve/go/src/github.com/asticode/go-astilectron-demo/output/linux-amd64/binary github.com/asticode/go-astilectron-demo
FATA[0009] 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-834395180/000000.o' is incompatible with i386:x86-64 output
collect2: error: ld returned 1 exit status

: exit status 2

@sgehrman
Copy link

sgehrman commented Feb 7, 2019

bundler.json

{
"app_name": "Astilectron demo",
"icon_path_darwin": "resources/icon.icns",
"icon_path_linux": "resources/icon.png",
"icon_path_windows": "resources/icon.ico",

"ldflags": {
"linkmode": ["internal"]
},

"environments": [{
"arch": "amd64",
"os": "linux"
}]
}

@asticode
Copy link
Owner

asticode commented Feb 7, 2019

@sgehrman your bundler is not up to date. You need to run go get -u github.com/asticode/go-astilectron-bundler and go install github.com/asticode/go-astilectron-bundler/astilectron-bundler.

Can you retry after those 2 steps and paste the logs here ?

@sgehrman
Copy link

sgehrman commented Feb 7, 2019

looks the same:

DEBU[0000] Creating /home/steve/go/src/github.com/asticode/go-astilectron-demo/output
DEBU[0000] Bundling for environment linux/amd64
DEBU[0000] Binding data
DEBU[0000] Removing /tmp/astibundler/bind
DEBU[0000] Creating /tmp/astibundler/bind
DEBU[0000] Creating /tmp/astibundler/bind/vendor_astilectron_bundler
DEBU[0000] Creating /tmp/astibundler/cache
DEBU[0000] /tmp/astibundler/cache/astilectron-0.30.0.zip already exists, skipping download of https://github.com/asticode/astilectron/archive/v0.30.0.zip
DEBU[0000] Copying /tmp/astibundler/cache/astilectron-0.30.0.zip to /tmp/astibundler/bind/vendor_astilectron_bundler/astilectron.zip
DEBU[0000] /tmp/astibundler/cache/electron-linux-amd64-4.0.1.zip already exists, skipping download of https://github.com/electron/electron/releases/download/v4.0.1/electron-v4.0.1-linux-x64.zip
DEBU[0000] Copying /tmp/astibundler/cache/electron-linux-amd64-4.0.1.zip to /tmp/astibundler/bind/vendor_astilectron_bundler/electron.zip
DEBU[0000] Creating /tmp/astibundler/bind/resources
DEBU[0000] Copying /home/steve/go/src/github.com/asticode/go-astilectron-demo/resources to /tmp/astibundler/bind/resources
DEBU[0000] Generating /home/steve/go/src/github.com/asticode/go-astilectron-demo/bind_linux_amd64.go
DEBU[0002] Removing /home/steve/go/src/github.com/asticode/go-astilectron-demo/output/linux-amd64
DEBU[0002] Creating /home/steve/go/src/github.com/asticode/go-astilectron-demo/output/linux-amd64
DEBU[0002] Building for os linux and arch amd64
DEBU[0002] Executing go build -ldflags -X "main.AppName=Astilectron demo" -X "main.BuiltAt=2019-02-07 03:07:37.418139241 -0800 PST m=+2.742565957" -o /home/steve/go/src/github.com/asticode/go-astilectron-demo/output/linux-amd64/binary github.com/asticode/go-astilectron-demo
FATA[0009] 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-244976981/000000.o' is incompatible with i386:x86-64 output
collect2: error: ld returned 1 exit status

: exit status 2

@sgehrman
Copy link

sgehrman commented Feb 7, 2019

I was able to build this, but then tried to add more environments and saw failures, now can't get it building for linux.

@asticode
Copy link
Owner

asticode commented Feb 7, 2019

Mmm indeed there was a bug that I've fixed.

Could you retry updating the bundler, installing it and running it?

@sgehrman
Copy link

sgehrman commented Feb 7, 2019

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.

@sgehrman
Copy link

sgehrman commented Feb 7, 2019

I also tried removing the:

"ldflags": {
"linkmode": ["internal"]
},

But got this:

DEBU[0000] Creating /home/steve/go/src/github.com/asticode/go-astilectron-demo/output
DEBU[0000] Bundling for environment linux/amd64
DEBU[0000] Binding data
DEBU[0000] Removing /tmp/astibundler/bind
DEBU[0000] Creating /tmp/astibundler/bind
DEBU[0000] Creating /tmp/astibundler/bind/vendor_astilectron_bundler
DEBU[0000] Creating /tmp/astibundler/cache
DEBU[0000] /tmp/astibundler/cache/astilectron-0.30.0.zip already exists, skipping download of https://github.com/asticode/astilectron/archive/v0.30.0.zip
DEBU[0000] Copying /tmp/astibundler/cache/astilectron-0.30.0.zip to /tmp/astibundler/bind/vendor_astilectron_bundler/astilectron.zip
DEBU[0000] /tmp/astibundler/cache/electron-linux-amd64-4.0.1.zip already exists, skipping download of https://github.com/electron/electron/releases/download/v4.0.1/electron-v4.0.1-linux-x64.zip
DEBU[0000] Copying /tmp/astibundler/cache/electron-linux-amd64-4.0.1.zip to /tmp/astibundler/bind/vendor_astilectron_bundler/electron.zip
DEBU[0000] Creating /tmp/astibundler/bind/resources
DEBU[0000] Copying /home/steve/go/src/github.com/asticode/go-astilectron-demo/resources to /tmp/astibundler/bind/resources
DEBU[0000] Generating /home/steve/go/src/github.com/asticode/go-astilectron-demo/bind_linux_amd64.go
DEBU[0002] Removing /home/steve/go/src/github.com/asticode/go-astilectron-demo/output/linux-amd64
DEBU[0002] Creating /home/steve/go/src/github.com/asticode/go-astilectron-demo/output/linux-amd64
panic: assignment to entry in nil map

goroutine 1 [running]:
github.com/asticode/go-astilectron-bundler.LDFlags.Merge(0x0, 0xc00028ba80)
/home/steve/go/src/github.com/asticode/go-astilectron-bundler/ldflags.go:36 +0x12a
github.com/asticode/go-astilectron-bundler.(*Bundler).bundle(0xc0000a6a80, 0xc0000c6ad0, 0x5, 0x0, 0xc0000c6ad5, 0x5, 0xba5920, 0x8d9910)
/home/steve/go/src/github.com/asticode/go-astilectron-bundler/bundler.go:361 +0x450
github.com/asticode/go-astilectron-bundler.(*Bundler).Bundle(0xc0000a6a80, 0xc0000a6a80, 0x0)
/home/steve/go/src/github.com/asticode/go-astilectron-bundler/bundler.go:320 +0x2bb
main.main()
/home/steve/go/src/github.com/asticode/go-astilectron-bundler/astilectron-bundler/main.go:117 +0x693

Is that ldflags still needed?

Thanks.

@asticode
Copy link
Owner

asticode commented Feb 8, 2019

Mmm the last panic is my fault, could you retry with the master branch?

@sgehrman
Copy link

sgehrman commented Feb 8, 2019

I did this:

steve@tr4:/go/src/github.com/asticode$ go get -u github.com/asticode/go-astilectron-bundler
steve@tr4:
/go/src/github.com/asticode$ go install github.com/asticode/go-astilectron-bundler/astilectron-bundler

and tried building again and got:

DEBU[0000] Creating /home/steve/go/src/github.com/asticode/go-astilectron-demo/output
DEBU[0000] Bundling for environment windows/amd64
DEBU[0000] Binding data
DEBU[0000] Removing /tmp/astibundler/bind
DEBU[0000] Creating /tmp/astibundler/bind
DEBU[0000] Creating /tmp/astibundler/bind/vendor_astilectron_bundler
DEBU[0000] Creating /tmp/astibundler/cache
DEBU[0000] /tmp/astibundler/cache/astilectron-0.30.0.zip already exists, skipping download of https://github.com/asticode/astilectron/archive/v0.30.0.zip
DEBU[0000] Copying /tmp/astibundler/cache/astilectron-0.30.0.zip to /tmp/astibundler/bind/vendor_astilectron_bundler/astilectron.zip
DEBU[0000] /tmp/astibundler/cache/electron-windows-amd64-4.0.1.zip already exists, skipping download of https://github.com/electron/electron/releases/download/v4.0.1/electron-v4.0.1-win32-x64.zip
DEBU[0000] Copying /tmp/astibundler/cache/electron-windows-amd64-4.0.1.zip to /tmp/astibundler/bind/vendor_astilectron_bundler/electron.zip
DEBU[0000] Creating /tmp/astibundler/bind/resources
DEBU[0000] Copying /home/steve/go/src/github.com/asticode/go-astilectron-demo/resources to /tmp/astibundler/bind/resources
DEBU[0000] Generating /home/steve/go/src/github.com/asticode/go-astilectron-demo/bind_windows_amd64.go
DEBU[0002] Running rsrc for icon /home/steve/go/src/github.com/asticode/go-astilectron-demo/resources/icon.ico into /home/steve/go/src/github.com/asticode/go-astilectron-demo/windows.syso
DEBU[0002] Removing /home/steve/go/src/github.com/asticode/go-astilectron-demo/output/windows-amd64
DEBU[0002] Creating /home/steve/go/src/github.com/asticode/go-astilectron-demo/output/windows-amd64
DEBU[0002] Building for os windows and arch amd64
DEBU[0002] Executing go build -ldflags -H windowsgui -X "main.AppName=Astilectron demo" -X "main.BuiltAt=2019-02-08 04:54:08.26498362 -0800 PST m=+2.307216235" -linkmode internal -o /home/steve/go/src/github.com/asticode/go-astilectron-demo/output/windows-amd64/binary github.com/asticode/go-astilectron-demo
DEBU[0010] Moving /home/steve/go/src/github.com/asticode/go-astilectron-demo/output/windows-amd64/binary to /home/steve/go/src/github.com/asticode/go-astilectron-demo/output/windows-amd64/Astilectron demo.exe
DEBU[0010] Bundling for environment linux/amd64
DEBU[0010] Binding data
DEBU[0010] Removing /tmp/astibundler/bind
DEBU[0010] Creating /tmp/astibundler/bind
DEBU[0010] Creating /tmp/astibundler/bind/vendor_astilectron_bundler
DEBU[0010] Creating /tmp/astibundler/cache
DEBU[0010] /tmp/astibundler/cache/astilectron-0.30.0.zip already exists, skipping download of https://github.com/asticode/astilectron/archive/v0.30.0.zip
DEBU[0010] Copying /tmp/astibundler/cache/astilectron-0.30.0.zip to /tmp/astibundler/bind/vendor_astilectron_bundler/astilectron.zip
DEBU[0010] /tmp/astibundler/cache/electron-linux-amd64-4.0.1.zip already exists, skipping download of https://github.com/electron/electron/releases/download/v4.0.1/electron-v4.0.1-linux-x64.zip
DEBU[0010] Copying /tmp/astibundler/cache/electron-linux-amd64-4.0.1.zip to /tmp/astibundler/bind/vendor_astilectron_bundler/electron.zip
DEBU[0010] Creating /tmp/astibundler/bind/resources
DEBU[0010] Copying /home/steve/go/src/github.com/asticode/go-astilectron-demo/resources to /tmp/astibundler/bind/resources
DEBU[0011] Generating /home/steve/go/src/github.com/asticode/go-astilectron-demo/bind_linux_amd64.go
DEBU[0013] Removing /home/steve/go/src/github.com/asticode/go-astilectron-demo/output/linux-amd64
DEBU[0013] Creating /home/steve/go/src/github.com/asticode/go-astilectron-demo/output/linux-amd64
DEBU[0013] Building for os linux and arch amd64
DEBU[0013] Executing go build -ldflags -H windowsgui -X "main.AppName=Astilectron demo" -X "main.BuiltAt=2019-02-08 04:54:08.26498362 -0800 PST m=+2.307216235" -X "main.AppName=Astilectron demo" -X "main.BuiltAt=2019-02-08 04:54:19.680520701 -0800 PST m=+13.722753296" -linkmode internal -o /home/steve/go/src/github.com/asticode/go-astilectron-demo/output/linux-amd64/binary github.com/asticode/go-astilectron-demo
FATA[0020] bundling failed: bundling for environment linux/amd64 failed: building failed: # github.com/asticode/go-astilectron-demo
adddynlib: unsupported binary format
adddynlib: unsupported binary format
: exit status 2

"environments": [{
"arch": "amd64",
"os": "windows"
}, {
"arch": "amd64",
"os": "linux"
}, {
"arch": "amd64",
"os": "darwin"
}]

@sgehrman
Copy link

sgehrman commented Feb 8, 2019

If I use just this:

"environments": [{
"arch": "amd64",
"os": "linux"
}]

It builds fine.

@nnashwin
Copy link

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.

Hey, I noticed that this happens for me as well.
If in the bundler.json I have a windows environment build before the darwin build, the build fails.
But if I move the darwin build before the windows environment, it builds fine.

// bundler.json
{
"app_name": "Astilectron demo",
"icon_path_darwin": "resources/icon.icns",
"icon_path_linux": "resources/icon.png",
"icon_path_windows": "resources/icon.ico",
"ldflags": {
"linkmode": ["internal"]
},
"environments": [
{"arch": "386", "os": "windows"},
{"arch": "amd64", "os": "darwin"}
]
}

// error stack trace
DEBU[0000] Creating /Users/tboright/Developer/goWorkspace/src/github.com/asticode/go-astilectron-demo/output app_name=
DEBU[0000] Bundling for environment windows/386 app_name=
DEBU[0000] Binding data app_name=
DEBU[0000] Removing /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/bind app_name=
DEBU[0000] Creating /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/bind app_name=
DEBU[0000] Creating /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/bind/vendor_astilectron_bundler app_name=
DEBU[0000] Creating /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/cache app_name=
DEBU[0000] /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/cache/astilectron-0.30.0.zip already exists, skipping download of https://github.com/asticode/astilectron/archive/v0.30.0.zip app_name=
DEBU[0000] Copying /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/cache/astilectron-0.30.0.zip to /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/bind/vendor_astilectron_bundler/astilectron.zip app_name=
DEBU[0000] /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/cache/electron-windows-386-4.0.1.zip already exists, skipping download of https://github.com/electron/electron/releases/download/v4.0.1/electron-v4.0.1-win32-ia32.zip app_name=
DEBU[0000] Copying /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/cache/electron-windows-386-4.0.1.zip to /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/bind/vendor_astilectron_bundler/electron.zip app_name=
DEBU[0000] Creating /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/bind/resources app_name=
DEBU[0000] Copying /Users/tboright/Developer/goWorkspace/src/github.com/asticode/go-astilectron-demo/resources to /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/bind/resources app_name=
DEBU[0000] Generating /Users/tboright/Developer/goWorkspace/src/github.com/asticode/go-astilectron-demo/bind_windows_386.go app_name=
DEBU[0002] Running rsrc for icon /Users/tboright/Developer/goWorkspace/src/github.com/asticode/go-astilectron-demo/resources/icon.ico into /Users/tboright/Developer/goWorkspace/src/github.com/asticode/go-astilectron-demo/windows.syso app_name=
DEBU[0002] Removing /Users/tboright/Developer/goWorkspace/src/github.com/asticode/go-astilectron-demo/output/windows-386 app_name=
DEBU[0002] Creating /Users/tboright/Developer/goWorkspace/src/github.com/asticode/go-astilectron-demo/output/windows-386 app_name=
DEBU[0002] Building for os windows and arch 386 app_name=
DEBU[0002] Executing go build -ldflags -H windowsgui -X "main.AppName=Astilectron demo" -X "main.BuiltAt=2019-03-12 13:40:27.781908 -0700 PDT m=+2.747375859" -linkmode internal -o /Users/tboright/Developer/goWorkspace/src/github.com/asticode/go-astilectron-demo/output/windows-386/binary github.com/asticode/go-astilectron-demo app_name=
DEBU[0014] Moving /Users/tboright/Developer/goWorkspace/src/github.com/asticode/go-astilectron-demo/output/windows-386/binary to /Users/tboright/Developer/goWorkspace/src/github.com/asticode/go-astilectron-demo/output/windows-386/Astilectron demo.exe app_name=
DEBU[0014] Bundling for environment darwin/amd64 app_name=
DEBU[0014] Binding data app_name=
DEBU[0014] Removing /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/bind app_name=
DEBU[0014] Creating /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/bind app_name=
DEBU[0014] Creating /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/bind/vendor_astilectron_bundler app_name=
DEBU[0014] Creating /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/cache app_name=
DEBU[0014] /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/cache/astilectron-0.30.0.zip already exists, skipping download of https://github.com/asticode/astilectron/archive/v0.30.0.zip app_name=
DEBU[0014] Copying /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/cache/astilectron-0.30.0.zip to /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/bind/vendor_astilectron_bundler/astilectron.zip app_name=
DEBU[0014] /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/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 app_name=
DEBU[0014] Copying /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/cache/electron-darwin-amd64-4.0.1.zip to /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/bind/vendor_astilectron_bundler/electron.zip app_name=
DEBU[0014] Creating /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/bind/resources app_name=
DEBU[0014] Copying /Users/tboright/Developer/goWorkspace/src/github.com/asticode/go-astilectron-demo/resources to /var/folders/05/g12ljm8n10x6nwkvkxxkvdk00nw4_f/T/astibundler/bind/resources app_name=
DEBU[0014] Generating /Users/tboright/Developer/goWorkspace/src/github.com/asticode/go-astilectron-demo/bind_darwin_amd64.go app_name=
DEBU[0017] Removing /Users/tboright/Developer/goWorkspace/src/github.com/asticode/go-astilectron-demo/output/darwin-amd64 app_name=
DEBU[0017] Creating /Users/tboright/Developer/goWorkspace/src/github.com/asticode/go-astilectron-demo/output/darwin-amd64 app_name=
DEBU[0017] Building for os darwin and arch amd64 app_name=
DEBU[0017] Executing go build -ldflags -H windowsgui -X "main.AppName=Astilectron demo" -X "main.BuiltAt=2019-03-12 13:40:27.781908 -0700 PDT m=+2.747375859" -X "main.AppName=Astilectron demo" -X "main.BuiltAt=2019-03-12 13:40:42.522744 -0700 PDT m=+17.488823195" -linkmode internal -o /Users/tboright/Developer/goWorkspace/src/github.com/asticode/go-astilectron-demo/output/darwin-amd64/binary github.com/asticode/go-astilectron-demo app_name=
FATA[0024] bundling failed: bundling for environment darwin/amd64 failed: building failed: # github.com/asticode/go-astilectron-demo
adddynlib: unsupported binary format
adddynlib: unsupported binary format
adddynlib: unsupported binary format
: exit status 2 app_name=

@asticode
Copy link
Owner

@ru-lai Are you using CGO in your project by any chance?

@Hoolagrin
Copy link

I've got trouble bundling it with just windows.
DEBU[0000] Creating C:\Users\SeanSkally\go\src\github.com\asticode\go-astilectron-demo\output app_name=
DEBU[0000] Bundling for environment windows/amd64 app_name=
DEBU[0000] Binding data app_name=
DEBU[0000] Removing C:\Users\SeanSkally\AppData\Local\Temp\astibundler\bind app_name=
DEBU[0000] Creating C:\Users\SeanSkally\AppData\Local\Temp\astibundler\bind app_name=
DEBU[0000] Creating C:\Users\SeanSkally\AppData\Local\Temp\astibundler\bind\vendor_astilectron_bundler app_name=
DEBU[0000] Creating C:\Users\SeanSkally\AppData\Local\Temp\astibundler\cache app_name=
DEBU[0000] C:\Users\SeanSkally\AppData\Local\Temp\astibundler\cache\astilectron-0.30.0.zip already exists, skipping download of https://github.com/asticode/astilectron/archive/v0.30.0.zip app_name=
DEBU[0000] Copying C:\Users\SeanSkally\AppData\Local\Temp\astibundler\cache\astilectron-0.30.0.zip to C:\Users\SeanSkally\AppData\Local\Temp\astibundler\bind\vendor_astilectron_bundler\astilectron.zip app_name=
DEBU[0000] C:\Users\SeanSkally\AppData\Local\Temp\astibundler\cache\electron-windows-amd64-4.0.1.zip already exists, skipping download of https://github.com/electron/electron/releases/download/v4.0.1/electron-v4.0.1-win32-x64.zip app_name=
DEBU[0000] Copying C:\Users\SeanSkally\AppData\Local\Temp\astibundler\cache\electron-windows-amd64-4.0.1.zip to C:\Users\SeanSkally\AppData\Local\Temp\astibundler\bind\vendor_astilectron_bundler\electron.zip app_name=
DEBU[0000] Creating C:\Users\SeanSkally\AppData\Local\Temp\astibundler\bind\resources app_name=
DEBU[0000] Copying C:\Users\SeanSkally\go\src\github.com\asticode\go-astilectron-demo\resources to C:\Users\SeanSkally\AppData\Local\Temp\astibundler\bind\resources app_name=
DEBU[0000] Generating C:\Users\SeanSkally\go\src\github.com\asticode\go-astilectron-demo\bind_windows_amd64.go app_name=
DEBU[0002] Running rsrc for icon C:\Users\SeanSkally\go\src\github.com\asticode\go-astilectron-demo\resources\icon.ico into C:\Users\SeanSkally\go\src\github.com\asticode\go-astilectron-demo\windows.syso app_name=
DEBU[0002] Removing C:\Users\SeanSkally\go\src\github.com\asticode\go-astilectron-demo\output\windows-amd64 app_name=
DEBU[0002] Creating C:\Users\SeanSkally\go\src\github.com\asticode\go-astilectron-demo\output\windows-amd64 app_name=
DEBU[0002] Building for os windows and arch amd64 app_name=
DEBU[0002] Executing go build -ldflags -H windowsgui -X "main.AppName=Astilectron demo" -X "main.BuiltAt=2019-03-19 07:31:57.6260187 -0400 EDT m=+2.931979901" -o C:\Users\SeanSkally\go\src\github.com\asticode\go-astilectron-demo\output\windows-amd64\binary github.com\asticode\go-astilectron-demo app_name=
FATA[0003] bundling failed: bundling for environment windows/amd64 failed: building failed: ..\go-astilectron-bundler\bundler.go:20:2: cannot find package "github.com/asticode/go-astitools/zip" in any of:
C:\Go\src\github.com\asticode\go-astitools\zip (from $GOROOT)
C:\Users\SeanSkally\go\src\github.com\asticode\go-astitools\zip (from $GOPATH)
: exit status 1 app_name=

//bundler.json
{
"app_name": "Astilectron demo",
"icon_path_windows": "resources/icon.ico",
"ldflags": {
"linkmode": ["internal"]
},
"environments": [{
"arch": "386",
"os": "windows"
}]
}

@asticode
Copy link
Owner

Did you run go get -u github.com/asticode/go-astilectron-demo/... as the doc mentions?

@asticode
Copy link
Owner

asticode commented Apr 1, 2019

@sgehrman @ru-lai I think I have good news, thanks to @vahid-sorabloo the issue should be fixed in the bundler.

You just need to pull the bundler changes and re-install it before trying.

Can you let me know whether this is working now?

@Teque5
Copy link

Teque5 commented Jul 8, 2019

I just followed your instructions to the letter with go 1.12.6 and got this same error with the following output:

fleeb@flip:~/go/src/github.com/asticode/go-astilectron-demo$ astilectron-bundler -v
DEBU[0000] Creating /home/fleeb/go/src/github.com/asticode/go-astilectron-demo/output  app_name= source="bundler.go:316"
DEBU[0000] Bundling for environment linux/amd64          app_name= source="bundler.go:324"
DEBU[0000] Binding data                                  app_name= source="bundler.go:336"
DEBU[0000] Removing /tmp/astibundler/bind                app_name= source="bundler.go:415"
DEBU[0000] Creating /tmp/astibundler/bind                app_name= source="bundler.go:422"
DEBU[0000] Creating /tmp/astibundler/bind/vendor_astilectron_bundler  app_name= source="bundler.go:467"
DEBU[0000] Creating /tmp/astibundler/cache               app_name= source="bundler.go:474"
DEBU[0000] /tmp/astibundler/cache/astilectron-0.32.0.zip already exists, skipping download of https://github.com/asticode/astilectron/archive/v0.32.0.zip  app_name= source="bundler.go:503"
DEBU[0000] Copying /tmp/astibundler/cache/astilectron-0.32.0.zip to /tmp/astibundler/bind/vendor_astilectron_bundler/astilectron.zip  app_name= source="bundler.go:512"
DEBU[0000] /tmp/astibundler/cache/electron-linux-amd64-4.0.1.zip already exists, skipping download of https://github.com/electron/electron/releases/download/v4.0.1/electron-v4.0.1-linux-x64.zip  app_name= source="bundler.go:503"
DEBU[0000] Copying /tmp/astibundler/cache/electron-linux-amd64-4.0.1.zip to /tmp/astibundler/bind/vendor_astilectron_bundler/electron.zip  app_name= source="bundler.go:512"
DEBU[0000] Creating /tmp/astibundler/bind/resources      app_name= source="bundler.go:552"
DEBU[0000] Copying /home/fleeb/go/src/github.com/asticode/go-astilectron-demo/resources to /tmp/astibundler/bind/resources  app_name= source="bundler.go:560"
DEBU[0000] Generating /home/fleeb/go/src/github.com/asticode/go-astilectron-demo/bind_linux_amd64.go  app_name= source="bundler.go:459"
DEBU[0002] Removing /home/fleeb/go/src/github.com/asticode/go-astilectron-demo/output/linux-amd64  app_name= source="bundler.go:415"
DEBU[0002] Creating /home/fleeb/go/src/github.com/asticode/go-astilectron-demo/output/linux-amd64  app_name= source="bundler.go:422"
DEBU[0002] Building for os linux and arch amd64          app_name= source="bundler.go:375"
DEBU[0002] Executing go build -ldflags -X "main.AppName=Astilectron demo" -X "main.BuiltAt=2019-07-07 17:11:18.381824419 -0700 PDT m=+2.931859936" -o /home/fleeb/go/src/github.com/asticode/go-astilectron-demo/output/linux-amd64/binary github.com/asticode/go-astilectron-demo  app_name= source="bundler.go:393"
FATA[0009] 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-275377070/000000.o' is incompatible with i386:x86-64 output
collect2: error: ld returned 1 exit status

: exit status 2  app_name= source="main.go:121"

Ubuntu 18.04.2

@Teque5
Copy link

Teque5 commented Jul 8, 2019

Ok I got everything to work by doing go get github.com/mattn/go-colorable and changing bundler.json:

{
  "app_name": "Astilectron demo",
  "icon_path_darwin": "resources/icon.icns",
  "icon_path_linux": "resources/icon.png",
  "icon_path_windows": "resources/icon.ico",
  "ldflags":{"linkmode":["internal"]},
  "environments": [
    {"arch": "amd64", "os": "linux"},
    {"arch": "amd64", "os": "windows"}
  ]
}

Adding the ldflags seemed to be the root cause for not building on linux/arm64.

@asticode asticode closed this as completed Oct 5, 2019
@ajeecai
Copy link

ajeecai commented Nov 23, 2019

I met the same problem, and @Teque5 helps me with "ldflags":{"linkmode":["internal"]},
So could this formally put on the README instructions @asticode ?

Thanks

@asticode
Copy link
Owner

That's a good idea, just updated the bundler README

@scorredoira
Copy link

I had an error because I linked sqlite3 (github.com/mattn/go-sqlite3) and the solution was to set linkmode as external (mattn/go-sqlite3#414 (comment))

    "ldflags": {
        "linkmode": [
            "external"
        ]
    },

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests