-
Notifications
You must be signed in to change notification settings - Fork 754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getting "go build -buildmode=plugin" to work #587
Comments
Hey Seems like you just need to set some of the |
Thanks for the lead...but still not working :-( |
How does the errors look like? |
here's an excerpt:
|
Mh, those are just warnings. Is this maybe the same issue as in your first post?
If yes, then you probably only need to create a dummy "func main(){}" |
Well, that's the trick with Go plugins...they are like binaries but they don't sport a "main" function. When I add a dummy main(), |
Could you copy paste that code and get a .so from it? package main
import (
"os"
"github.com/therecipe/qt/core"
"github.com/therecipe/qt/gui"
"github.com/therecipe/qt/qml"
"github.com/therecipe/qt/quickcontrols2"
)
func Init() {
// Create application
app := gui.NewQGuiApplication(len(os.Args), os.Args)
// Enable high DPI scaling
app.SetAttribute(core.Qt__AA_EnableHighDpiScaling, true)
// Use the material style for qml
quickcontrols2.QQuickStyle_SetStyle("Fusion")
// Create a QML application engine
engine := qml.NewQQmlApplicationEngine(nil)
// Load the main qml file
engine.Load(core.NewQUrl3("qrc:/qml/main.qml", 0))
// Execute app
gui.QGuiApplication_Exec()
} |
Mh, no it compiles for a while.
I'm also on macOS btw. Could it be that the buildmode plugin somehow uses the "//export" comment to export Go functions or something? (So that they can be used by a program consuming the plugin?) |
Hmm...something interesting happened as I commented out each line, one by one. # qtexample
/usr/local/go/pkg/tool/linux_amd64/link: running g++ failed: exit status 1
/usr/bin/ld: $WORK/b001/exe/a.out.so: version node not found for symbol ��<��/y"!��g�&�,ɓe͊�\@~�*W��2 �� ���i�Xs��tR@�����;Q.D|u#��tqh@��
ըS�2 ��
飿�
ըS�2 ��l�"�N�&�l�ngľ"�
�>c���0!��r��<�7�{�
���J_���"����1��p��er�k�! ��� ����Ug|� �u��y(��&�:��=T9&���
�Lmi*��9��
ըS�2 ��������.8��6Cl�"�N�&�l�ngĉ
[...]
ըS�2 ��l�"�N�&�l�ng�
/usr/bin/ld: failed to set dynamic section sizes: Bad value
collect2: error: ld returned 1 exit status No idea how to decypher what symbol stdout is talking about, but I assume it's one in the qml package. I don't understand the links between C and Go, but adding "//export" comment did not change the output. Plugins are only supposed to work on Linux and Darwin at the moment, so it's fine. |
Mh, I get a similar issue like in #587 (comment) when compiling: package main
import "C"
//export abc
func abc() {} with
So, I'm not quite sure. I guess the plugin support is still not really useful. However, you should be able to use Or maybe "buildmode=shared" but I haven't tested that. |
Nevermind, I'll return to RPC, gRPC seems to be the way to go. But thanks for looking into it. |
Hello, I'd like to create a modular GUI desktop app using Go
go build -buildmode=plugin
feature.I simply used the first qtexample after install, and renamed the main function "Init()" as well as main.go file into qtexample.go, but I can't get it to build:
I have no idea how cgo/qtdeploy/make work. Here is the output when I use qtdeploy:
Any help getting Qt in a Go plugin would be much appreciated.
By the way, I'm on Mint 17.3, using Go 1.10 and Qt 5.10.1
Cheers.
The text was updated successfully, but these errors were encountered: