Building lqt on Windows (was Re: QAbstractTableModel emit dataChanged())

82 views
Skip to first unread message

Michal Kottman

unread,
Jan 19, 2013, 9:00:25 AM1/19/13
to lqt-bi...@googlegroups.com
On 19 January 2013 11:48, luafox <in...@luafox.com> wrote:
> I would really like to try this but unfortunately I have never compiled any
> sources before (one reason for using lua...). But I think that it is not to
> complicated if you know what you have to do. What I did is download the lqt
> sources and I have also installed Qt 4.8.
>
> Would someone be so nice to give me step-by-step instructions on how to
> compile lqt? I do not even know which compilter to use (gcc or Visual
> Studio?).

Let me fire up a Windows XP virtual machine and compile the binaries
for you. But in case you or anyone reading this mailing list wants to
build the binaries from scratch, here is the guide:

1) Choose a compiler - you can either go with gcc through MinGW [1],
or Visual Studio - MinGW is free, there is also Visual Studio Express
[2], which is also free, but I did not try it.

[1] http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/mingw-get-inst-20120426/
[2] http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-for-windows-desktop#product-express-desktop-details

2) Download the appropriate build of Qt for Windows [3] - look for Qt
4.8.4, not Qt 5.0.0 which was not tested yet. I think the MinGW
package already comes with the compiler so you do not need to install
MinGW in step 1.

[3] http://qt-project.org/downloads

3) Get CMake [4], which will run the generation process, and install it.

[4] http://www.cmake.org/cmake/resources/software.html

4) Get Lua (5.1.X) from LuaBinaries [5] or LuaForWindows [6], so that
you have the necessary headers and libraries.

[5] http://luabinaries.sourceforge.net/download.html
[6] http://code.google.com/p/luaforwindows/downloads/list

5) Get lqt [7] and extract it somewhere.

[7] https://github.com/mkottman/lqt/archive/master.zip

6) Enough for dependencies, let's build the thing - fire up command
line and get to the lqt directory. The easiest way is to open it up in
Explorer, click into the address bar, replace all the text with "cmd"
and press Enter.
7) mkdir build; cd build
8) cmake-gui ..
9) CMake will fire up - click Configure and select the compiler. CMake
will then try to find Lua and Qt, and it will most probably fail - no
problem, just find the qmake.exe for Qt (QT_QMAKE_EXECUTABLE) and
point to Lua libraries and headers (LUA_LIBRARIES, LUA_INCLUDE_DIR)
10) Press configure repeatedly until no red items are left, then press Generate.
11) Run the build, either run 'mingw32-make' if using MinGW, or open
the generated Visual Studio project and build it from the IDE. Or run
'cmake --build .'
12) The DLL files generated in the build\lib directory should be
placed somewhere into Lua package.cpath, usually C:\Lua\clibs if you
use LuaForWindows and install it into C:\Lua.

Michal Kottman

unread,
Jan 19, 2013, 10:00:03 AM1/19/13
to lqt-bi...@googlegroups.com
On 19 January 2013 15:00, Michal Kottman <michal....@gmail.com> wrote:
> But in case you or anyone reading this mailing list wants to
> build the binaries from scratch, here is the guide:

I actually went through this guide, so here are my corrections:

> 2) Download the appropriate build of Qt for Windows [3] - look for Qt
> 4.8.4, not Qt 5.0.0 which was not tested yet. I think the MinGW
> package already comes with the compiler so you do not need to install
> MinGW in step 1.

Yes you do need to install MinGW in step 1, it is not bundled with Qt 4.8.4.

> 7) mkdir build; cd build

This does not work, you need to do this in two steps and name it
something other than "build":

mkdir b
cd b

luafox

unread,
Jan 20, 2013, 5:36:29 AM1/20/13
to lqt-bi...@googlegroups.com, michal....@gmail.com
Am Samstag, 19. Januar 2013 15:00:25 UTC+1 schrieb Michal Kottman:
11) Run the build, either run 'mingw32-make' if using MinGW, or open
the generated Visual Studio project and build it from the IDE. Or run
'cmake --build .'

Thank you very much, the instructions are very usefull!
I tried everything so far. Unfortunately the building process is not completing
because of the following error: "debug.prf.lib" can not be opened.

In the cmake gui it was marked red and I choose the folling path:
E:\Programs\Qt\Desktop\Qt\4.8.0\mingw\mkspecs\features\debug.prf

Also under "configure" I choose Visual Studio 2011 although I have 2012
installed but this option was missing and I was hoping that they are
compatible enough.

thanks again,
Michael

Michal Kottman

unread,
Jan 20, 2013, 7:07:45 AM1/20/13
to lqt-bi...@googlegroups.com
On 20 January 2013 11:36, luafox <in...@luafox.com> wrote:
> Am Samstag, 19. Januar 2013 15:00:25 UTC+1 schrieb Michal Kottman:
>>
>> 11) Run the build, either run 'mingw32-make' if using MinGW, or open
>> the generated Visual Studio project and build it from the IDE. Or run
>> 'cmake --build .'
>
>
> Thank you very much, the instructions are very usefull!
> I tried everything so far. Unfortunately the building process is not
> completing
> because of the following error: "debug.prf.lib" can not be opened...

I've spent several hours yesterday trying to get the libraries
compiled. The thing is that the protected-to-public trick does not
work for Visual Studio (changing the access specifier also changes the
import name, so it cannot be used). I've tried implementing
workarounds, but after few hours of testing I gave up and decided to
use MinGW Qt.

This compiled fine but failed at runtime with very strange errors.
After a long bug hunting and disassembling, I've finally found out
that I HAVE to use GCC 4.4 that the Qt libraries were compiled with,
newer compilers (I was using GCC 4.7) have slightly different ABI and
cause SIGSEGV. Since Digia acquired Qt, the pre-compiled MinGW 4.4
package is not available, I had to hunt for it in the depths of
internet, but finally I managed to compile and test the libraries, and
they run fine.

So, right now only MinGW builds work, and only with GCC 4.4, which I
can provide upon request, but I have the Lua library binaries
available for anyone. Since GitHub no longer hosts custom downloads,
here are the links to the packages:

Qt 4.7.4 - https://dl.dropbox.com/u/11514376/lqt/lqt_4.7_lfw_binaries.zip
Qt 4.8.4 with protected access -
https://dl.dropbox.com/u/11514376/lqt/lqt_4.8.4_lfw_binaries.zip

luafox

unread,
Jan 20, 2013, 9:08:30 AM1/20/13
to lqt-bi...@googlegroups.com, michal....@gmail.com
Am Sonntag, 20. Januar 2013 13:07:45 UTC+1 schrieb Michal Kottman:
On 20 January 2013 11:36, luafox <in...@luafox.com> wrote:

> Thank you very much, the instructions are very usefull!
> I tried everything so far. Unfortunately the building process is not
> completing
> because of the following error: "debug.prf.lib" can not be opened...

I've spent several hours yesterday trying to get the libraries
compiled. [...]

Wow, that was a lot of work!
 
So, right now only MinGW builds work, and only with GCC 4.4, which I
can provide upon request, but I have the Lua library binaries
available for anyone. Since GitHub no longer hosts custom downloads,
here are the links to the packages:

Qt 4.7.4 - https://dl.dropbox.com/u/11514376/lqt/lqt_4.7_lfw_binaries.zip
Qt 4.8.4 with protected access -
https://dl.dropbox.com/u/11514376/lqt/lqt_4.8.4_lfw_binaries.zip

Thanks for the binaries, I got the demo (protected test) to work now and will try to integrate this into my code.

Reply all
Reply to author
Forward
0 new messages