How to build with Qt

C# & Javascript, actually. You can use C++ as plugin libraries or if you are prepared for a lot of headaches…

Yeah, but Unity recommends not to use Unity for what we’re doing. It’s important that everyone here understands that we’re using C++ for very good reasons.
http://answers.unity3d.com/questions/9675/is-unity-engine-written-in-monoc-or-c.html

"Unity is written in C++, with the following exceptions:

  • we expose a .NET api so that you don’t have to go trough the pain of writing your game in c++, but you can write it in Javascript or c# or boo.
  • The editor application’s UI is written in C#, using mostly the same API that we expose to game developers. (We have access to a few API’s that we don’t expose (yet), but not that many)
  • This is also the reason that the answer to the question “Can I use UnityEngine.dll in some other c# project” is always no. There is hardly any functionality in UnityEngine.dll, the only thing it does is relay your c#/javascript calls into the C++ part of Unity. Without the C++ part there is nothing. "

I’m installing the latest QtCreator v4.4.0 for Windows 64-bit today.
If possible, please use QtCreator v4.4.0 for your OS to build our code:
https://www1.qt.io/download-open-source/#section-9

I had to install ccache on my Ubuntu 16.04, because I got messages that ccache was not found during the Build All step in QtCreator.

See this article for how to install:

The build process in the code is set to use ccache for building in Qt on Linux (not if you’re running Qt on Mac or Windows). The QMAKE_CXX variables are set to use ccache with the g++ compiler.

To speed up the compilation even further, use the -j parameter. The article describes how to use the -j parameter to allow multithreaded compilation.

I got error messages during compilation because it couldn’t locate the OpenGL libraries.

/usr/bin/ld: cannot find -lGL

I didn’t have to install OpenGL on Ubuntu 16.04, as I had already installed them. To check if you have OpenGL libraries installed:

$ glxinfo | grep “OpenGL version”

If you need to install OpenGL, install mesa-utils (they aren’t installed by default on 16.04):

$ sudo apt-get install mesa-utils

To find out more about Qt and installing it on Ubuntu 14.04 and 16.04 here’s the article: Install Qt 5 on Ubuntu - Qt Wiki.

The first time building develop in Qt will take a long time on ubuntu.
Turn off your computer’s suspend after 30 minutes, etc. in power settings.
But good news - all subsequent builds will take less time.

So build the first time through: from top menu Build select Run Qmake then Build All.
And wait. Watch a movie.
For subsequent builds, clean out previous results first: Build/Clean All, Run Qmake, Build All.

Note: If you run ‘Clean All’ before your first build then you’ll get an error message, don’t worry just ‘Run Qmake’

Then when it finishes, Set up the lower left column “monitor” icon: image Select Release, and “valentina”.
Then run and test LibreFashion by clicking on the Green Triangle.

It takes about an hour or so with Windoze… subsequent builds maybe 5-10mins… depending on how much has changed.

Is there a way to just build Tape?

What’s the option to turn off the build of tests?

Add CONFIG+=noTests to the qmake settings to skip the tests.

1 Like

Thank you… that should cut the build time a bit.

I think the steps for building Tape.pro requires data that’s generated when the entire project is built.

Here is what we now require to build the code with Qt:

Qt v5.7allows us to keep support of Ubuntu 14.04 LTS.

The README.md file on the repo has been updated to reflect these changes.

A silly question - I’ve successfully built Seamly from source (on Ubuntu). Is it possible to run it without doing a make install?

@Calum do you want to run on Ubuntu? I have built from inside QtCreator and am able to run from there. Can you tell a bit more about your system configuration? It is also possible to create an account on launchpad and let them do a build with the appropriate ubuntu and Qt interface libraries so that you can install from your own personal PPA. (I have done this).

Sorry, I should have said - Mint rather than Ubuntu, though there’s probably no practical differences. Mint 17, I think.

To be honest, I couldn’t figure out how to work QtCreator, so I just build it from the commandline with qmake.

I’m just trying to make sure that my “production” copy, installed through the official PPA, doesn’t get trashed by me installing this one over it.

Unfortunately, the only two ways I have run Seamly on any linux distribution are within the QtCreator and a distribution package. Any build you do that results in packages being downloaded (using apt, apt-get, dpkg) will result in overwriting and you will need to remain vigilant and very conscious of package dependencies. This includes the “production version” (sudo add-apt-repository ppa:susan-spencer/seamly2d), the “development version” (sudo add-apt-repository ppa:susan-spencer/seamly2d-dayly-build) or my “personal version” (seamly2d-test-daily in Launchpad).

Another option would be to use one of the methods of creating a self contained image such as AppImage, Snap, Flatpak, or something similar. I have not taken the time to figure out any of these, but using one of these is the approach I believe you are looking for.

Hi @Calum! Thanks for your code contributions. It’s appreciated. We have many many users who program Python, pHp, and other interpreted or scripted languages who want to take the leap into compilation. So could you fill us in on some details?

  1. Your Mint linux OS version
  2. Do you have a beefy PC or a mini laptop, what are you running?
  3. Your Qt version – any issues installing Qt on your Mint version?
  4. You compiled C++ (gcc) using qmake at the command line – was your experience as easy as described in this article: Getting Started on the Commandline - Qt Wiki
  5. How would you like for us to test your changes?

PS - If you’re still interested in using QtCreator I can help, but given your success with qmake you may not see a need. I like it because it lets you select the detail level of errors and messages, etc. and provides project control of the environment variables, etc.

I did actually get QtCreator working - turns out the installer creates no sort of launch system, other than navigating to the bin directory and double clicking it. So that’s what I’ve been using since.

In terms of getting it running on the commandline, yes, it was pretty straightforward - between the instructions in the source and on the wiki I got it going reasonably easily.

Screenshot%20from%202019-03-17%2020-19-58

Re testing, I’ll put a note on the thread about that issue so it’s all in one place.

@callum, I am not familiar with the desktop you are using, but isn’t it possible for you to create a launch icon yourself?

Haha, yes, I have now! The cobbler’s children, you know…

2 Likes

Hello, I’m trying to build Seamly2D under Debian 10.3. I’ve checked out the latest from git, and have installed the requirements (AFAICT), but when I run qmake I get

tingo@kg-vm4:~/work/seamly2d/Seamly2D$ QT_SELECT=5 qmake "CONFIG += noTests noRunPath no_ccache noDebugSymbols" Seamly2D.pro -r
Project MESSAGE: Seamly2D.pro: Unknown GCC configuration
Reading /zs/work/seamly2d/Seamly2D/src/src.pro
 Reading /zs/work/seamly2d/Seamly2D/src/libs/libs.pro
  Reading /zs/work/seamly2d/Seamly2D/src/libs/qmuparser/qmuparser.pro
  Reading /zs/work/seamly2d/Seamly2D/src/libs/vpropertyexplorer/vpropertyexplorer.pro
  Reading /zs/work/seamly2d/Seamly2D/src/libs/ifc/ifc.pro
Project ERROR: Unknown module(s) in QT: xmlpatterns

It is likely that I’m missing a package or something, but I’m unable to figure that out. Here are the qt* packages installed on my Debian machine:

tingo@kg-vm4:~$ sudo apt list qt* --installed
Listing... Done
qt5-gtk-platformtheme/stable,now 5.11.3+dfsg1-1+deb10u3 amd64 [installed,automatic]
qt5-qmake-bin/stable,now 5.11.3+dfsg1-1+deb10u3 amd64 [installed,automatic]
qt5-qmake/stable,now 5.11.3+dfsg1-1+deb10u3 amd64 [installed,automatic]
qtbase5-dev-tools/stable,now 5.11.3+dfsg1-1+deb10u3 amd64 [installed,automatic]
qtbase5-dev/stable,now 5.11.3+dfsg1-1+deb10u3 amd64 [installed]
qtchooser/stable,now 66-2 amd64 [installed,automatic]
qtdeclarative5-dev-tools/stable,now 5.11.3-4 amd64 [installed]
qttranslations5-l10n/stable,now 5.11.3-2 all [installed,automatic]
qtxmlpatterns5-dev-tools/stable,now 5.11.3-2 amd64 [installed]

what am I missing? Thanks in advance.

2 Likes