Windows build Environment cannot be installed anymore - need a hand

freshman
Posts: 38
Joined: Mon Oct 05, 2020 9:56 pm

Re: Windows build Environment cannot be installed anymore - need a hand

Post by freshman »

Ok, realised the issue with New-Item was because was already existing from previous tries. Did further investigation and found the real issue was that aqt or C:\src was not in the path. I tried using:

exec "C:\src\aqt" @("install-qt", "windows", "desktop", "5.14.2", "win32_mingw73")
Step "Installing Mingw 7.3.0 Win32 tools"
exec "C:\src\aqt" @("install-tool", "windows", "desktop", "tools_mingw", "qt.tools.win32_mingw730")

and it seems I'm beyond the qt installation now. Let's see how far it gets (compiling lua and luarocks now...)

freshman
Posts: 38
Joined: Mon Oct 05, 2020 9:56 pm

Re: Windows build Environment cannot be installed anymore - need a hand

Post by freshman »

It still needs the separate git installation mentioned above.. There is an error here:

----
luautf8 0.1.5-2 depends on lua >= 5.1 (5.1-1 provided by VM)
C:\Qt\Tools\mingw730_32\bin\gcc.exe -O2 -c -o lutf8lib.o -IC:\Qt\Tools\mingw730_32\include lutf8lib.c
C:\Qt\Tools\mingw730_32\bin\gcc.exe -shared -o lua-utf8.dll lutf8lib.o C:\Qt\Tools\mingw730_32\bin/lua51.dll -lm
luautf8 0.1.5-2 is now installed in C:/Qt/Tools/mingw730_32 (license: MIT)

==== lua-utf8 compiled and installed ====
==== compiling and installing lua-yajl ====
Installing https://luarocks.org/lua-yajl-2.0-1.src.rock

lua-yajl 2.0-1 depends on lua >= 5.1 (5.1-1 provided by VM)
C:\Qt\Tools\mingw730_32\bin\gcc.exe -O2 -c -o lua_yajl.o -IC:\Qt\Tools\mingw730_32\include lua_yajl.c
C:\Qt\Tools\mingw730_32\bin\gcc.exe -shared -o yajl.dll lua_yajl.o -lyajl C:\Qt\Tools\mingw730_32\bin/lua51.dll -lm
./yajl.dll: file not recognized: File truncated
collect2.exe: error: ld returned 1 exit status
-----

That doesn't look too sensible to me. Yes, there are a severals Gig left on this device. I'll just remove all stuff and will rerun the whole setup. Maybe it works then.

freshman
Posts: 38
Joined: Mon Oct 05, 2020 9:56 pm

Re: Windows build Environment cannot be installed anymore - need a hand

Post by freshman »

On second try the yajl installation work, also got some statistics for languages. But the compilation of mudlet fails at:

Project MESSAGE: Including own copy of QtKeyChain library code in this configuration
Running make
C:/Qt/Tools/mingw730_32/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'C:/Users/<username>/Documents/GitHub/Mudlet/build'
C:\Qt\5.14.2\mingw73_32\bin\uic.exe ..\src\ui\dlgPackageExporter.ui -o ui_dlgPackageExporter.h
C:\Qt\5.14.2\mingw73_32\bin\uic.exe ..\src\ui\mapper.ui -o ui_mapper.h
ccache g++ -fno-keep-inline-dllexport -g -O0 -std=gnu++1z -Wall -Wextra -Wextra -dM -E -o debug\moc_predefs.h C:\Qt\5.14.2\mingw73_32\mkspecs\features\data\dummy.cpp
process_begin: CreateProcess(NULL, ccache g++ -fno-keep-inline-dllexport -g -O0 -std=gnu++1z -Wall -Wextra -Wextra -dM -E -o debug\moc_predefs.h C:\Qt\5.14.2\mingw73_32\mkspecs\features\data\dummy.cpp, ...) failed.
make (e=2): Das System kann die angegebene Datei nicht finden.
mingw32-make[1]: *** [Makefile.Debug:1808: debug/moc_predefs.h] Error 2
mingw32-make[1]: Leaving directory 'C:/Users/<username>/Documents/GitHub/Mudlet/build'
mingw32-make: *** [Makefile:45: debug] Error 2

Source C:\Qt\5.14.2\mingw73_32\mkspecs\features\data\dummy.cpp is there, there is also build/debug .

I removed all in build/debug and retried, no change. Not sure what file is missing, maybe ccache or g++?

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Windows build Environment cannot be installed anymore - need a hand

Post by Vadi »

I think ccache. Can you check if it exists in C:\Program Files\ccache\ccache.exe ? Maybe it needs to be added to Windows PATH?

freshman
Posts: 38
Joined: Mon Oct 05, 2020 9:56 pm

Re: Windows build Environment cannot be installed anymore - need a hand

Post by freshman »

Yes, you were right. It was there, but not in the PATH. For simplicity, I added it to the global system settings. I'd assume you've a better suggestion, like somewhere in the makefiles. Do you?

Anyway, with that I got a working debug build (well, it crashes when I hit it with some MSP data, but that's another thing). When trying to rerun, it complains about several missing Qt dll. I guess it needs some specical environment settings to be started.

What's the plan on how to work on and recompile the code? The wiki mentions QtCreator, but it was not installed with Qt. Just try to use C:/Qt/Tools/mingw730_32/bin/mingw32-make -f Makefile.Debug or maybe change something to install QtCreator? Or just install QtCreator the normal way?

Rerunning the setup-windows-sdk.ps1 also does a rebuild and starts Mudlet, but it does reinstall/compile argparse and lunajson everytime and recompile a few sources, even if unchanged.

From my memory (I'd certainly doublecheck with a clean rebuild), what has to be done is:

- If you have 7zip installed, better deinstall and have it reinstalled by setup-windows-sdk.ps1 , otherwise the setup cannot find it in the path.
- Deinstalled existing Python27 (not sure if needed, I think it also had a path issue.. I really need to recheck), did the same with cmake
- I'd assume you should ensure you deinstalled Qt if you now want to use the aqt installed one.
- Be really, really sure you really have a clone of the current development branch, not a stale one.
- Have the aqt patch in from Vadi (see above), but ensure you added C:\src for the absolute path
- Ensure c:\libraries, c:\LuaRocks, c:\mingw, (c:\Python27), c:\Qt, c:\src, c:\spellings are removed.. otherwise some remainders of previous / failed attempts can break the script (the New-Item issue)
- Have C:\Program Files\ccache in the PATH
- In addition to Github-Desktop. Have a cli git installed. I used: Git-2.40.0-32-bit.exe (it says you should better use 64 bit but I did not dare to)

freshman
Posts: 38
Joined: Mon Oct 05, 2020 9:56 pm

Re: Windows build Environment cannot be installed anymore - need a hand

Post by freshman »

Oh, and the malware scanner did not like powershell starting c:\src\aqt.exe and c:\qt\tools\mingw730_32\bin\lua.exe . Probably looks to much like some malware dropper downloading the main detonation code.

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Windows build Environment cannot be installed anymore - need a hand

Post by Vadi »

There are a few options, since Mudlet is a cmake-based project you can either use Qt Creator (an official IDE), Visual Studio Code (but not Visual Studio - haven't tried it) or CLion (commercial offering). I'd go with Qt Creator for a start, and you can install it from the official Qt installer.

Really glad you got it going. Getting the dependencies installed on Windows is way too hard despite us putting in a lot of effort into it. Thanks for the list of improvements, when I have time I will integrate them in.

A tip for the pull request - start a new branch, and a new pull request, for every piece of reasonably scoped change you do. That will make it way easier for us to review and more importantly test - and testing is key here; you know how wild MXP is and how differently do various games implement it.

freshman
Posts: 38
Joined: Mon Oct 05, 2020 9:56 pm

Re: Windows build Environment cannot be installed anymore - need a hand

Post by freshman »

Ok, I worked a bit more on this (had no time over easter days). Also, Vadi, I hope this might help someone else setup a Windows build, since it no longer works just as sketched in the Wiki. Actually, this is my main motivation for the thread.

I changed CI\appveyor.functions.ps1 even more:

function InstallQt() {
Step "Installing aqtinstall"
- exec "pip" @("install", "aqtinstall")
New-Item -Path $Env:QT_BASE_DIR -ItemType Directory
cd $Env:QT_BASE_DIR
# go up to the root of Qt folder to start installation
cd ..
cd ..
+ DownloadFile "https://github.com/miurahr/aqtinstall/r ... .4/aqt.exe" "aqt.exe" $true
Step "Installing Qt"
- exec "aqt" @("install-qt", "windows", "desktop", "5.14.2", "win32_mingw73")
+ exec "C:\src\aqt" @("install-qt", "windows", "desktop", "5.14.2", "win32_mingw73")
Step "Installing Mingw 7.3.0 Win32 tools"
- exec "aqt" @("install-tool", "windows", "desktop", "tools_mingw", "qt.tools.win32_mingw730")
+ exec "C:\src\aqt" @("install-tool", "windows", "desktop", "tools_mingw", "qt.tools.win32_mingw730")
+ Step "Installing QtCreator"
+ exec "C:\src\aqt" @("install-tool", "windows", "desktop", "tools_qtcreator", "qt.tools.qtcreator")
}

The rest of my previous steps for setup seem to be ok, in addition I now got a qtcreator.exe in C:\Qt\Tools\QtCreator\bin that I can run directly or setup a shortcut/link to it. I had my issues setting up qtcreator. Just opening project mudlet/src/mudlet.pro was not enough, qtcreator did not find the build environment.

It seems the main ingredient to the solution was, in settings, kits, qt-versions select the qmake path: C:\Qt\5.14.2\mingw73_32\bin\qmake .
Under Compiler I've choosen C:\Qt\Tools\mingw730_32\bin\gcc.exe for qcc (hope it's right, but it seems unused anyway), and C:\Qt\Tools\mingw730_32\bin\gcc.exe (named mingw) for c++ . Under debugger I took: C:\Qt\Tools\mingw730_32\bin\gdb.exe

All autodetection features of qtcreator failed miserably. It threw a bunch of warning, but out of sudden, it now seems to work. It does also build and run mudlet (albeit in another dir than the install script, but well...). Building gives a warning:

warning: lua-yajl not available - translation statistics in settings won't be shown.
Error loading yajl was: module 'yajl' not found:
no field package.preload['yajl']
no file '.\yajl.lua'
no file 'C:\Qt\Tools\mingw730_32\bin\lua\yajl.lua'
no file 'C:\Qt\Tools\mingw730_32\bin\lua\yajl\init.lua'
no file 'C:\Qt\Tools\mingw730_32\bin\yajl.lua'
no file 'C:\Qt\Tools\mingw730_32\bin\yajl\init.lua'
no file '.\yajl.dll'
no file 'C:\Qt\Tools\mingw730_32\bin\yajl.dll'
no file 'C:\Qt\Tools\mingw730_32\bin\loadall.dll'

albeit it was installed and could be found when building with the install script. It seems not to affect me though.

With that setup I should now be able to do some productive work. The debugger does now also seem to work, it did catch the MSP (MSP, no MXP involved at all) related segfault btw. But that's not my main focus at the moment.
Last edited by freshman on Wed Apr 12, 2023 12:58 pm, edited 1 time in total.

freshman
Posts: 38
Joined: Mon Oct 05, 2020 9:56 pm

Re: Windows build Environment cannot be installed anymore - need a hand

Post by freshman »

I forgot to mention: At QT Version, qt-creator wants you to select a kit, but there are non in the selection. That got me thinking for a while. However, just select the qmake I mentioned above and then select the checkbox to use all packages.

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Windows build Environment cannot be installed anymore - need a hand

Post by Vadi »

Nice nice. Thanks. I'll look at applying these changes to the script and come back to you with questions.

Re: MSP segfault, that one is not known. Have a way to trigger it?

Post Reply