Cannot build on Windows
(Split from #25 (closed) due to age of that issue.)
Initial report
I’ve just tried building on Windows now. I didn’t run into the error @rszibele got, but I did find a couple more issues.Firstly, I got this error when building qtah-cpp
:
$ stack build qtah-cpp
qtah-cpp> configure (lib)
Configuring qtah-cpp-0.7.0...
Info: creating stash file C:\Users\bradn\AppData\Local\Temp\qtahenum-a3eef8790038b696\.qmake.stash
make -f Makefile.Release
make[1]: Entering directory '/c/Users/bradn/AppData/Local/Temp/qtahenum-a3eef8790038b696'
g++ -c -fno-keep-inline-dllexport -O2 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -IC:/Qt/5.15.1/mingw81_64/include -IC:/Qt/5.15.1/mingw81_64/include/QtWidgets -IC:/Qt/5.15.1/mingw81_64/include/QtGui -IC:/Qt/5.15.1/mingw81_64/include/QtANGLE -IC:/Qt/5.15.1/mingw81_64/include/QtCore -Irelease -I/include -IC:/Qt/5.15.1/mingw81_64/mkspecs/win32-g++ -o release/qtahenum.o qtahenum.cpp
g++ -Wl,-s -Wl,-subsystem,console -mthreads -o release/qtahenum.exe release/qtahenum.o C:/Qt/5.15.1/mingw81_64/lib/libQt5Widgets.a C:/Qt/5.15.1/mingw81_64/lib/libQt5Gui.a C:/Qt/5.15.1/mingw81_64/lib/libQt5Core.a
make[1]: Leaving directory '/c/Users/bradn/AppData/Local/Temp/qtahenum-a3eef8790038b696'
qtah-cpp: Requesting system default Qt.
.\qtahenum: readCreateProcess: does not exist (No such file or directory)
qtah-cpp: Using Qt 5.15.
-- While building package qtah-cpp-0.7.0 using:
C:\Users\bradn\Documents\Haskell\qtah\qtah-cpp\.stack-work\dist\e626a42b\setup\setup --builddir=.stack-work\dist\e626a42b configure --user --package-db=clear --package-db=global --package-db=C:\sr\snapshots\b058af02\pkgdb --package-db=C:\Users\bradn\Documents\Haskell\qtah\.stack-work\install\eeb2e490\pkgdb --libdir=C:\Users\bradn\Documents\Haskell\qtah\.stack-work\install\eeb2e490\lib --bindir=C:\Users\bradn\Documents\Haskell\qtah\.stack-work\install\eeb2e490\bin --datadir=C:\Users\bradn\Documents\Haskell\qtah\.stack-work\install\eeb2e490\share --libexecdir=C:\Users\bradn\Documents\Haskell\qtah\.stack-work\install\eeb2e490\libexec --sysconfdir=C:\Users\bradn\Documents\Haskell\qtah\.stack-work\install\eeb2e490\etc --docdir=C:\Users\bradn\Documents\Haskell\qtah\.stack-work\install\eeb2e490\doc\qtah-cpp-0.7.0 --htmldir=C:\Users\bradn\Documents\Haskell\qtah\.stack-work\install\eeb2e490\doc\qtah-cpp-0.7.0 --haddockdir=C:\Users\bradn\Documents\Haskell\qtah\.stack-work\install\eeb2e490\doc\qtah-cpp-0.7.0 --dependency=Cabal=Cabal-2.4.1.0-5rQrtDcYhR2LOcYye7obEr --dependency=base=base-4.12.0.0 --dependency=directory=directory-1.3.3.0 --dependency=filepath=filepath-1.4.2.1 --dependency=process=process-1.6.5.0 --dependency=qtah-generator=qtah-generator-0.7.1-LbwX3BjUsP28IhSWTzCXVt -f-qt4 -f-qt5 --extra-include-dirs=C:\Users\bradn\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\include --extra-lib-dirs=C:\Users\bradn\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\lib --extra-lib-dirs=C:\Users\bradn\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\bin --exact-configuration --ghc-option=-fhide-source-paths
Process exited with code: ExitFailure 1
I found I could fix this error by changing this line in Graphics.UI.Qtah.Generator.Enum
:
out <- readProcess ("." </> "qtahenum") [] ""
To this:
out <- readProcess ("./release" </> "qtahenum") [] ""
(The issue was being caused by the fact that the compiled qtahenum
executable was located in the release
subdirectory of the working directory, rather than in the working directory itself).
Next, also while compiling qtah-cpp
, I ran into this issue:
qtah-cpp > Building library for qtah-cpp-0.7.0..
qtah-cpp > copy/register
qtah-cpp > make: Entering directory '/c/Users/bradn/Documents/Haskell/qtah/qtah-cpp/cpp'
qtah-cpp > /usr/bin/make -f Makefile.Release install
qtah-cpp > make[1]: Entering directory '/c/Users/bradn/Documents/Haskell/qtah/qtah-cpp/cpp'
qtah-cpp > cp -f release/libqtah0.a C:\Users\bradn\Documents\Haskell\qtah\.stack-work\install\eeb2e490\lib\x86_64-windows-ghc-8.6.5\qtah-cpp-0.7.0-GuuCOFf208096lPWhcOHI4/libqta
qtah-cpp > cp: cannot create regular file 'C:\Users\bradn\Documents\Haskell\qtah\.stack-work\install\eeb2e490\lib\x86_64-windows-ghc-8.6.5\qtah-cpp-0.7.0-GuuCOFf208096lPWhcOHI4
qtah-cpp > make[1]: [Makefile.Release:26425: install_target] Error 1 (ignored)
qtah-cpp > cp -f release/qtah0.dll C:\Users\bradn\Documents\Haskell\qtah\.stack-work\install\eeb2e490\lib\x86_64-windows-ghc-8.6.5\qtah-cpp-0.7.0-GuuCOFf208096lPWhcOHI4/qtah0.d
qtah-cpp > cp: cannot create regular file 'C:\Users\bradn\Documents\Haskell\qtah\.stack-work\install\eeb2e490\lib\x86_64-windows-ghc-8.6.5\qtah-cpp-0.7.0-GuuCOFf208096lPWhcOHI4
qtah-cpp > make[1]: [Makefile.Release:26426: install_target] Error 1 (ignored)
qtah-cpp > make[1]: Leaving directory '/c/Users/bradn/Documents/Haskell/qtah/qtah-cpp/cpp'
qtah-cpp > make: Leaving directory '/c/Users/bradn/Documents/Haskell/qtah/qtah-cpp/cpp'
qtah-cpp > make: Entering directory '/c/Users/bradn/Documents/Haskell/qtah/qtah-cpp/cpp'
qtah-cpp > /usr/bin/make -f Makefile.Release install
qtah-cpp > make[1]: Entering directory '/c/Users/bradn/Documents/Haskell/qtah/qtah-cpp/cpp'
qtah-cpp > cp -f release/libqtah0.a C:\Users\bradn\Documents\Haskell\qtah\.stack-work\install\eeb2e490\lib\x86_64-windows-ghc-8.6.5/libqtah0.a
qtah-cpp > cp -f release/qtah0.dll C:\Users\bradn\Documents\Haskell\qtah\.stack-work\install\eeb2e490\lib\x86_64-windows-ghc-8.6.5/qtah0.dll
qtah-cpp > make[1]: Leaving directory '/c/Users/bradn/Documents/Haskell/qtah/qtah-cpp/cpp'
qtah-cpp > make: Leaving directory '/c/Users/bradn/Documents/Haskell/qtah/qtah-cpp/cpp'
qtah-cpp > copyFile: does not exist (The system cannot find the path specified.)
I don’t have a proper solution to this one yet, but I did manage to work around it by making a new directory qtah-cpp-0.7.0-GuuCOFf208096lPWhcOHI4
in the appropriate location, after which compilation was able to continue without any errors.
Lastly, after building qtah
successfully, I attempted to build qtah-examples
— only to discover that it uses -dynamic
linking. It appears that this is unsupported on Windows, and does not seem likely to be included any time soon. So for now, it would appear that Qtah is still unusable on Windows, at least while dynamic linking is unsupported.
@khumba’s response
I wasn't aware of GHC being unable to do dynamic linking on Windows. That will take some work to change. Qtah on Linux requires dynamic linking because Qt is installed as dynamic libraries, so the build system is set up around that. If it's possible to link against Qt statically, we could perhaps do differently on Windows. I don't know about that though. (Or perhaps using cxx-sources
to build Qtah would help with linking here.)
For the first error, I wonder if we can determine why qmake is creating the subdirectory for the release build, or if we can have more control over that. Could be a Windows issue, or perhaps a Qt/qmake 5.15 issue. For comparison with my current system (Linux and Qt 5.14), I get only:
Configuring qtah-cpp-0.7.0...
qtah-cpp: Requesting system default Qt.
qtah-cpp: Using Qt 5.14.
Info: creating stash file /tmp/qtahenum-a386b08f9e754adb/.qmake.stash
g++ -c -pipe -O2 -Wall -Wextra -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtCore -I. -I/usr/lib64/qt5/mkspecs/linux-g++ -o qtahenum.o qtahenum.cpp
g++ -Wl,-O1 -o qtahenum qtahenum.o /usr/lib64/libQt5Widgets.so /usr/lib64/libQt5Gui.so /usr/lib64/libQt5Core.so -lGL -lpthread
Info: creating stash file /home/khumba/dev/qtah/git/qtah-cpp/cpp/.qmake.stash
Building the Qtah C++ library...
make: Entering directory '/home/khumba/dev/qtah/git/qtah-cpp/cpp'
For the second issue, it looks like we're just missing a mkdir. If qmake's makefile isn't handling this, we could probably create the directory before calling make in installOrRegister
in qtah-cpp/Setup.hs.
Also this issue's been closed for quite a while now, would you mind filing a new issue for further discussion please?
Many thanks.
Qtah on Linux requires dynamic linking because Qt is installed as dynamic libraries, so the build system is set up around that.
You may want to look at how gi-gtk
does it: I know that it links with GTK dynamically, though I wouldn’t know how.
For the first error, I wonder if we can determine why qmake is creating the subdirectory for the release build, or if we can have more control over that. Could be a Windows issue, or perhaps a Qt/qmake 5.15 issue.
I’m not sure what’s causing this: I’ve always found Qt’s building process to be quite confusing, and I don’t know the details. All I can tell you is that, for some reason, there’s an extra directory which qtah
isn’t yet accounting for.
For the second issue, it looks like we're just missing a mkdir. If qmake's makefile isn't handling this, we could probably create the directory before calling make in
installOrRegister
in qtah-cpp/Setup.hs.
Again, I can’t be entirely sure, though that does sound like it could fix this problem.