Hi
I’m usng OSX El Capitan.
I’m trying to statically compile my binary with the necessary libaries along with the static compilation of QT for my UI.
Using otool -L
I see that the dynamically linked libraries are as such:
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
/usr/local/opt/qt5/lib/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.6.0, current version 5.6.1)
/usr/local/opt/qt5/lib/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.6.0, current version 5.6.1)
/usr/local/opt/qt5/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.6.0, current version 5.6.1)
/usr/local/opt/qt5/lib/QtQml.framework/Versions/5/QtQml (compatibility version 5.6.0, current version 5.6.1)
/usr/local/opt/qt5/lib/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.6.0, current version 5.6.1)
/usr/local/opt/qt5/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.6.0, current version 5.6.1)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1258.1.0)
/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 57337.60.2)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
I have also statically compiled QT which is at /Users/alex/Qt/5.7.0_static_osx/lib
.
I think I am supposed to run: go build -a -installsuffix cgo
to statically compile, with:
// #cgo LDFLAGS: -static -L/Users/alex/Qt/5.7.0_static_osx/lib -lgb
at the top of my main.go
file. This builds however
The golang qml libraries don’t work with cgo
enabled so I have to turn it off because of the error:
panic: runtime error: cgo argument has Go pointer to Go pointer
and running otool
again I can see that it doesn’t look like any of them are now dynamically linked
However if I turn it off I get
packages/qml/interface.go:13: undefined: qml.Object
packages/qml/interface.go:15: undefined: qml.Window
Am I stuck between a rock and a hard place?