Compilation error on linux

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Compilation error on linux

Postby Boost113 » Thu Oct 23, 2014 3:33 am

On my fedora installation when compiling the cmake build files I got the following error:
Code: Select all
/home/hhyyrylainen/Projects/newton-fork/applications/demosSandbox/sdkDemos/NewtonDemos.cpp: Jäsenfunktio ”wxMenuBar* NewtonDemos::CreateMainMenu()”:
/home/hhyyrylainen/Projects/newton-fork/applications/demosSandbox/sdkDemos/NewtonDemos.cpp:474:62: virhe: call of overloaded ”wxString(char [256])” is ambiguous
     label.Printf (wxT(" hardware mode %s"), wxString(platform));


In the file NewtonDemos.cpp around line 474 I was able to fix it by either changing
Code: Select all
#ifdef _POSIX_VER

to
Code: Select all
#ifdef __unix__

Another possible fix is adding:
Code: Select all
#elif __linux
            wxChar wPlatform[256];
            mbstowcs (wPlatform, platform, sizeof (platform));
            wxString tmp (wPlatform);
            label.Printf (wxT(" hardware mode %s"), tmp.c_str());

into the preprocessor conditional block. Which is the preferred way?
I can make a pull request for either one.
Boost113
 
Posts: 26
Joined: Thu Oct 23, 2014 3:24 am

Re: Compilation error on linux

Postby godlike » Sat Oct 25, 2014 5:23 am

I remember seeing the same error on my Ubuntu 12.04 box. On my other box with Ubuntu 14.04 it compiled just fine though.

Maybe the problem is caused by the old wxWidgets library version we have.
User avatar
godlike
 
Posts: 58
Joined: Sun Mar 16, 2014 3:48 am

Re: Compilation error on linux

Postby d.l.i.w » Sat Oct 25, 2014 5:27 am

I did a clean build with the latest revision right now and it compiled fine for me.

If you didn't compile for the first time, try a
Code: Select all
make clean all
or rerun the cmake configuration.
This can be done by deleting the build folder (you hopefully you have one) or running
Code: Select all
make rebuild_cache
.

If this doesn't help please check your wxWidgets version. The cmake project does not use the version packaged with Newton, but the version you have on your system.
You can find the exact version by running
Code: Select all
wx-config --version
.

The version packaged with Newton is 2.9.4; I tested the cmake files with exactly this version, but any 2.9.x should work.

Please check if you have the version STL API with Unicode support installed, I know these variants are rather confusing.
d.l.i.w
 
Posts: 81
Joined: Mon Sep 26, 2011 4:35 am

Re: Compilation error on linux

Postby Boost113 » Sat Oct 25, 2014 6:42 am

I checked the version with yum and I think that the package used by newton is called wxGTK (GTK2 port of the wxWidgets GUI library)
and the version I have installed is:
Code: Select all
Versio          : 2.8.12

wx-config returns the same version.

There's an another package called wxGTK3 and it's version is
Code: Select all
Versio          : 3.0.1


So I'm guessing it's the old version. Still it would be nice to be able to compile with the old version even if the actual demo is broken.
Boost113
 
Posts: 26
Joined: Thu Oct 23, 2014 3:24 am

Re: Compilation error on linux

Postby d.l.i.w » Sat Oct 25, 2014 9:02 am

Yes, wxGTK is the one used. wxGTK3 is the newer version which breaks ABI and adds support for gtk3.

For Fedora I found these packages for 2.9.5:
http://codelite.org/LiteEditor/OlderWxW ... #OlderRPMs

Maybe they are available in official repositories, too - I don't know where to search for fedora :(

You see that even 2.9.x is rather old now and 3.x seems to have only small changes, so in the long run an update will be necessary anyway (noted on my list :D ).
Unfortunately it seems that version 2.8 is still the one installed by default on many Linux systems?

Still it would be nice to be able to compile with the old version even if the actual demo is broken.

You mean compiling the library without the demos?

If you have cmake-gui installed, there is the option NEWTON_DEMOS_SANDBOX. On the command line it should be
Code: Select all
cmake -DNEWTON_DEMOS_SANDBOX:BOOL=OFF ..
(did not test).
As I reworked the cmake files lately, I'm pretty sure it does what it says :D

Alternatively, as the library is compiled before the demos, the compiled library should be in BUILD_FOLDER/libs
d.l.i.w
 
Posts: 81
Joined: Mon Sep 26, 2011 4:35 am

Re: Compilation error on linux

Postby Boost113 » Sat Oct 25, 2014 9:34 am

I tried installing the 2.9.x version from a few different rpms but it seems that cmake still wants to select the 2.8 version. Disabling the demos sandbox works fine, but it requires an extra step before compiling properly.
Boost113
 
Posts: 26
Joined: Thu Oct 23, 2014 3:24 am

Re: Compilation error on linux

Postby d.l.i.w » Sat Oct 25, 2014 12:28 pm

Boost113 wrote:but it seems that cmake still wants to select the 2.8 version.

Did you do a make rebuild_cache ?

Apart from that, cmake uses the library, that is returned by wx-config --version. If you have multiple -devel packages, you can set the one cmake should use by setting wxWidgets_CONFIG_PATH.
(Easiest way: use cmake-gui, check advanced and filter by "wxWidgets" :D )

Boost113 wrote:Disabling the demos sandbox works fine, but it requires an extra step before compiling properly.

You are the first one to comment on this. As I regularly compile all the code including the sandbox to see whether something broke - I left it compile everything.
Maybe it would be better to switch it off by default - depends on how many people start complaining that the sandbox doesn't get built any more :mrgreen:
d.l.i.w
 
Posts: 81
Joined: Mon Sep 26, 2011 4:35 am

Re: Compilation error on linux

Postby Julio Jerez » Sun Jul 12, 2015 12:34 pm

I merged tow pull request form Github,
I only saw there part that add ther time function fo OSX

I remembered you sayig something about key input on Linux?

Never mind, I did not sync, I have it all now. :mrgreen:
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Compilation error on linux

Postby d.l.i.w » Mon Jul 13, 2015 2:55 am

The other pull request (the OSX one) wasn't mine, anyway thanks for merging...

Julio Jerez wrote:I remembered you sayig something about key input on Linux?


Yes, see the changed line in
Code: Select all
NewtonDemos::GetKeyState(int key)


This querys the key state from wxWidgets directly now, so you don't need the event handlers any more (they don't work properly on Linux).
This pull request only changed this one line, but if the change works for you, you probably want to get rid of the key event handlers, m_key, m_keyMap

(the original pull request with info)
d.l.i.w
 
Posts: 81
Joined: Mon Sep 26, 2011 4:35 am


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 9 guests