QT5

The place to discuss creating, porting and modifying Celestia's source code.
Avatar
Topic author
cartrite
Posts: 1978
Joined: 15.09.2005
With us: 19 years 2 months
Location: Pocono Mountains, Pennsylvania, USA Greate Grandfother from Irshava, Zakarpattia Oblast Ukraine

QT5

Post #1by cartrite » 05.05.2013, 03:08

Hi All,
It's been awhile, I know. Tough going these past few years. Hope all of you are doing ok.

Anyhow, I got interested in building Celestia again and noticed a trend towards QT4 as becoming the GUI of choice. So I downloaded. And downloaded, and downloaded. :? I must have downloaded a few gigs of files in the past few days. What I noticed was there is now a QT5 and QT4 has had it's last version. So I got MSVC2008 express, 2010 express, 2012 express, QT5.0.2, and QT4.8.4. I didn't want to attempt to build all that, not yet anyhow. Maybe someday.

To make a long story short, I downloaded QT4.8 and QT5.0.2. I downloaded QT5 first and also the latest svn version of Celestia. I was surprised and also shocked when I got 200 errors trying to build. Not sure what is going on there. Most of the errors have to do with glew.h. There are about 10 or 15 qt errors.
After a couple of days I got builds to work with QT4.8.

A few things I found along the way.
1. Using QT Creator2.7 with msvc2008 went pretty smoothly except for a link error at the end. This is what I did to celestia.pro to finally get things working.
win32 {
INCLUDEPATH += \
windows/inc/libintl \
windows/inc/libz \
windows/inc/libpng \
windows/inc/libjpeg \
windows/inc/lua-5.1 \
windows/inc/spice
win32:LIBS += "../celestia/windows/lib/x86/zlib.lib"
win32:LIBS += "../celestia/windows/lib/x86/libpng.lib"
win32:LIBS += "../celestia/windows/lib/x86/libjpeg.lib"
win32:LIBS += "../celestia/windows/lib/x86/intl.lib"
win32:LIBS += "../celestia/windows/lib/x86/lua5.1.lib"
win32:LIBS += "../celestia/windows/lib/x86/cspice.lib"
win32:LIBS += -lvfw32


For some reason, the linker could not find zlib and exited until I made the above changes.

2.I also tried QT4.8 with msvc2010. This gave me a different link error.

LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt

This turned out to be a MS problem. I had to download MSVC2010 express sp1. For some reason, there is an incompatibility between msvc2010 and 2012. Also .net may be involved.

There is also another issue with Microsoft compilers. You must build with libs compiled with the same compiler. MS tags all the code built with their compilers with _MSC_VER = xxxx version of compiler. So if someone downloads QT, make sure it is not only for your platform, but also for the compiler you are using. MSVC2008 only warns that there is a mismatch but msvc2010 throws an error. MSVC2012 probably also does that but I haven't got a build to succeed to verify.

Anyhow, hope anyone reading this may find it useful. I spent the last couple of days ripping my hair out. 8O

AHHHH. QT5. Title of the thread. I get 200 errors and almost as many warnings. Quite a mess. The version of QT5 I downloaded was compiled with the 2012 compiler so that is all I can use to build a working exe file with. A lot of API changes. I'm gonna take my time and try to port Celestia to QT5 and the C++ API changes that go with the 2012 compiler. I may also try to get it working with the 2010 compiler first. I get 200 errors with both. That way I can do one API at a time.
Small steps. Getting old. Later.

cartrite


It seems that qt5 has a header "gl2.h" that redefined a lot of what was defined in glew.h. The header "gl2.h is a new part of the QT SDK and it seems to be conflicting with glew.h.This accounts for about 85% of the errors I encountered while trying to build on the QT5 system with vc2012. The error is C2635, redefinition..........

cartrite

This is what I posted at Celestial Matters. Hope this may help all of the hapless victims :D of the aggravation that is caused by trying to build something that can't be built :wink: unless .................... :roll:

It's all good :D

cartrite
VivoBook_ASUSLaptop X712JA_S712JA Intel(R) UHD Graphics 8gb ram. Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz, 1190 Mhz, 4 Core(s), 8 Logical Processor(s) 8 GB ram. Running on Windows 11 and OpenSuse 15.4

Avatar
Topic author
cartrite
Posts: 1978
Joined: 15.09.2005
With us: 19 years 2 months
Location: Pocono Mountains, Pennsylvania, USA Greate Grandfother from Irshava, Zakarpattia Oblast Ukraine

Re: QT5

Post #2by cartrite » 11.05.2013, 12:23

Some of the above post turned out to be unnecessary. QT5 seems to treat paths differently and all that was really needed was a "../celestia" added to the LIB path. I also added this to the target path so both the target and manifest ends up in the top directory. I also made some changes to files in the qt folder due to api changes. An important note: If you install qt5 binaries, be sure to get the ones for your compiler, system, and be sure it was configured for opengl desktop. If your building, be sure to add - opengl desktop to your configure line. If not, QT will use it's new GL_ES 2 and this is incompatible with glew. As of QT5.0.2, there is no way to disable gle or gle_2 . I did get it disabled enough to compile the code, but the exacutable would not run.

I posted a patch of all the changes I did to get the code built and running at Celestial Matters and I'll post them here as well.

The file I downloaded that worked is

Code: Select all

http://download.qt-project.org/official_releases/qt/5.0/5.0.2/qt-windows-opensource-5.0.2-msvc2010_32_opengl-x86-offline.exe


Here is that patch I applied to celestia svn:

Code: Select all

Index: celestia.pro
===================================================================
--- celestia.pro   (revision 5229)
+++ celestia.pro   (working copy)
@@ -1,7 +1,7 @@
 TEMPLATE = app
 TARGET = celestia
 VERSION = 1.7.0
-DESTDIR = .
+DESTDIR = ../celestia
 OBJECTS_DIR = obj
 MOC_DIR = moc
 RCC_DIR = rcc
@@ -553,7 +553,7 @@
         windows/inc/libjpeg \
         windows/inc/lua-5.1 \
         windows/inc/spice
-    LIBS += -Lwindows/lib/x86 \
+    LIBS += -L../celestia/windows/lib/x86 \
         -lzlib \
         -llibpng \
         -llibjpeg \
@@ -725,4 +725,4 @@
     INSTALLS += target data textures lores_textures hires_textures \
     flares models shaders fonts scripts locale extras extras-standard \
     configuration desktop icon128
-}
\ No newline at end of file
+}
Index: src/celestia/qt/qtappwin.cpp
===================================================================
--- src/celestia/qt/qtappwin.cpp   (revision 5229)
+++ src/celestia/qt/qtappwin.cpp   (working copy)
@@ -726,7 +726,7 @@
             MovieCapture* movieCapture = new OggTheoraCapture();
             movieCapture->setAspectRatio(1, 1);
 #endif
-            bool ok = movieCapture->start(saveAsName.toAscii().data(),
+            bool ok = movieCapture->start(saveAsName.toLatin1().data(),
                                           videoSize.width(), videoSize.height(),
                                           frameRate);
             if (ok)
Index: src/celestia/qt/qtcelestialbrowser.cpp
===================================================================
--- src/celestia/qt/qtcelestialbrowser.cpp   (revision 5229)
+++ src/celestia/qt/qtcelestialbrowser.cpp   (working copy)
@@ -404,8 +404,9 @@
     // Clear out the results of the previous populate() call
     if (stars.size() != 0)
     {
+        beginResetModel();
         stars.clear();
-        reset();
+        endResetModel();
     }
 
     if (filteredStars.empty())
Index: src/celestia/qt/qtdeepskybrowser.cpp
===================================================================
--- src/celestia/qt/qtdeepskybrowser.cpp   (revision 5229)
+++ src/celestia/qt/qtdeepskybrowser.cpp   (working copy)
@@ -337,8 +337,9 @@
     // Clear out the results of the previous populate() call
     if (dsos.size() != 0)
     {
+        beginResetModel();
         dsos.clear();
-        reset();
+        endResetModel();
     }
 
     if (filteredDSOs.empty())
Index: src/celestia/qt/qteventfinder.cpp
===================================================================
--- src/celestia/qt/qteventfinder.cpp   (revision 5229)
+++ src/celestia/qt/qteventfinder.cpp   (working copy)
@@ -515,8 +515,9 @@
 
 void EventTableModel::setEclipses(const vector<EclipseRecord>& _eclipses)
 {
+    beginResetModel();
     eclipses = _eclipses;
-    reset();
+    endResetModel();
 }
 
 
Index: src/celestia/qt/qtmain.cpp
===================================================================
--- src/celestia/qt/qtmain.cpp   (revision 5229)
+++ src/celestia/qt/qtmain.cpp   (working copy)
@@ -73,7 +73,7 @@
 
     // By default, QString converts the const char * data into Unicode Latin-1 characters.
     // We need to change this to UTF-8 for i18n purpose.
-    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
+    QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
 
     CelestiaAppWindow window;
 
Index: src/celestia/qt/qtsolarsystembrowser.cpp
===================================================================
--- src/celestia/qt/qtsolarsystembrowser.cpp   (revision 5229)
+++ src/celestia/qt/qtsolarsystembrowser.cpp   (working copy)
@@ -136,13 +136,14 @@
     rootItem->obj = Selection();
 
     if (star != NULL)
+    beginResetModel();
     {
         rootItem->nChildren = 1;
         rootItem->children = new TreeItem*[1];
         rootItem->children[0] = createTreeItem(Selection(star), rootItem, 0);
     }
 
-    reset();
+    endResetModel();
 }
 
 
Index: src/celestia/qt/xbel.cpp
===================================================================
--- src/celestia/qt/xbel.cpp   (revision 5229)
+++ src/celestia/qt/xbel.cpp   (working copy)
@@ -25,7 +25,7 @@
 // Read an PNG image from a base64 encoded string.
 static QIcon CreateBookmarkIcon(const QString& iconBase64Data)
 {
-    QByteArray iconData = QByteArray::fromBase64(iconBase64Data.toAscii());
+    QByteArray iconData = QByteArray::fromBase64(iconBase64Data.toLatin1());
     QPixmap iconPixmap;
     iconPixmap.loadFromData(iconData, "PNG");
     return QIcon(iconPixmap);

These changes are unnecessary for using QT4 and I haven't got the chance to see if it is compatible with qt4 so only use it if you have problems with qt5.
cartrite
VivoBook_ASUSLaptop X712JA_S712JA Intel(R) UHD Graphics 8gb ram. Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz, 1190 Mhz, 4 Core(s), 8 Logical Processor(s) 8 GB ram. Running on Windows 11 and OpenSuse 15.4

Avatar
Topic author
cartrite
Posts: 1978
Joined: 15.09.2005
With us: 19 years 2 months
Location: Pocono Mountains, Pennsylvania, USA Greate Grandfother from Irshava, Zakarpattia Oblast Ukraine

Re: QT5

Post #3by cartrite » 11.05.2013, 13:06

I just did a build on QT4.8.4 and everything went well. So this patch will work with QT4. At least it does on my system.
To add, I checked the eclipse finder and browsers. They seem to be working as usual. I got no way of checking translations though. One of the changes in the patch may affect them. So far everything seems normal. Also, I did these builds with glew 1.9.0. I'm not sure what version is used in the original. I created the patch with the original glew.

cartrite
VivoBook_ASUSLaptop X712JA_S712JA Intel(R) UHD Graphics 8gb ram. Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz, 1190 Mhz, 4 Core(s), 8 Logical Processor(s) 8 GB ram. Running on Windows 11 and OpenSuse 15.4

Avatar
PlutonianEmpire M
Posts: 1374
Joined: 09.09.2004
Age: 40
With us: 20 years 2 months
Location: MinneSNOWta
Contact:

Re: QT5

Post #4by PlutonianEmpire » 12.05.2013, 01:53

Unfortunately, Celestia development has come to a complete halt, and has been for many, many months now. Only updates are the extrasolar.stc/.ssc files, to keep up with Kepler et al.

Sorry. :(
Terraformed Pluto: Now with New Horizons maps! :D

Avatar
Topic author
cartrite
Posts: 1978
Joined: 15.09.2005
With us: 19 years 2 months
Location: Pocono Mountains, Pennsylvania, USA Greate Grandfother from Irshava, Zakarpattia Oblast Ukraine

Re: QT5

Post #5by cartrite » 12.05.2013, 14:27

Yeah, I know. I've noticed this for some time now. Chris is into something different and so is Fridger. I was reading about Fridger's Celestia.Sci at Celestia Matters and also Chris's new project. This got me looking into QT and ................... Not expecting much from this. Just an exercise to familiarize myself with stuff. Maybe it will be useful to someone someday.
cartrite
VivoBook_ASUSLaptop X712JA_S712JA Intel(R) UHD Graphics 8gb ram. Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz, 1190 Mhz, 4 Core(s), 8 Logical Processor(s) 8 GB ram. Running on Windows 11 and OpenSuse 15.4


Return to “Development”