# Lua

**URL:** <https://forum.vassalengine.org/t/lua/10461>\
**Category:** Development\
**Tags:** v4\
**Created:** [April 24, 2020, 12:46pm UTC](https://forum.vassalengine.org/t/lua/10461 "2020-04-24T12:46:30Z")\
**Posts on this page:** 19\
**Page:** 2

<div class="post-metadata">

**Author:** ![uckelman](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/uckelman/32/10020_2.png) [@uckelman](https://forum.vassalengine.org/u/uckelman)\
**Post date:** [July 30, 2020, 12:16pm UTC](https://forum.vassalengine.org/t/lua/10461/21 "2020-07-30T12:16:25Z")

</div>

Thus spake Flint1b:

> mingw?

That would be my suggestion as well.

–  
J.

---

<div class="post-metadata">

**Author:** ![Flint1b](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/flint1b/32/246_2.png) [@Flint1b](https://forum.vassalengine.org/u/Flint1b)\
**Post date:** [July 30, 2020, 12:43pm UTC](https://forum.vassalengine.org/t/lua/10461/22 "2020-07-30T12:43:17Z")

</div>

Alternatively, clang/LLVM.

---

<div class="post-metadata">

**Author:** ![Brent\_Easton](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/brent_easton/32/10_2.png) [@Brent\_Easton](https://forum.vassalengine.org/u/Brent_Easton)\
**Post date:** [July 30, 2020, 12:43pm UTC](https://forum.vassalengine.org/t/lua/10461/23 "2020-07-30T12:43:49Z")

</div>

MingW is a mini-unix environment running under Windows that allows you to use the GNU gcc C++ compiler. I have had good results using this within Eclipse, although you can also use it with other IDE’s, or roll you own make files and use it with just a text editor.

It is an adventure to install, find a good tutorial and follow it closely. Once installed, I had no problems and was able to download and build pretty much any unix library or utility I needed.

You can also use gcc with the cygwin environment, but I could never get this to work.

---

<div class="post-metadata">

**Author:** ![uckelman](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/uckelman/32/10020_2.png) [@uckelman](https://forum.vassalengine.org/u/uckelman)\
**Post date:** [July 30, 2020, 12:57pm UTC](https://forum.vassalengine.org/t/lua/10461/24 "2020-07-30T12:57:06Z")

</div>

Thus spake Brent Easton:

> MingW is a mini-unix environment running under Windows that allows you  
> to use the GNU gcc C++ compiler. I have had good results using this  
> within Eclipse, although you can also use it with other IDE’s, or roll  
> you own make files and use it with just a text editor.
> 
> It is an adventure to install, find a good tutorial and follow it  
> closely. Once installed, I had no problems and was able to download and  
> build pretty much any unix library or utility I needed.
> 
> You can also use gcc with the cygwin environment, but I could never get  
> this to work.

If you’re using Linux, you’re in luck:

I use mingw for cross-compiling Windows libraries and executables every  
day, and have for quite some years now. A lot of Linux distributions  
have mingw packages, and these days it mostly just works.

–  
J.

---

<div class="post-metadata">

**Author:** ![Flint1b](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/flint1b/32/246_2.png) [@Flint1b](https://forum.vassalengine.org/u/Flint1b)\
**Post date:** [July 30, 2020, 5:19pm UTC](https://forum.vassalengine.org/t/lua/10461/25 "2020-07-30T17:19:01Z")

</div>

Figures. Linux is a better environment for the WINDOWS compiler than windows itself 😃

---

<div class="post-metadata">

**Author:** ![Rhett](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/r/85e7bf/32.png) [@Rhett](https://forum.vassalengine.org/u/Rhett)\
**Post date:** [July 30, 2020, 8:49pm UTC](https://forum.vassalengine.org/t/lua/10461/26 "2020-07-30T20:49:03Z")

</div>

Thanks guys.

MinGW quickly led me to MXE, a complete cross-compile environment for Qt.

[github.com/mxe/mxe](https://github.com/mxe/mxe)

For use see here:

[stackoverflow.com/questions/141 … or-windows](https://stackoverflow.com/questions/14170590/building-qt-5-on-linux-for-windows)

I may use MXE. Problem: it seems to download Qt5.15 when lqt only works with Qt5.12 and Qt5.13… Soon (?) I should be running a Windows version of the binding. After that I will make a simple “scale-and-rotate-an-image” script to test quality/speed of this in Lua under Qt.

I will also try to upload all files needed to run this script to my Git so that anyone with Windows can download and run it (or use Wine on Linux). This is important. The user should (in theory) not have to install anything, just download files, run the script and it will work. The Lua interpreter and the Qt binding lib files should come as a bundle. Only qtcore, qtgui and qtwidgets are needed (I presume).

luajit ---- 518.3 KB

qtcore.so ---- 24,7MB  
qtgui.so ---- 22.2MB  
lqtwidgets.so ---- 26.9MB

Relatively large files. They need of course only be downloaded once. May be dependent on other libraries.

---

<div class="post-metadata">

**Author:** ![Brent\_Easton](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/brent_easton/32/10_2.png) [@Brent\_Easton](https://forum.vassalengine.org/u/Brent_Easton)\
**Post date:** [July 30, 2020, 9:42pm UTC](https://forum.vassalengine.org/t/lua/10461/27 "2020-07-30T21:42:06Z")

</div>

Saying mingw IS a windows compiler is very confusing and incorrect. Mingw HAS compilers, and they are just the same standard GNU compilers used on linux machines.

mingw is basically a minimal set of libraries and a port of the standard GNU compilers that allows other GNU linux software to be compiled, built and run on a windows system. It allows you to compile and run native Windows apps without needing other 3rd party libraries.

When you use mingw to ‘cross-compile from linux to windows’ you are using a special version of the standard GNU C++ compiler that has been built with linux versions of the mingw libraries to run on linux to output windows compatible run time code.

---

<div class="post-metadata">

**Author:** ![Flint1b](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/flint1b/32/246_2.png) [@Flint1b](https://forum.vassalengine.org/u/Flint1b)\
**Post date:** [July 30, 2020, 11:00pm UTC](https://forum.vassalengine.org/t/lua/10461/28 "2020-07-30T23:00:25Z")

</div>

```auto
MinGW, a contraction of "Minimalist GNU for Windows"
```

It’s primary target IS Windows, that whole project was made for Windows, it’s a port of the GCC for Windows. Ok it’s not a/one compiler, its the whole toolchain with assembler linker etc.

At least there’s no clang/llvm fans here…

---

<div class="post-metadata">

**Author:** ![Rhett](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/r/85e7bf/32.png) [@Rhett](https://forum.vassalengine.org/u/Rhett)\
**Post date:** [August 2, 2020, 12:20pm UTC](https://forum.vassalengine.org/t/lua/10461/29 "2020-08-02T12:20:36Z")

</div>

Ok, I realized I had all the necessary bindings to make the Scale-and-Rotate script under Linux.

I decided to do this first because it illustrates a few important points.

The script (qtScaleRotate.lua) looks like this:

[code]package.cpath = “./?.so”

local QtCore = require ‘qtcore’  
local QtGui = require ‘qtgui’  
local QtWidgets = require ‘qtwidgets’

local app = QtWidgets.QApplication.new(0, {})  
app.setApplicationName(‘qtLua … Scale and Rotate’)

local window = QtWidgets.QMainWindow.new()

window:setMinimumWidth(640)  
window:setMinimumHeight(400)

image = QtGui.QImage("./sailboat.png")

inIcon = QtGui.QIcon("./zoom\_in.png")  
outIcon = QtGui.QIcon("./zoom\_out.png")  
rotateIcon = QtGui.QIcon("./rotate.png")

local buttonIn = QtWidgets.QPushButton(inIcon, " ", window)  
local buttonOut = QtWidgets.QPushButton(outIcon, " ", window)  
local buttonRotate = QtWidgets.QPushButton(rotateIcon, " ", window)

buttonIn:setFixedSize(80, 20)  
buttonOut:setFixedSize(80, 20)  
buttonRotate:setFixedSize(80, 20)

local buttonBox = QtWidgets.QWidget(window)  
layout = QtWidgets.QHBoxLayout()  
buttonBox:setLayout(layout)  
layout:addWidget(buttonIn, 1)  
layout:addWidget(buttonOut, 1)  
layout:addWidget(buttonRotate, 1)

buttonBox:setMinimumWidth(window:width())  
buttonBox:setMinimumHeight(25)

local frame = QtWidgets.QFrame.new(window)  
frameWidth = window:width()  
frameHeight = window:height() - 30  
frame:setMinimumWidth(frameWidth)  
frame:setMinimumHeight(frameHeight)  
frame:setFrameRect(QtCore.QRect(0, 30, frameWidth, frameHeight))

– rawset(\_G, ‘SIGNAL’, function(s) return ‘2’ … s end)  
– rawset(\_G, ‘SLOT’, function (s) return ‘1’ … s end)

–frame:\_\_addslot(‘handler()’, function(event)  
–local pos = event:pos()  
–print(event:type())  
–print(pos:x()…" "…pos:y())  
– print(’\*\*\*\*\*\*’)  
–end)  
–frame.connect(buttonIn, SIGNAL ‘clicked()’, frame, SLOT ‘handler()’)

local scales = { 0.2, 0.3, 0.44, 0.67, 1.0, 1.5 }  
local scaleIndex = 5  
local rotationIncrement = 60  
local rotation = 0

function frame:mousePressEvent(event)  
local pos = event:pos()  
print(event:type())  
print(pos:x()…" "…pos:y())  
if (buttonIn:geometry():contains(pos)) then  
if (scaleIndex \< #scales) then  
scaleIndex = scaleIndex + 1  
end  
end  
if (buttonOut:geometry():contains(pos)) then  
if (scaleIndex \> 1) then  
scaleIndex = scaleIndex - 1  
end  
end  
if (buttonRotate:geometry():contains(pos)) then  
if (rotation + rotationIncrement \<= 180) then  
rotation = rotation + rotationIncrement  
else  
rotation = (rotation + rotationIncrement - 180) - 180  
end  
end  
frame:repaint()  
end

function round(float)  
return math.floor(float)  
end

function frame:paintEvent(event)  
local painter = QtGui.QPainter(frame)  
painter:begin(frame)  
painter:setClipRect(frame:frameRect())  
transform = QtGui.QTransform()  
transform:scale(scales[scaleIndex], scales[scaleIndex])  
transform:rotate(rotation)  
local newImage = image:transformed(transform, QtCore.TransformationMode.SmoothTransformation)  
local w = newImage:width()  
local h = newImage:height()  
local x = round((frameWidth - w)/2)  
local y = round((frameHeight - h)/2)  
painter:drawImage(QtCore.QRect(x, y, w, h), newImage)  
painter’end’  
end

window.show(window)

app.exec()[/code]

This is a screen of the script running (the sailboat has been scaled down and rotated):

[https://github.com/RhettTR/Alben/tree/master/pilot/Scale-and-Rotate/screen.jpg](https://github.com/RhettTR/Alben/tree/master/pilot/Scale-and-Rotate/screen.jpg)

I managed to make a complete stand-alone version of the script. The following is a list of all the files needed to run the script:

```auto
-rwxr-xr-x 1 meg meg 72526007 Jul 27 16:58 libQt5Core.so.5
-rwxr-xr-x 1 meg meg 124911321 Jul 27 17:10 libQt5Gui.so.5
-rwxr-xr-x 1 meg meg 99972370 Aug 1 20:11 libQt5Widgets.so.5
-rwxr-xr-x 1 meg meg 67071228 Aug 1 20:06 libQt5XcbQpa.so.5
-rwxr-xr-x 1 meg meg 518296 Jun 8 15:46 luajit
drwxrwxr-x 2 meg meg 4096 Aug 1 20:35 platforms
-rwxr-xr-x 1 meg meg 24695328 Aug 1 19:40 qtcore.so
-rwxr-xr-x 1 meg meg 22219952 Aug 1 19:48 qtgui.so
-rw-rw-r-- 1 meg meg 3228 Aug 2 11:27 qtScaleRotate.lua
-rwxr-xr-x 1 meg meg 26924912 Aug 1 19:52 qtwidgets.so
-rw-rw---- 1 meg meg 802 Aug 2 12:03 readme
-rw-rw-r-- 1 meg meg 397 Jul 31 16:38 rotate.png
-rw-rw-r-- 1 meg meg 25290 Aug 2 11:26 sailboat.png
-rw-rw-r-- 1 meg meg 960 Jul 31 16:31 zoom_in.png
-rw-rw-r-- 1 meg meg 1024 Jul 31 16:32 zoom_out.png

./platforms:
total 648
-rwxr-xr-x 1 meg meg 663377 Aug 1 20:40 libqxcb.so
```

As seen, you need a total of 8 libs. I had to change the RUNPATH of the libs with chrpath because I wanted to run them in the same directory as qtScaleRotate.lua. Or just put the libs in /usr/lib/x86\_64-linux-gnu.

The libs are big. libQt5Gui.so.5 is over 124MB. The total runs up to about 437 MB. This is much. I could not upload these files to Git (max is 25MB). That means that anyone wanting to run the script has to build qt5 and lqt on their own computer…

A VASSAL distribution is 17.1 MB (3.3.2) …

Likely not all Qt classes are needed, and libQt5Core.so, libQt5Gui.so and libQt5Widgets.so can be trimmed, but they will always be large files and its hardly appropriate to have such a huge distribution 😕

The script file and the images used can be found on [my Git](https://github.com/RhettTR/Alben/tree/master/pilot/Scale-and-Rotate).

Issues:

- For some reason the QPushButton class does not have an overridable mousePressEvent handler. The way Qt wants this to be done is with Connect. I managed to set this up (as seen by what is commented out) but it didn’t work. Instead I used buttonOut:geometry():contains(pos) in the Frame handler which is dirty but actually works ok.

- The stand-alone script only accepted PNG files … lol … but is must be because of a missing plugin or such. My regular script could of course accept JPG files.

- The binding (lqt) is not just a tool we take down from the shelf. The binding will have to be an integral part of Vassal 4. We will have to develop a custom-lqt if for no other reason because we need to remove all members/functions that in any way can read/write the host filesystem. An Android and iOS binding also has to be developed.

- Not really an issue but I was very impressed by the way Qt handles image transformations. It is just a part of the Paint. The QTransform class does it very readily. The scaling and rotation goes fast and looks good, even on my debug compile. I am sure Qt does a fantastic job in handling images.

---

<div class="post-metadata">

**Author:** ![Flint1b](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/flint1b/32/246_2.png) [@Flint1b](https://forum.vassalengine.org/u/Flint1b)\
**Post date:** [August 2, 2020, 1:44pm UTC](https://forum.vassalengine.org/t/lua/10461/30 "2020-08-02T13:44:55Z")

</div>

I know a library that can do this scaling/rotating on it’s own, and on top of that keeps the coordinates the same, i.e. you can scale/rotate the map and the counters on it as much as you want, the x/y coordinates of the map stay exactly the same, there is no need to adjust them for the scale factor.

Library is called JavaFX 😃

---

<div class="post-metadata">

**Author:** ![Rhett](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/r/85e7bf/32.png) [@Rhett](https://forum.vassalengine.org/u/Rhett)\
**Post date:** [August 3, 2020, 7:25am UTC](https://forum.vassalengine.org/t/lua/10461/31 "2020-08-03T07:25:09Z")

</div>

The conclusion must be that Qt is too heavy for Lua.

As far as I know, Qt is downloaded in modules. If you configure the repository with

```auto
 ./init-repository --module-subset=essential
```

you get the minimum number of modules to make a build. There is no way to select a subset of classes in each module to further reduce the build.

Here

[https://doc.qt.io/qt-5/qtwidgets-module.html](https://doc.qt.io/qt-5/qtwidgets-module.html)

is a list of classes in module QtWidgets. Many (most) of these classes we do not need.

One could of course say that since we have the source code we could manually delete classes. But this risks breaking the build and is a path I don’t want to go down along. As a rule, we should chose the tools and focus on the development of the application, not have to focus on the development of the tools.

We need a basic set of widgets that does that job and is bindable to Lua. The Gui of VASSAL is simple. We need a menubar, toolbars, frames and a graphics library that can draw on the screen and scale and rotate images (JPG, PNG). That’s it.

I will try to find options besides Qt, a set of light widgets. I hope you guys still express an interest in this project.

---

<div class="post-metadata">

**Author:** ![uckelman](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/uckelman/32/10020_2.png) [@uckelman](https://forum.vassalengine.org/u/uckelman)\
**Post date:** [August 3, 2020, 10:53am UTC](https://forum.vassalengine.org/t/lua/10461/32 "2020-08-03T10:53:03Z")

</div>

Thus spake Rhett:

> I will try to find options besides Qt, a set of _light_ widgets. I hope  
> you guys still express an interest in this project.

It’s been interesting to see what you’ve tried so far.

I’ll have more comments after we’ve released 3.3.3 and I have time to  
focus on V4 planning.

–  
J.

---

<div class="post-metadata">

**Author:** ![Rhett](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/r/85e7bf/32.png) [@Rhett](https://forum.vassalengine.org/u/Rhett)\
**Post date:** [August 4, 2020, 8:27pm UTC](https://forum.vassalengine.org/t/lua/10461/33 "2020-08-04T20:27:08Z")

</div>

Good news. I posted a questions at the Qt forum and got an answer.

[forum.qt.io/topic/117687/remove … ed-classes](https://forum.qt.io/topic/117687/remove-unneeded-classes)

Looks like Qt Lite will do the work.

I will get back to this soon and make new libs that may be a lot smaller. Then I can upload them and anyone can run the script.

---

<div class="post-metadata">

**Author:** ![Rhett](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/r/85e7bf/32.png) [@Rhett](https://forum.vassalengine.org/u/Rhett)\
**Post date:** [August 7, 2020, 9:15am UTC](https://forum.vassalengine.org/t/lua/10461/34 "2020-08-07T09:15:45Z")

</div>

I have now made a new build with Qt Lite. This is not another product, just a method to make smaller builds.

`export LLVM_INSTALL_DIR=/usr/lib/llvm-6.0
../qt5/config.opt
make module-qtbase`

The export is for clang (to make docs) and can be skipped.

config.opt is

`../qt5/configure \
-release \
-shared \
-opensource \
-confirm-license \
-optimize-size \
-ltcg \
-nomake examples \
-nomake tests \
-skip qtmultimedia \
-no-pch \
-no-feature-abstractbutton \
-no-feature-accessibility-atspi-bridge \
-no-feature-action \
-no-feature-alloca \
-no-feature-alloca_h \
-no-feature-alloca_malloc_h \
-no-feature-android-style-assets \
-no-feature-angle \
-no-feature-angle_d3d11_qdtd \
-no-feature-animation \
-no-feature-appstore-compliant \
-no-feature-avx2 \
-no-feature-big_codecs \
-no-feature-buttongroup \
-no-feature-c++11 \
-no-feature-c++14 \
-no-feature-c++1z \
-no-feature-c11 \
-no-feature-c99 \
-no-feature-calendarwidget \
-no-feature-checkbox \
-no-feature-clipboard \
-no-feature-clock-gettime \
-no-feature-colordialog \
-no-feature-colornames \
-no-feature-columnview \
-no-feature-combined-angle-lib \
-no-feature-combobox \
-no-feature-commandlineparser \
-no-feature-commandlinkbutton \
-no-feature-completer \
-no-feature-concurrent \
-no-feature-contextmenu \
-no-feature-cross_compile \
-no-feature-cssparser \
-no-feature-cursor \
-no-feature-cxx11_future \
-no-feature-datawidgetmapper \
-no-feature-datetimeedit \
-no-feature-datetimeparser \
-no-feature-dbus \
-no-feature-dbus-linked \
-no-feature-debug_and_release \
-no-feature-desktopservices \
-no-feature-dial \
-no-feature-dialog \
-no-feature-dialogbuttonbox \
-no-feature-direct2d \
-no-feature-direct2d1_1 \
-no-feature-direct3d11 \
-no-feature-direct3d11_1 \
-no-feature-direct3d9 \
-no-feature-directfb \
-no-feature-dirmodel \
-no-feature-dlopen \
-no-feature-dockwidget \
-no-feature-draganddrop \
-no-feature-drm_atomic \
-no-feature-dxgi \
-no-feature-dxgi1_2 \
-no-feature-dxguid \
-no-feature-effects \
-no-feature-egl \
-no-feature-egl_x11 \
-no-feature-eglfs \
-no-feature-eglfs_brcm \
-no-feature-eglfs_egldevice \
-no-feature-eglfs_gbm \
-no-feature-eglfs_mali \
-no-feature-eglfs_openwfd \
-no-feature-eglfs_rcar \
-no-feature-eglfs_viv \
-no-feature-eglfs_viv_wl \
-no-feature-eglfs_vsp2 \
-no-feature-eglfs_x11 \
-no-feature-errormessage \
-no-feature-etw \
-no-feature-evdev \
-no-feature-filedialog \
-no-feature-filesystemiterator \
-no-feature-filesystemmodel \
-no-feature-filesystemwatcher \
-no-feature-force_asserts \
-no-feature-formlayout \
-no-feature-framework \
-no-feature-fontcombobox \
-no-feature-fontconfig \
-no-feature-fontdialog \
-no-feature-fscompleter \
-no-feature-futimens \
-no-feature-futimes \
-no-feature-future \
-no-feature-gestures \
-no-feature-getauxval \
-no-feature-getentropy \
-no-feature-gif \
-no-feature-glib \
-no-feature-glibc \
-no-feature-gnu-libiconv \
-no-feature-graphicseffect \
-no-feature-graphicsview \
-no-feature-groupbox \
-no-feature-gtk3 \
-no-feature-harfbuzz \
-no-feature-ico \
-no-feature-iconv \
-no-feature-icu \
-no-feature-identityproxymodel \
-no-feature-im \
-no-feature-image_heuristic_mask \
-no-feature-image_text \
-no-feature-imageformat_bmp \
-no-feature-imageformat_ppm \
-no-feature-imageformat_xbm \
-no-feature-imageformat_xpm \
-no-feature-inotify \
-no-feature-inputdialog \
-no-feature-integrityfb \
-no-feature-integrityhid \
-no-feature-journald \
-no-feature-keysequenceedit \
-no-feature-kms \
-no-feature-lcdnumber \
-no-feature-libinput \
-no-feature-libinput-axis-api \
-no-feature-library \
-no-feature-libudev \
-no-feature-lineedit \
-no-feature-linkat \
-no-feature-linuxfb \
-no-feature-listview \
-no-feature-listwidget \
-no-feature-lttng \
-no-feature-mainwindow \
-no-feature-mdiarea \
-no-feature-messagebox \
-no-feature-mirclient \
-no-feature-movie \
-no-feature-mtdev \
-no-feature-multiprocess \
-no-feature-network \
-no-feature-opengl \
-no-feature-opengles2 \
-no-feature-opengles3 \
-no-feature-opengles31 \
-no-feature-opengles32 \
-no-feature-openvg \
-no-feature-paint_debug \
-no-feature-pdf \
-no-feature-picture \
-no-feature-pkg-config \
-no-feature-posix-libiconv \
-no-feature-posix_fallocate \
-no-feature-printer \
-no-feature-process \
-no-feature-processenvironment \
-no-feature-progressbar \
-no-feature-progressdialog \
-no-feature-qeventtransition \
-no-feature-qml-animation \
-no-feature-qml-debug \
-no-feature-qml-delegate-model \
-no-feature-qml-devtools \
-no-feature-qml-list-model \
-no-feature-qml-locale \
-no-feature-qml-network \
-no-feature-qml-preview \
-no-feature-qml-profiler \
-no-feature-qml-sequence-object \
-no-feature-qml-worker-script \
-no-feature-qml-xml-http-request \
-no-feature-quick-canvas \
-no-feature-quick-designer \
-no-feature-quick-flipable \
-no-feature-quick-gridview \
-no-feature-quick-listview \
-no-feature-quick-particles \
-no-feature-quick-path \
-no-feature-quick-pathview \
-no-feature-quick-positioners \
-no-feature-quick-repeater \
-no-feature-quick-shadereffect \
-no-feature-quick-sprite \
-no-feature-quick-tableview \
-no-feature-radiobutton \
-no-feature-reduce_exports \
-no-feature-reduce_relocations \
-no-feature-release_tools \
-no-feature-renameat2 \
-no-feature-resizehandler \
-no-feature-rpath \
-no-feature-rubberband \
-no-feature-scroller \
-no-feature-separate_debug_info \
-no-feature-sessionmanager \
-no-feature-settings \
-no-feature-sha3-fast \
-no-feature-sharedmemory \
-no-feature-shortcut \
-no-feature-simulator_and_device \
-no-feature-sizegrip \
-no-feature-slog2 \
-no-feature-sortfilterproxymodel \
-no-feature-spinbox \
-no-feature-splashscreen \
-no-feature-splitter \
-no-feature-sql \
-no-feature-sql-sqlite \
-no-feature-stack-protector-strong \
-no-feature-standarditemmodel \
-no-feature-statemachine \
-no-feature-statusbar \
-no-feature-statustip \
-no-feature-statx \
-no-feature-style-android \
-no-feature-style-fusion \
-no-feature-style-mac \
-no-feature-style-stylesheet \
-no-feature-style-windows \
-no-feature-style-windowsvista \
-no-feature-syntaxhighlighter \
-no-feature-syslog \
-no-feature-system-doubleconversion \
-no-feature-system-freetype \
-no-feature-system-harfbuzz \
-no-feature-system-pcre2 \
-no-feature-system-png \
-no-feature-system-zlib \
-no-feature-systemsemaphore \
-no-feature-systemtrayicon \
-no-feature-tabletevent \
-no-feature-tableview \
-no-feature-tablewidget \
-no-feature-testlib \
-no-feature-textbrowser \
-no-feature-textedit \
-no-feature-texthtmlparser \
-no-feature-textodfwriter \
-no-feature-texture_format_astc_experimental \
-no-feature-timezone \
-no-feature-toolbox \
-no-feature-tooltip \
-no-feature-topleveldomain \
-no-feature-translation \
-no-feature-treeview \
-no-feature-treewidget \
-no-feature-tslib \
-no-feature-tuiotouch \
-no-feature-undocommand \
-no-feature-undogroup \
-no-feature-undostack \
-no-feature-undoview \
-no-feature-validator \
-no-feature-vnc \
-no-feature-vsp2 \
-no-feature-vulkan \
-no-feature-whatsthis \
-no-feature-wheelevent \
-no-feature-wizard \
-no-feature-xcb-xinput \
-no-feature-xlib \
-no-feature-xml \
-no-feature-xmlstreamwriter \
-xcb \
-feature-xlib \
-feature-xcb-xlib \
-feature-jpeg
`

This file is the heart of Qt Lite. It defines what you skip but also (by what is not there) what is included. The file will likely be tweaked later to fit just what we need.

It is interesting to look at config.summary. It tells what is and is not there.

[code]Build type: linux-g++ (x86\_64, CPU features: mmx sse sse2)  
Compiler: gcc 7.5.0  
Configuration: use\_gold\_linker sse2 aesni sse3 ssse3 sse4\_1 sse4\_2 avx compile\_examples enable\_new\_dtags f16c largefile ltcg optimize\_size rdrnd shani x86SimdAlways shared release no-pkg-config stl  
Build options:  
Mode … release  
Optimize release build for size … yes  
Building shared libraries … yes  
Using C standard … C89  
Using C++ standard …   
Using ccache … no  
Using gold linker … yes  
Using new DTAGS … yes  
Using precompiled headers … no  
Using LTCG … yes  
Target compiler supports:  
SSE … SSE2 SSE3 SSSE3 SSE4.1 SSE4.2  
AVX … AVX  
AVX512 …   
Other x86 … AES F16C RDRAND SHA  
Intrinsics without -mXXX option … yes  
Build parts … libs tools  
Qt modules and options:  
Qt Concurrent … no  
Qt D-Bus … no  
Qt D-Bus directly linked to libdbus … no  
Qt Gui … yes  
Qt Network … no  
Qt Sql … no  
Qt Testlib … no  
Qt Widgets … yes  
Qt Xml … no  
Support enabled for:  
Using pkg-config … no  
udev … no  
Using system zlib … no  
Qt Core:  
DoubleConversion … yes  
Using system DoubleConversion … no  
GLib … no  
iconv … no  
ICU … no  
Tracing backend …   
Logging backends:  
journald … no  
syslog … no  
slog2 … no  
Using system PCRE2 … no  
Qt Network:  
getifaddrs() … yes  
IPv6 ifname … yes  
libproxy … no  
Linux AF\_NETLINK … yes  
OpenSSL … yes  
Qt directly linked to OpenSSL … no  
OpenSSL 1.1 … yes  
DTLS … yes  
SCTP … no  
Use system proxies … yes  
Qt Gui:  
Accessibility … yes  
FreeType … yes  
Using system FreeType … no  
HarfBuzz … no  
Using system HarfBuzz … no  
Fontconfig … no  
Image formats:  
GIF … no  
ICO … no  
JPEG … yes  
Using system libjpeg … no  
PNG … yes  
Using system libpng … no  
EGL … no  
OpenVG … no  
OpenGL:  
Desktop OpenGL … no  
OpenGL ES 2.0 … no  
OpenGL ES 3.0 … no  
OpenGL ES 3.1 … no  
OpenGL ES 3.2 … no  
Vulkan … no  
Session Management … no  
Features used by QPA backends:  
evdev … no  
libinput … no  
INTEGRITY HID … no  
mtdev … no  
tslib … no  
xkbcommon … yes  
X11 specific:  
XLib … yes  
XCB Xlib … yes  
EGL on X11 … no  
QPA backends:  
DirectFB … no  
EGLFS … no  
LinuxFB … no  
VNC … no  
Mir client … no  
XCB:  
Using system-provided XCB libraries … no  
XCB XKB … no  
XCB XInput … no  
Native painting (experimental) … no  
GL integrations:  
GLX Plugin … no  
EGL-X11 Plugin … no  
Qt Sql:  
SQL item models … yes  
Qt Widgets:  
GTK+ … no  
Styles …   
Qt PrintSupport:  
CUPS … no  
Qt Sql Drivers:  
DB2 (IBM) … no  
InterBase … no  
MySql … no  
OCI (Oracle) … no  
ODBC … no  
PostgreSQL … no  
SQLite2 … no  
SQLite … no  
Using system provided SQLite … no  
TDS (Sybase) … no  
Qt Testlib:  
Tester for item models … yes  
Qt QML:  
QML network support … no  
QML debugging and profiling support … no  
QML sequence object … no  
QML list model … no  
QML XML http request … no  
QML Locale … no  
QML delegate model … no  
Qt Quick:  
Direct3D 12 … no  
AnimatedImage item … no  
Canvas item … no  
Support for Qt Quick Designer … no  
Flipable item … no  
GridView item … no  
ListView item … no  
TableView item … no  
Path support … no  
PathView item … no  
Positioner items … no  
Repeater item … no  
ShaderEffect item … no  
Sprite item … no  
Qt Tools:  
QDoc … yes

Note: Also available for Linux: linux-clang linux-icc

Note: Disabling X11 Accessibility Bridge: D-Bus or AT-SPI is missing.  
[/code]

The size of the new libs are astounding.

`-rwxrwx--- 1 root vboxsf 4547600 Aug 7 00:56 libQt5Core.so.5.12.9
-rwxrwx--- 1 root vboxsf 3947432 Aug 7 01:02 libQt5Gui.so.5.12.9
-rwxrwx--- 1 root vboxsf 1946456 Aug 7 01:06 libQt5Widgets.so.5.12.9
-rwxrwx--- 1 root vboxsf 1658440 Aug 7 01:08 libQt5XcbQpa.so.5.12.9
`

libQt5Core.so.5.12.9 — 4,5 MB  
libQt5Gui.so.5.12.9 — 3,9 MB  
libQt5Widgets.so.5.12.9 — 1,9 MB  
libQt5XcbQpa.so.5.12.9 — 1,7 MB

I think I managed to reduce their size 😉

This can easily go in a distribution.

Now for the binding. I ran lqt cmake on the new build-qt5 but it produced errors. I will come back to this later.

---

<div class="post-metadata">

**Author:** ![Rhett](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/r/85e7bf/32.png) [@Rhett](https://forum.vassalengine.org/u/Rhett)\
**Post date:** [August 18, 2020, 11:17am UTC](https://forum.vassalengine.org/t/lua/10461/35 "2020-08-18T11:17:11Z")

</div>

I have now worked more with Qt Lite and have been able to make a build based on this configuration:

`../qt5/configure \
-release \
-shared \
-opensource \
-confirm-license \
-optimize-size \
-ltcg \
-make libs \
-nomake examples \
-nomake tests \
-nomake tools \
-skip qtandroidextras \
-skip qtdeclarative \
-skip qtmultimedia \
-skip qtnetworkauth \
-skip qttools \
-skip qtwinextras \
-no-pch \
-no-feature-accessibility-atspi-bridge \
-no-feature-alloca \
-no-feature-alloca_h \
-no-feature-alloca_malloc_h \
-no-feature-android-style-assets \
-no-feature-angle \
-no-feature-angle_d3d11_qdtd \
-no-feature-appstore-compliant \
-no-feature-avx2 \
-no-feature-big_codecs \
-no-feature-buttongroup \
-no-feature-c++11 \
-no-feature-c++14 \
-no-feature-c++1z \
-no-feature-c11 \
-no-feature-c99 \
-no-feature-calendarwidget \
-no-feature-checkbox \
-no-feature-clock-gettime \
-no-feature-colordialog \
-no-feature-colornames \
-no-feature-columnview \
-no-feature-combined-angle-lib \
-no-feature-combobox \
-no-feature-commandlineparser \
-no-feature-commandlinkbutton \
-no-feature-completer \
-no-feature-contextmenu \
-no-feature-cross_compile \
-no-feature-cssparser \
-no-feature-cxx11_future \
-no-feature-datawidgetmapper \
-no-feature-datetimeedit \
-no-feature-datetimeparser \
-no-feature-dbus \
-no-feature-dbus-linked \
-no-feature-debug_and_release \
-no-feature-desktopservices \
-no-feature-dial \
-no-feature-dialog \
-no-feature-dialogbuttonbox \
-no-feature-direct2d \
-no-feature-direct2d1_1 \
-no-feature-direct3d11 \
-no-feature-direct3d11_1 \
-no-feature-direct3d9 \
-no-feature-directfb \
-no-feature-dirmodel \
-no-feature-drm_atomic \
-no-feature-dxgi \
-no-feature-dxgi1_2 \
-no-feature-dxguid \
-no-feature-effects \
-no-feature-egl \
-no-feature-egl_x11 \
-no-feature-eglfs \
-no-feature-eglfs_brcm \
-no-feature-eglfs_egldevice \
-no-feature-eglfs_gbm \
-no-feature-eglfs_mali \
-no-feature-eglfs_openwfd \
-no-feature-eglfs_rcar \
-no-feature-eglfs_viv \
-no-feature-eglfs_viv_wl \
-no-feature-eglfs_vsp2 \
-no-feature-eglfs_x11 \
-no-feature-errormessage \
-no-feature-etw \
-no-feature-evdev \
-no-feature-filedialog \
-no-feature-force_asserts \
-no-feature-formlayout \
-no-feature-framework \
-no-feature-fontcombobox \
-no-feature-fontconfig \
-no-feature-fontdialog \
-no-feature-fscompleter \
-no-feature-futimens \
-no-feature-futimes \
-no-feature-getauxval \
-no-feature-getentropy \
-no-feature-gif \
-no-feature-glib \
-no-feature-glibc \
-no-feature-gnu-libiconv \
-no-feature-groupbox \
-no-feature-gtk3 \
-no-feature-harfbuzz \
-no-feature-ico \
-no-feature-iconv \
-no-feature-icu \
-no-feature-im \
-no-feature-image_heuristic_mask \
-no-feature-image_text \
-no-feature-imageformat_bmp \
-no-feature-imageformat_ppm \
-no-feature-imageformat_xbm \
-no-feature-inputdialog \
-no-feature-integrityfb \
-no-feature-integrityhid \
-no-feature-journald \
-no-feature-keysequenceedit \
-no-feature-kms \
-no-feature-lcdnumber \
-no-feature-libinput \
-no-feature-libinput-axis-api \
-no-feature-libudev \
-no-feature-lineedit \
-no-feature-linkat \
-no-feature-linuxfb \
-no-feature-listview \
-no-feature-listwidget \
-no-feature-lttng \
-no-feature-mdiarea \
-no-feature-messagebox \
-no-feature-mirclient \
-no-feature-movie \
-no-feature-mtdev \
-no-feature-network \
-no-feature-openvg \
-no-feature-paint_debug \
-no-feature-pdf \
-no-feature-picture \
-no-feature-pkg-config \
-no-feature-posix-libiconv \
-no-feature-posix_fallocate \
-no-feature-printer \
-no-feature-progressbar \
-no-feature-progressdialog \
-no-feature-radiobutton \
-no-feature-reduce_exports \
-no-feature-reduce_relocations \
-no-feature-release_tools \
-no-feature-renameat2 \
-no-feature-rpath \
-no-feature-rubberband \
-no-feature-scroller \
-no-feature-separate_debug_info \
-no-feature-sha3-fast \
-no-feature-simulator_and_device \
-no-feature-sizegrip \
-no-feature-slog2 \
-no-feature-spinbox \
-no-feature-splashscreen \
-no-feature-splitter \
-no-feature-sql \
-no-feature-sql-sqlite \
-no-feature-stack-protector-strong \
-no-feature-statustip \
-no-feature-statx \
-no-feature-style-android \
-no-feature-style-fusion \
-no-feature-style-mac \
-no-feature-style-stylesheet \
-no-feature-style-windows \
-no-feature-style-windowsvista \
-no-feature-syntaxhighlighter \
-no-feature-syslog \
-no-feature-system-doubleconversion \
-no-feature-system-freetype \
-no-feature-system-harfbuzz \
-no-feature-system-pcre2 \
-no-feature-system-png \
-no-feature-system-zlib \
-no-feature-systemtrayicon \
-no-feature-tabletevent \
-no-feature-tableview \
-no-feature-tablewidget \
-no-feature-testlib \
-no-feature-textbrowser \
-no-feature-textedit \
-no-feature-texthtmlparser \
-no-feature-textodfwriter \
-no-feature-texture_format_astc_experimental \
-no-feature-timezone \
-no-feature-toolbox \
-no-feature-tooltip \
-no-feature-topleveldomain \
-no-feature-translation \
-no-feature-treeview \
-no-feature-treewidget \
-no-feature-tslib \
-no-feature-tuiotouch \
-no-feature-undocommand \
-no-feature-undogroup \
-no-feature-undostack \
-no-feature-undoview \
-no-feature-vnc \
-no-feature-vsp2 \
-no-feature-vulkan \
-no-feature-whatsthis \
-no-feature-wizard \
-no-feature-xcb-xinput \
-no-feature-xlib \
-no-feature-xml \
-no-feature-xmlstreamwriter \
-xcb \
-feature-xlib \
-feature-xcb-xlib \
-feature-jpeg \
-feature-library \
-feature-mainwindow \
-feature-dockwidget \
-feature-draganddrop \
-feature-wheelevent \
-feature-contextmenu \
-feature-pushbutton \
-feature-menubar \
-feature-toolbar 
`

It contains a lot (most) of the classes that I can imagine VASSAL needs. The size of the release libs are still small:

libQt5Core.so.5.12.9 — 5,4 MB  
libQt5Gui.so.5.12.9 — 5,1 MB  
libQt5Widgets.so.5.12.9 — 4,5 MB  
libQt5XcbQpa.so.5.12.9 — 1,8 MB

Even if we need to modify the Qt Lite build the size of the libs will likely not change very much. These libs fit very well with a distribution. Note that the libs can also be used by C++.

I then managed to make the corresponding bindings. The size of the release binding libs are now:

qtcore.so — 17,4 MB  
qtgui.so — 19,2 MB  
qtwidgets.so — 18,5 MB

These sizes are basically acceptable, given that they in a sense replace the JAVA runtime. I had to make heavy modifications to lqt. In short this involved removing unnecessary schema-classes to an unused-folder and commenting out calls to class-members not used. These modifications do constitute what we can call custom-lqt. These modifications need to be precisely defined and automated.

Unfortunately, even if Qt Lite and custom-lqt builds, my script does not run. The reason for that is simple. Using nm -D on the libs one sees many undefined symbols. The reference to these symbols either have to be removed in the code or added to the code as need be.

This is fine, but there is a much more serious issue which I have mentioned before. Building lqt under Linux produce errors. This means that bindings to classes like QMenubar and QToolbar are not there. More specifically, the error is the parsing of C++ code to XML, which is done by the program cpptoxml.

This issue must be solved before anything else. The parser will likely run on Windows (and therefore produce all Window bindings) but as long as it doesn’t run on Linux it’s pointless.

I am in contact with the guys that have made lqt. The issue may be solved or not. I note that even if their software is 10+ years old they have never bothered to make a Linux build (and no Android build either).

If we are lucky we could find an alternative cpptoxml that works on all platforms. Nevertheless, it probably means spending weeks and months on this issue. Is this something we want to do?

lqt is not part of the official [Language Bindings](https://wiki.qt.io/Language_Bindings) of Qt. It may not be a good idea to work with a script/widget combination that is not a finished tool. As I said before, as application developers we must focus on the application, not on the tools.

So what do you guys think? Shall we invest time on lqt or find an alternative?

---

<div class="post-metadata">

**Author:** ![uckelman](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/uckelman/32/10020_2.png) [@uckelman](https://forum.vassalengine.org/u/uckelman)\
**Post date:** [August 18, 2020, 12:08pm UTC](https://forum.vassalengine.org/t/lua/10461/36 "2020-08-18T12:08:50Z")

</div>

Thus spake Rhett:

> So what do you guys think? Shall we invest time on **lqt** or find an  
> alternative?

Two things:

- I’m not in favor of Qt for the reference client. The results you’ve  
had so far don’t sound very promising. Good work on presenting the  
pitfalls.

- I’m still unconvinced by Lua. I intend to make a case for JavaScript  
when 3.3.3 is cleared away and I’ve had time to gather my notes.

–  
J.

---

<div class="post-metadata">

**Author:** ![Rhett](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/r/85e7bf/32.png) [@Rhett](https://forum.vassalengine.org/u/Rhett)\
**Post date:** [August 18, 2020, 2:57pm UTC](https://forum.vassalengine.org/t/lua/10461/37 "2020-08-18T14:57:37Z")

</div>

Fair enough. I will now cease working on this project for the time being.

I will still be mindful of any progress regarding cpptoxml but I will not spend much time on it.

A pity, because in my opinion Lua + Qt was promising.

I do not think we should give up the idea of implementing everything concerning the game itself in script and let what we may call VASSAL Core deal with what is general for all games, including

- Read/write to the host file system.
- Communication with the server.
- The Chat window and Room window.
- Logfile/UNDO functionality.
- The module editor.

Then VASSAL Game (in script) will be:

- Classes for Map, Grid, Counter, Stack, Drag and Drop, Context menu, etc.
- The counter window.

The module editor will generate not XML but script. The module editor + script classes must in themselves be enough to make simple modules. Only for more complicated features will it be necessary for the module maker to make script (not unlike today’s custom classes).

There must be a very sharp distiction between VASSAL Core and VASSAL Game. The module maker can change VASSAL Game but never VASSAL Core.

VASSAL Game will interact with VASSAL Core through a well-defined API.

---

<div class="post-metadata">

**Author:** ![Brent\_Easton](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/brent_easton/32/10_2.png) [@Brent\_Easton](https://forum.vassalengine.org/u/Brent_Easton)\
**Post date:** [August 18, 2020, 9:38pm UTC](https://forum.vassalengine.org/t/lua/10461/38 "2020-08-18T21:38:22Z")

</div>

> [@](#):
>
> - I’m not in favor of Qt for the reference client. The results you’ve  
> had so far don’t sound very promising. Good work on presenting the  
> pitfalls.

To be fair, Rhett has been investigating using the Qt supplied Lua to write the core Java client directly via calls to Qt. This is not something I would advocate and has completely different requirements to my preferred model where core Vassal is written in C++ and Lua is used just as the scripting language.

In my model, we supply our own modified version of Lua, essentially as a fully self-contained C library that would have no knowledge of Qt, or any other framework we choose. This would completely change the linking requirements for Qt. However, size of the executables and Qt run-time required to be distributed is a hotly duscussed topic in the Qt world.

> [@](#):
>
> - I’m still unconvinced by Lua. I intend to make a case for JavaScript  
> when 3.3.3 is cleared away and I’ve had time to gather my notes.

Oooh, I can’t wait for that discussion. I’m going to go out and sharpen my knives, I mean discussion points 👿

---

<div class="post-metadata">

**Author:** ![zgrose](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/z/8edcca/32.png) [@zgrose](https://forum.vassalengine.org/u/zgrose)\
**Post date:** [October 13, 2020, 3:13pm UTC](https://forum.vassalengine.org/t/lua/10461/39 "2020-10-13T15:13:44Z")

</div>

As long as VASSAL 4 publishes a well defined spec and protocol, if someone wants to code their own client in whatever framework, that should be doable. I hope VASSAL 4 focuses on being an open platform first so that any religious wars re client implementations become moot.

[Previous page](https://forum.vassalengine.org/t/lua/10461.md?page=1)
