therecipe / qt

Qt binding for Go (Golang) with support for Windows / macOS / Linux / FreeBSD / Android / iOS / Sailfish OS / Raspberry Pi / AsteroidOS / Ubuntu Touch / JavaScript / WebAssembly
GNU Lesser General Public License v3.0
10.47k stars 747 forks source link

Multiple target cross compile #429

Closed amossam closed 7 years ago

amossam commented 7 years ago

Hey

I have smartos server where I created zone (vm) with ubuntu. I just executed commands for docker container, and successfully installed everything needed for building my project for linux (i'm developing on osx).

Then, on same vm, I followed steps for win_32_static docker container, and it worked! for first time... after first qtdeploy build linux, if I run qtdeploy build windows, it works and creates both targets. but after that, it won't build linux target, and gives below errors.

but if I run ~/work/bin/qtsetup generate linux, qtdeploy build linux works. or at least works until I run qtdeploy build windows ...

Any ideas what's wrong?

ERRO[0029] failed to run command                         cmd="go build -p 8 -v -ldflags=\"-s\" \"-w\" -o /home/admin/work/src/sns/deploy/linux/sns -tags=\"minimal\"" env= error="exit status 2" func=RunCmd name="build for linux on linux"
github.com/therecipe/qt/core
# github.com/therecipe/qt/core
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/_cgo_main.c: In function ‘crosscall2’:
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/_cgo_main.c:2:23: warning: unused parameter ‘fn’ [-Wunused-parameter]
 void crosscall2(void(*fn)(void*, int, __SIZE_TYPE__), void *a, int c, __SIZE_TYPE__ ctxt) { }
                       ^
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/_cgo_main.c:2:61: warning: unused parameter ‘a’ [-Wunused-parameter]
 void crosscall2(void(*fn)(void*, int, __SIZE_TYPE__), void *a, int c, __SIZE_TYPE__ ctxt) { }
                                                             ^
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/_cgo_main.c:2:68: warning: unused parameter ‘c’ [-Wunused-parameter]
 void crosscall2(void(*fn)(void*, int, __SIZE_TYPE__), void *a, int c, __SIZE_TYPE__ ctxt) { }
                                                                    ^
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/_cgo_main.c:2:85: warning: unused parameter ‘ctxt’ [-Wunused-parameter]
 void crosscall2(void(*fn)(void*, int, __SIZE_TYPE__), void *a, int c, __SIZE_TYPE__ ctxt) { }
                                                                                     ^
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/_cgo_main.c: In function ‘_cgo_release_context’:
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/_cgo_main.c:4:41: warning: unused parameter ‘ctxt’ [-Wunused-parameter]
 void _cgo_release_context(__SIZE_TYPE__ ctxt) { }
                                         ^
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/_cgo_main.c: In function ‘_cgo_allocate’:
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/_cgo_main.c:6:26: warning: unused parameter ‘a’ [-Wunused-parameter]
 void _cgo_allocate(void *a, int c) { }
                          ^
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/_cgo_main.c:6:33: warning: unused parameter ‘c’ [-Wunused-parameter]
 void _cgo_allocate(void *a, int c) { }
                                 ^
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/_cgo_main.c: In function ‘_cgo_panic’:
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/_cgo_main.c:7:23: warning: unused parameter ‘a’ [-Wunused-parameter]
 void _cgo_panic(void *a, int c) { }
                       ^
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/_cgo_main.c:7:30: warning: unused parameter ‘c’ [-Wunused-parameter]
 void _cgo_panic(void *a, int c) { }
                              ^
# github.com/therecipe/qt/core
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/core_plugin_import.cpp.o: In function `StaticQWindowsIntegrationPluginPluginInstance::StaticQWindowsIntegrationPluginPluginInstance()':
../github.com/therecipe/qt/core/core_plugin_import.cpp:5: undefined reference to `qt_static_plugin_QWindowsIntegrationPlugin()'
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/core_plugin_import.cpp.o: In function `StaticQSvgIconPluginPluginInstance::StaticQSvgIconPluginPluginInstance()':
../github.com/therecipe/qt/core/core_plugin_import.cpp:6: undefined reference to `qt_static_plugin_QSvgIconPlugin()'
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/core_plugin_import.cpp.o: In function `StaticQGifPluginPluginInstance::StaticQGifPluginPluginInstance()':
../github.com/therecipe/qt/core/core_plugin_import.cpp:7: undefined reference to `qt_static_plugin_QGifPlugin()'
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/core_plugin_import.cpp.o: In function `StaticQICNSPluginPluginInstance::StaticQICNSPluginPluginInstance()':
../github.com/therecipe/qt/core/core_plugin_import.cpp:8: undefined reference to `qt_static_plugin_QICNSPlugin()'
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/core_plugin_import.cpp.o: In function `StaticQICOPluginPluginInstance::StaticQICOPluginPluginInstance()':
../github.com/therecipe/qt/core/core_plugin_import.cpp:9: undefined reference to `qt_static_plugin_QICOPlugin()'
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/core_plugin_import.cpp.o: In function `StaticQJp2PluginPluginInstance::StaticQJp2PluginPluginInstance()':
../github.com/therecipe/qt/core/core_plugin_import.cpp:10: undefined reference to `qt_static_plugin_QJp2Plugin()'
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/core_plugin_import.cpp.o: In function `StaticQJpegPluginPluginInstance::StaticQJpegPluginPluginInstance()':
../github.com/therecipe/qt/core/core_plugin_import.cpp:11: undefined reference to `qt_static_plugin_QJpegPlugin()'
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/core_plugin_import.cpp.o: In function `StaticQMngPluginPluginInstance::StaticQMngPluginPluginInstance()':
../github.com/therecipe/qt/core/core_plugin_import.cpp:12: undefined reference to `qt_static_plugin_QMngPlugin()'
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/core_plugin_import.cpp.o: In function `StaticQSvgPluginPluginInstance::StaticQSvgPluginPluginInstance()':
../github.com/therecipe/qt/core/core_plugin_import.cpp:13: undefined reference to `qt_static_plugin_QSvgPlugin()'
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/core_plugin_import.cpp.o: In function `StaticQTgaPluginPluginInstance::StaticQTgaPluginPluginInstance()':
../github.com/therecipe/qt/core/core_plugin_import.cpp:14: undefined reference to `qt_static_plugin_QTgaPlugin()'
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/core_plugin_import.cpp.o: In function `StaticQTiffPluginPluginInstance::StaticQTiffPluginPluginInstance()':
../github.com/therecipe/qt/core/core_plugin_import.cpp:15: undefined reference to `qt_static_plugin_QTiffPlugin()'
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/core_plugin_import.cpp.o: In function `StaticQWbmpPluginPluginInstance::StaticQWbmpPluginPluginInstance()':
../github.com/therecipe/qt/core/core_plugin_import.cpp:16: undefined reference to `qt_static_plugin_QWbmpPlugin()'
/tmp/go-build213973033/github.com/therecipe/qt/core/_obj/core_plugin_import.cpp.o: In function `StaticQWebpPluginPluginInstance::StaticQWebpPluginPluginInstance()':
../github.com/therecipe/qt/core/core_plugin_import.cpp:17: undefined reference to `qt_static_plugin_QWebpPlugin()'
collect2: error: ld returned 1 exit status
therecipe commented 7 years ago

Hey

Yeah, sorry I think that's a caching issue. Maybe try to remove the file that contain "_plugin_import" in their name, in between the builds in "therecipe/qt/{core,gui,widgets, ....}" .

But if you only use docker images, then this shouldn't be a problem. Does this:

qtdeploy -docker build linux path/to/your/project
qtdeploy -docker build windows_32_shared path/to/your/project
qtdeploy -docker build linux path/to/your/project
qtdeploy -docker build windows_32_static path/to/your/project
qtdeploy -docker build linux path/to/your/project

work for you?

(Btw, you can also use windows_32_shared, windows_32_static, windows_64_shared and windows_64_static as build targets when using docker. I just haven't had time to update the readme yet.)

amossam commented 7 years ago

thanks for reply...

No, I'm not using docker images, only this vm that I build for this...

If I remove this files, do I need to do qtsetup generate <target> again or not ?

thanks!

./therecipe/qt/uitools/uitools_plugin_import.cpp
./therecipe/qt/xmlpatterns/xmlpatterns_plugin_import.cpp
./therecipe/qt/quick/quick_qml_plugin_import.cpp
./therecipe/qt/quick/quick_plugin_import.cpp
./therecipe/qt/quickcontrols2/quickcontrols2_plugin_import.cpp
./therecipe/qt/quickcontrols2/quickcontrols2_qml_plugin_import.cpp
./therecipe/qt/bluetooth/bluetooth_plugin_import.cpp
./therecipe/qt/dbus/dbus_plugin_import.cpp
./therecipe/qt/scxml/scxml_plugin_import.cpp
./therecipe/qt/scxml/scxml_qml_plugin_import.cpp
./therecipe/qt/help/help_plugin_import.cpp
./therecipe/qt/gui/gui_plugin_import.cpp
./therecipe/qt/location/location_qml_plugin_import.cpp
./therecipe/qt/location/location_plugin_import.cpp
./therecipe/qt/widgets/widgets_plugin_import.cpp
./therecipe/qt/core/core_plugin_import.cpp
./therecipe/qt/network/network_plugin_import.cpp
./therecipe/qt/sql/sql_plugin_import.cpp
./therecipe/qt/sensors/sensors_plugin_import.cpp
./therecipe/qt/gamepad/gamepad_plugin_import.cpp
./therecipe/qt/datavisualization/datavisualization_plugin_import.cpp
./therecipe/qt/multimedia/multimedia_plugin_import.cpp
./therecipe/qt/script/script_plugin_import.cpp
./therecipe/qt/purchasing/purchasing_plugin_import.cpp
./therecipe/qt/testlib/testlib_plugin_import.cpp
./therecipe/qt/serialport/serialport_plugin_import.cpp
./therecipe/qt/scripttools/scripttools_plugin_import.cpp
./therecipe/qt/nfc/nfc_plugin_import.cpp
./therecipe/qt/printsupport/printsupport_plugin_import.cpp
./therecipe/qt/positioning/positioning_plugin_import.cpp
./therecipe/qt/qml/qml_plugin_import.cpp
./therecipe/qt/qml/qml_qml_plugin_import.cpp
./therecipe/qt/svg/svg_plugin_import.cpp
./therecipe/qt/websockets/websockets_plugin_import.cpp
./therecipe/qt/webchannel/webchannel_plugin_import.cpp
./therecipe/qt/webchannel/webchannel_qml_plugin_import.cpp
./therecipe/qt/xml/xml_plugin_import.cpp
./therecipe/qt/serialbus/serialbus_plugin_import.cpp
./therecipe/qt/charts/charts_plugin_import.cpp
amossam commented 7 years ago

ok, after find . -type f -iname "*_plugin_import*" |xargs rm in $GOPATH/src/github.com/therecipe folder, it builds windows and linux target without a problem.... and the files are not regenerated...

So, now it's working! Thanks!

Btw, what and why generated that files, when/if they are not needed?

Again thanks for help, and for this great project of yours.

therecipe commented 7 years ago

Yeah, sorry you don't need to re-run the setup after removing them.

Btw, what and why generated that files, when/if they are not needed?

The *_plugin files are needed for the static windows builds, but they seem to cause problems with some other targets if they are not removed prior compiling.

I will look into this, maybe I can use some build tags or maybe I will just let qtdeploy remove them before/after each build.

Again thanks for help, and for this great project of yours.

You are welcome :)

amossam commented 7 years ago

But files are not regenerated. I build multiple times linux and windows targets, and they build succesfuly, but those files are not regenerated...

Anyway, solution is found!

Thanks again

Sent from my Samsung SM-G955F using FastHub