I am trying to statically compile a go application using Qt and run it on a computer without Go or Qt installed.
At the top of my main.go I have:
// #cgo LDFLAGS: -static -L/Users/$USER/Qt/5.7.0_static_osx/lib -lgb
//go:generate genqrc ui
I have static compiled my application using:
go generate && go build -a -installsuffix cgo
The go generate
compiles the .qml files into the binary while as I understand it go build -a -installsuffix cgo
statically compiles all the .go
and .a
files from Qt.
I am using go version go1.8 darwin/amd64
and I have 5.7.0_static_osx
Qt in my /Users/$USER/Qt
folder and in the /lib
folder I have all the .a
files
I am using OSX 10.11.6 (El Capitan)
Now the issue is when I move it to another mac I get the error:
/Users/$USER/Downloads/PACKAGED.app/Contents/Resources
AppSettings.plist
MainMenu.nib
appIcon.icns
PACKAGEDAPP
script
dyld: Library not loaded: /usr/local/opt/qt5/lib/QtWidgets.framework/Versions/5/QtWidgets
Referenced from: /Users/$USER/Downloads/PACKAGED.app/Contents/Resources/./encryptoclient
Reason: Incompatible library version: encryptoclient requires version 5.7.0 or later, but QtWidgets provides version 5.4.0
/Users/$USER/Downloads/PACKAGED.app/Contents/Resources/script: line 5: 9987 Trace/BPT trap: 5 ./encryptoclient
Which makes me think that Qt wasn't statically compiled, is this so? And if so, what do I need to do to compile properly?
P.S (FYI) Its in a .app
because I have wrapped it in a Platypus app to make moving and running on other computer an easy 'double-click' off the USB stick