asticode / go-astilectron-bundler

Bundle your Astilectron app with ease
MIT License
129 stars 68 forks source link

Error Bundling #93

Open ramacatur opened 3 years ago

ramacatur commented 3 years ago

Hey, I use library github.com/hajimehoshi/oto in my darwin-amd64 environment.

When I run astilectron-bundler, I got error :

2021/06/22 13:23:28 bundling failed: bundling for environment darwin/amd64 failed: building failed: # bulkwa
github.com/hajimehoshi/oto(__DATA/__objc_data): unexpected reloc for dynamic symbol OBJC_METACLASS_$_NSObject
github.com/hajimehoshi/oto(__DATA/__objc_data): unexpected reloc for dynamic symbol OBJC_METACLASS_$_NSObject
github.com/hajimehoshi/oto(__DATA/__objc_data): unexpected reloc for dynamic symbol _objc_empty_cache
github.com/hajimehoshi/oto(__DATA/__objc_data): unexpected reloc for dynamic symbol OBJC_CLASS_$_NSObject
github.com/hajimehoshi/oto(__DATA/__objc_data): unexpected reloc for dynamic symbol _objc_empty_cache
github.com/hajimehoshi/oto(__DATA/__objc_classrefs): unexpected reloc for dynamic symbol OBJC_CLASS_$_NSWorkspace

Can you help me?

Thanks

asticode commented 3 years ago

Are you running the bundler on MacOSX as well ?

ramacatur commented 3 years ago

Are you running the bundler on MacOSX as well ?

When I run astilectron-bundler without oto library, it is running as well. But when use oto library, I got the error.

asticode commented 3 years ago

Can you paste the output when you run go env?

ramacatur commented 3 years ago

Can you paste the output when you run go env?

GO111MODULE="auto"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ramacatur/Library/Caches/go-build"
GOENV="/Users/ramacatur/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Volumes/Data/code/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Volumes/Data/code/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.4"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/4n/dt47c6rn3654505gxvvrmjc80000gn/T/go-build3898342957=/tmp/go-build -gno-record-gcc-switches -fno-common"
ramacatur commented 3 years ago

I use this lib https://github.com/faiface/beep for run mp3 in background.

asticode commented 3 years ago

Can you show me your bundler.json?

ramacatur commented 3 years ago
{
  "app_name": "Message APP",
  "icon_path_darwin": "resources/icon.icns",
  "icon_path_linux": "resources/icon.png",
  "icon_path_windows": "resources/icon.ico",
  "ldflags":{"linkmode":["internal"]},
  "info_plist": {
    "CFBundlePackageType": "APPL",
    "CFBundleInfoDictionaryVersion": "6.0",
    "CFBundleIconFile": "icon.icns",
    "CFBundleDisplayName": "Message APP",
    "CFBundleExecutable": "Message APP ",
    "CFBundleIdentifier": "com.ristekmuslim.MessageAPP",
    "LSUIElement": "NO",
    "LSMinimumSystemVersion": "10.12",
    "NSHighResolutionCapable": true,
    "NSAppTransportSecurity": {
      "NSAllowsArbitraryLoads": true
    }
  },
  "environments": [
    {"arch": "amd64", "os": "darwin"},
    {"arch": "amd64", "os": "linux"},
    {
      "arch": "amd64",
      "os": "windows",
      "env": {
        "CC": "x86_64-w64-mingw32-gcc",
        "CXX": "x86_64-w64-mingw32-g++",
        "CGO_ENABLED": "1"
      }
    },
    {
      "arch": "386",
      "os": "windows"
    }
  ]
}

On linux bundling has error too like this

2021/06/22 13:32:34 Bundling for environment linux/amd64
2021/06/22 13:32:34 Binding data
2021/06/22 13:32:34 Removing /var/folders/4n/dt47c6rn3654505gxvvrmjc80000gn/T/astibundler/bind
2021/06/22 13:32:34 Creating /var/folders/4n/dt47c6rn3654505gxvvrmjc80000gn/T/astibundler/bind
2021/06/22 13:32:34 Creating /var/folders/4n/dt47c6rn3654505gxvvrmjc80000gn/T/astibundler/bind/vendor_astilectron_bundler
2021/06/22 13:32:34 Creating /var/folders/4n/dt47c6rn3654505gxvvrmjc80000gn/T/astibundler/cache
2021/06/22 13:32:34 /var/folders/4n/dt47c6rn3654505gxvvrmjc80000gn/T/astibundler/cache/astilectron-0.41.0.zip already exists, skipping download of https://github.com/asticode/astilectron/archive/v0.41.0.zip
2021/06/22 13:32:34 Copying /var/folders/4n/dt47c6rn3654505gxvvrmjc80000gn/T/astibundler/cache/astilectron-0.41.0.zip to /var/folders/4n/dt47c6rn3654505gxvvrmjc80000gn/T/astibundler/bind/vendor_astilectron_bundler/astilectron.zip
2021/06/22 13:32:34 /var/folders/4n/dt47c6rn3654505gxvvrmjc80000gn/T/astibundler/cache/electron-linux-amd64-7.1.10.zip already exists, skipping download of https://github.com/electron/electron/releases/download/v7.1.10/electron-v7.1.10-linux-x64.zip
2021/06/22 13:32:34 Copying /var/folders/4n/dt47c6rn3654505gxvvrmjc80000gn/T/astibundler/cache/electron-linux-amd64-7.1.10.zip to /var/folders/4n/dt47c6rn3654505gxvvrmjc80000gn/T/astibundler/bind/vendor_astilectron_bundler/electron.zip
2021/06/22 13:32:35 Creating /var/folders/4n/dt47c6rn3654505gxvvrmjc80000gn/T/astibundler/bind/resources
2021/06/22 13:32:35 Copying /Volumes/Data/code/go/src/bulkwa/resources to /var/folders/4n/dt47c6rn3654505gxvvrmjc80000gn/T/astibundler/bind/resources
2021/06/22 13:32:38 Generating /Volumes/Data/code/go/src/bulkwa/bind_linux_amd64.go
2021/06/22 13:32:44 Removing /Volumes/Data/code/go/src/bulkwa/output/linux-amd64
2021/06/22 13:32:44 Creating /Volumes/Data/code/go/src/bulkwa/output/linux-amd64
2021/06/22 13:32:44 Building for os linux and arch amd64 astilectron: 0.41.0 electron: 7.1.10
2021/06/22 13:32:44 Executing go build -ldflags -X "main.AppName=Bulk WhatsApp" -X "main.BuiltAt=2021-06-22 13:32:44.443186 +0700 WIB m=+10.228374128" -X "main.VersionAstilectron=0.41.0" -X "main.VersionElectron=7.1.10" -linkmode "internal" -o /Volumes/Data/code/go/src/bulkwa/output/linux-amd64/binary bulkwa
2021/06/22 13:32:49 bundling failed: bundling for environment linux/amd64 failed: building failed: # github.com/hajimehoshi/oto
../github.com/hajimehoshi/oto/context.go:69:12: undefined: newDriver
asticode commented 3 years ago

1) For darwin, the error are explained by the presence of "ldflags":{"linkmode":["internal"]}. Indeed, if you want to link with external libs like oto, you need to keep this value to default which is external

2) For linux, it seems like it's a golang error in the oto lib. Maybe a version mismatch

ramacatur commented 3 years ago
  1. For darwin, the error are explained by the presence of "ldflags":{"linkmode":["internal"]}. Indeed, if you want to link with external libs like oto, you need to keep this value to default which is external
  2. For linux, it seems like it's a golang error in the oto lib. Maybe a version mismatch

thank you for the reply. I will try it.

ramacatur commented 3 years ago
  1. For darwin, the error are explained by the presence of "ldflags":{"linkmode":["internal"]}. Indeed, if you want to link with external libs like oto, you need to keep this value to default which is external
  2. For linux, it seems like it's a golang error in the oto lib. Maybe a version mismatch
  1. for darwin it worked
  2. for linux, I'm still looking for a solution

Thanks