go-qamel / qamel

Simple QML binding for Go
MIT License
176 stars 19 forks source link

Can`t build app #15

Closed 8fa94 closed 5 years ago

8fa94 commented 5 years ago

Hallo .

qamel build -o output/desktop-app.exe --copy-deps
Starting build process.

Load config file...done
Removing old build files...done
Generating binding files...done
Generating Qt resource file...done
Generating syso file...icon file doesn't exist
Generating code for QML objects...done
Building app...
Failed to build app : exit status 1
go build github.com/RadhiFadlillah/qamel: E:\Go\pkg\tool\windows_amd64\cgo.exe:  exit status 2

How can i solve this problem? Thanks.

RadhiFadlillah commented 5 years ago

Hi @8fa94, could you give me the output for go env and qamel profile print please.

8fa94 commented 5 years ago

Hi, @RadhiFadlillah This problem was solved, but brings new problem. output:

C:\Users\root\go\src\hallo_world>qamel build -o output/desktop-app.exe --copy-deps
Starting build process.

Load config file...done
Removing old build files...done
Generating binding files...done
Generating Qt resource file...done
Generating syso file...icon file doesn't exist
Generating code for QML objects...done
Building app...
Failed to build app: exit status 2
# github.com/RadhiFadlillah/qamel
application.cpp:2:10: fatal error: QApplication: No such file or directory
 #include <QApplication>
          ^~~~~~~~~~~~~~
compilation terminated.

C:\Users\root\go\src\hallo_world>go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\root\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\root\go
set GOPROXY=
set GORACE=
set GOROOT=E:\Go
set GOTMPDIR=
set GOTOOLDIR=E:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\root\AppData\Local\Temp\go-build293066310=/tmp/go-build -gno-record-gcc-switches

C:\Users\root\go\src\hallo_world>qamel profile print
Details of profile default
OS      : windows
Arch    : amd64
Static  : false
Qmake   : E:\qt\qt5.13.0\5.13.0\mingw73_64\bin\qmake.exe
Moc     : E:\qt\qt5.13.0\5.13.0\mingw73_64\bin\moc.exe
Rcc     : E:\qt\qt5.13.0\5.13.0\mingw73_64\bin\rcc.exe
Gcc     : gcc.exe
G++     : g++.exe
Objdump : objdump.exe
Windres : E:\qt\qt5.13.0\Tools\mingw730_64\bin\windres.exe
RadhiFadlillah commented 5 years ago

Hi @8fa94, sorry for late response.

I reckon you are using Qt from official installer, correct? If so, It seems you are using the wrong gcc, g++ and objdump. You should use the one that provided by mingw, so your profile should look like this :

Details of profile default
OS      : windows
Arch    : amd64
Static  : false
Qmake   : E:\qt\qt5.13.0\5.13.0\mingw73_64\bin\qmake.exe
Moc     : E:\qt\qt5.13.0\5.13.0\mingw73_64\bin\moc.exe
Rcc     : E:\qt\qt5.13.0\5.13.0\mingw73_64\bin\rcc.exe
Gcc     : E:\qt\qt5.13.0\Tools\mingw730_64\bin\gcc.exe
G++     : E:\qt\qt5.13.0\Tools\mingw730_64\bin\g++.exe
Objdump : E:\qt\qt5.13.0\Tools\mingw730_64\bin\objdump.exe
Windres : E:\qt\qt5.13.0\Tools\mingw730_64\bin\windres.exe
8fa94 commented 5 years ago

Hi, @RadhiFadlillah Thank you for your patient help. I tried following your installation wiki,and same profiles as you ,but he said gcc is not in my %PATH% ,and appear the frist problem,and then I tried add E:\qt\qt5.13.0\Tools\mingw730_64\bin to environment PATH ,the frist problem was solved,but there is a second problem,

# github.com/RadhiFadlillah/qamel
application.cpp:2:10: fatal error: QApplication: No such file or directory
 #include <QApplication>
          ^~~~~~~~~~~~~~
compilation terminated.

profile is the same as you,but has the same wrong.

RadhiFadlillah commented 5 years ago

@8fa94 that's a bit weird. I can't reproduce it even on a freshly installed Windows 7.

but he said gcc is not in my %PATH%

Normally, even if gcc is not set in your environment variable, qamel should be still able to build because qamel will register the temporary environment variable automatically.

With that said, if you don't mind, could you give me more information :

Thanks !

8fa94 commented 5 years ago

@RadhiFadlillah I try in new environment OS:Windows 10 and just install QT and GO and i try again. Use cmd.

C:\Users\root\go\src\github.com\RadhiFadlillah\qamel\examples\hello-world>qamel build -o output/desktop-app.exe --copy-deps
Starting build process.

Load config file...done
Removing old build files...done
Generating binding files...done
Generating Qt resource file...done
Generating syso file...icon file doesn't exist
Generating code for QML objects...done
Building app...
Failed to build app: exit status 1
go build runtime/cgo: c:\go\pkg\tool\windows_amd64\cgo.exe: exit status 2

C:\Users\root\go\src\github.com\RadhiFadlillah\qamel\examples\hello-world>qamel --version
qamel version 715de5446c83d5543369f3a88891f4e170cc0d2a

C:\Users\root\go\src\github.com\RadhiFadlillah\qamel\examples\hello-world>qamel profile print
Details of profile default
OS      : windows
Arch    : amd64
Static  : false
Qmake   : C:\Qt\Qt5.13.0\5.13.0\mingw73_64\bin\qmake.exe
Moc     : C:\Qt\Qt5.13.0\5.13.0\mingw73_64\bin\moc.exe
Rcc     : C:\Qt\Qt5.13.0\5.13.0\mingw73_64\bin\rcc.exe
Gcc     : C:\Qt\Qt5.13.0\Tools\mingw730_64\bin\gcc.exe
G++     : C:\Qt\Qt5.13.0\Tools\mingw730_64\bin\g++.exe
Objdump : C:\Qt\Qt5.13.0\Tools\mingw730_64\bin\objdump.exe
Windres : C:\Qt\Qt5.13.0\Tools\mingw730_64\bin\windres.exe

Thanks!

RadhiFadlillah commented 5 years ago

Hi @8fa94, sorry for late response.

I've tested it in a freshly installed Windows 10, and I can confirm this issue happened when using cmd and powershell. However, the qamel works properly when I'm using cmder.

Unfortunately, after several days I still haven't found the cause which make qamel works in cmder but not in other terminal. So, for now, as far as I tested, cmder is the only terminal in Windows that compatible with qamel.

With that said, if you don't mind, could you test it out using cmder ? Even the cmder-mini should works fine.

Thanks !

8fa94 commented 5 years ago

@RadhiFadlillah Thank you for your patience. I solved the problem after i used cmder.

RadhiFadlillah commented 5 years ago

Hi @8fa94, glad it worked out for you.

I'll close this issue for now. For the problem with cmd and powershell, it will be tracked in #18.