Linux failure to compile wxString-related

Discussion of compilation configuration and issues

Re: Linux failure to compile wxString-related

Postby SWGlassPit » Wed Oct 19, 2011 10:28 pm

The biggest change was the elimination of std::string, std::stringstream, and std::fstream in favor of equivalent (or close) wxWidgets classes. For most of the string code, a simple drop-in replacement was enough. The stream-based code, however, required a bit of work, since wxWidgets has a slightly different approach to string- and file-streams.

Most of the GUI code already used wxWidgets string and stream classes, so most of the changes happened in the base code. The other major change was to make sure that every string literal in the code was wrapped in a wxT() macro.

This code should work without modification on both ASCII and Unicode builds of wxWidgets.

Most of the changes were done via regexes, so it's possible some functionality may have been disrupted. Unfortunately, unit testing won't completely cut it as most classes had changes to their interface as well as their implementation (transition all std::string and char[] arguments and return values to wxString, and the like). If there is a unit test framework that I can use to go through each class one-by-one, that would help immensely.

I do intend to keep working on this -- possibly merging in the Subversion commits from upstream over the past 6 weeks. I have some compiler warnings that need to be cleaned up, and some of my changes resulted in some ugly hacks that probably could be done better. At some point, I'd like to go back through all the string literals and pull out the ones that can be used with getText macros for localization and internationalization.

In the mean time, I need to test the build to make sure my changes didn't break anything.

I think the code should build on Windows and Mac boxes, as I didn't make any platform-dependent changes in the code.

I'd offer to submit patches to the sourceforge project, but since the changes are so massive, I decided to fork the whole project to my github until I am satisfied that full functionality is there.
SWGlassPit
 
Posts: 15
Joined: Wed Oct 19, 2011 8:56 pm

Re: Linux failure to compile wxString-related

Postby healy » Thu Oct 20, 2011 9:21 pm

Thank you. I will be able to test on Debian and Ubuntu 64 bit (amd64) platforms. This will have to wait due to lack of time at the moment, but I will let you know the outcome when I am able to test it.

Liam
healy
 
Posts: 6
Joined: Wed Nov 03, 2010 1:36 pm

Re: Linux failure to compile wxString-related

Postby jjkparker » Thu Nov 03, 2011 2:54 pm

SWGlassPit, I just tried compiling on Windows7/MSYS/GCC 4.6.1, and got this error (appears unrelated to your changes):

Code: Select all
g++ -DwxUSE_UNIX=0 -D_X86_=1 -DWIN32 -DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -D__WIN32__ -mthreads -DSTRICT  -D__WXMSW__ -D__WINDOWS__ -Wall -fno-pcc-struct-return -O2 -finline-functions -funroll-loops -fno-rtti -DNO_GCC_PRAGMA -malign-double -fexceptions -D__USE_WX280_GL__ -fexpensive-optimizations -march=pentium4  -D__USE_SPICE__ -IC:/Users/jjparker/Documents/GMAT/Build/Gmat3rdParty/cspice/include -DSKIP_DEVIL -D__USE_STC_EDITOR__
-IC:/Users/jjparker/Documents/GMAT/Build/Gmat3rdParty/wxWidgets/contrib/include -D__ENABLE_EMAIL__ -IC:/Users/jjparker/Documents/GMAT/Build/Gmat3rdParty/wxWidgets/contrib/include   -Wall `/usr/local/bin/wx-config --cppflags`     -Iinclude -Ifoundation -Ihardware -Iexecutive -Ievent -Iattitude -Ispacecraft -Iasset -Iforcemodel -Iforcemodel/harmonic -Ipropagator -Isubscriber -Icommand -Isolarsys -Ifactory -Istopcond -Iinterpreter -Iutil -Iinterpolator -Iinterface -Iparameter -Iconfigs -Iburn -Isolver -Ifunction -Icoordsystem -Imath -Iplugin -I../gui/include -I../gui/include/bitmaps -I../gui/app -I../gui/view -I../gui/output -I../gui/foundation -I../gui/subscriber -I../gui/mission  -c -o parameter/OrbitData.o parameter/OrbitData.cpp
parameter/OrbitData.cpp: In member function 'Rvector6 OrbitData::GetModKepState()':
parameter/OrbitData.cpp:466:51: error: 'KeplerianToModKeplerian' was not declared in this scope


Did you see this on Fedora?
Joel J. K. Parker
Flight dynamics engineer, GMAT team
http://gmatcentral.org
jjkparker
 
Posts: 617
Joined: Thu Jan 07, 2010 9:48 pm
Location: NASA Goddard Space Flight Center, Greenbelt, MD

Re: Linux failure to compile wxString-related

Postby SWGlassPit » Thu Nov 03, 2011 4:33 pm

I did not. I'm at the point where everything builds fine. Just tracking down random crashes and segfaults related to the changes I made.

Are you using the source tree from my GitHub account? The only thing I could think that would be causing that is something is causing the file "base/util/ModKeplerian.hpp" not to be included when that particular file is compiled.
SWGlassPit
 
Posts: 15
Joined: Wed Oct 19, 2011 8:56 pm

Re: Linux failure to compile wxString-related

Postby jjkparker » Thu Nov 03, 2011 5:00 pm

Thanks for the quick reply. I've confirmed this in the vanilla codebase also, so it looks like an MSYS/GCC-related issue.

One note of caution (that may have come too late!): we've specifically made a design decision not to require wxWidgets for building of the base code (libGmatBase), which may limit the chances of these changing making it back into the full codebase as is. If that's a concern for you, I can bring in someone more knowledgeable about that decision to flesh it out a bit more. One of the main factors is that wxWidgets isn't 64-bit compatible on the Mac, and we need the base library to operate there.

- Joel
Joel J. K. Parker
Flight dynamics engineer, GMAT team
http://gmatcentral.org
jjkparker
 
Posts: 617
Joined: Thu Jan 07, 2010 9:48 pm
Location: NASA Goddard Space Flight Center, Greenbelt, MD

Re: Linux failure to compile wxString-related

Postby SWGlassPit » Thu Nov 03, 2011 8:19 pm

Darrell mentioned that design decision to me, and I understand the rationale behind it -- it makes sense to make the base library as independent as possible from the graphics library. Unfortunately, that makes writing code that will compile against both the ANSI and the Unicode builds of wxWidgets very difficult, as the Unicode build of wxWidgets (which ships by default in fedora) uses wide characters exclusively and doesn't have transparent casting between wide and narrow string types. That makes handling the interface between the base library and the GUI messy.

There does appear to be light at the end of the tunnel, however, as the wxWidgets 3.0 release (and the current 2.9.2 build) have completely overhauled the wxString class to eliminate this problem. It appears that full OSX/Cocoa support is a milestone for the 3.0 release as well (as the deprecation of the Carbon backend seems to be the issue with Mac-64 builds).

In the meantime, I'll keep working on my straight-up wxWidgets branch, and I might explore what it would take to build GMAT against wxWidgets 3.0. If I can get that working, I'll see what it would take to get a unicode wxWidgets 2.8 build to play nicely with a std::string-based base library as well. Thanks for the help!
SWGlassPit
 
Posts: 15
Joined: Wed Oct 19, 2011 8:56 pm

Re: Linux failure to compile wxString-related

Postby shughes » Thu Nov 03, 2011 9:48 pm

My understanding is that changes to WxString in WxWidgets 3.0 will cause a lot of issues for GMAT. So, any progress you make there is greatly appreciated!
shughes
 
Posts: 443
Joined: Mon Jun 09, 2008 6:27 pm

Re: Linux failure to compile wxString-related

Postby SWGlassPit » Thu Nov 03, 2011 10:35 pm

I'd be glad to help! Currently trying to track down a tricky crashing bug in my branch -- don't know if anyone has encountered it before. When I try to view the "visualization" tab for a spacecraft, gdk kills GMAT with a "baddrawable" error when SwapBuffers() is called from the rendering code. Can't really figure out if the problem is in the GMAT code or if it's just something in my particular GTK/OpenGL/MESA/DRI combination that is weird (who knows with this GNOME 3 stuff...). If anyone's seen that one before, any hints you can throw my way are appreciated -- otherwise, I'll keep plugging away :-)
SWGlassPit
 
Posts: 15
Joined: Wed Oct 19, 2011 8:56 pm

Re: Linux failure to compile wxString-related

Postby jjkparker » Fri Nov 04, 2011 11:44 am

What would help you out the most? For build/test, I have access to a variety of Windows machines with GCC and VS2010, plus a Mac64 machine. I could also do a VM of any 32-bit variety of Linux pretty easily.
Joel J. K. Parker
Flight dynamics engineer, GMAT team
http://gmatcentral.org
jjkparker
 
Posts: 617
Joined: Thu Jan 07, 2010 9:48 pm
Location: NASA Goddard Space Flight Center, Greenbelt, MD

Re: Linux failure to compile wxString-related

Postby SWGlassPit » Fri Nov 04, 2011 2:49 pm

Let me get back to you on that -- I have some things I can still check. I was able to get other OpenGL-based code to run through the wxWidgets library, so I think the problem isn't in the backend -- that, or I'm just running into a bizarre edge case. Most likely, it's one of two things: either some of the changes I made in the wholesale sweep of things broke something in the wxGLCanvas object definition, or there's a header I changed that didn't get all of its dependent source files recompiled (testing a clean build first to rule out that option).

If I can't track it down, I may ask later for a debug comparison on a working linux build. I'll let you know if it gets that far though.

Thanks!
SWGlassPit
 
Posts: 15
Joined: Wed Oct 19, 2011 8:56 pm

PreviousNext

Return to Compiling GMAT

Who is online

Users browsing this forum: No registered users and 1 guest