Rst Hacks

RST using GCC

I had some issues getting RST to build using the instructions and configure script provided in the GCC subdirectory, so I'm putting a few of the hacks I made to get the thing working here in case anybody else might find them useful. Some of the issues may be due to the compiler version I'm using (gcc-4.4.3-r2) or they could be genuine bugs. I recommend you try following the directions in the README.GCC first, and then come back here if stuff doesn't work out.

First, make sure you've got all the dependencies installed, and that they've been configured correctly. The default Gentoo ebuild for wxWidgets does not compile opengl support, so you have to specify the opengl use flag.

Next, I needed to make a few modifications of some of the source files in the Tabs/ and Tools/ directories to get things to compile:

in Tabs/ConanTab.cpp, line 414

vector<vector<double>> vector = attack.spline.evaluate(t);

needs to be
vector<vector<double> > vector = attack.spline.evaluate(t);

this is due to how the C++ standard says nested templates should be parsed to differentiate them from the "»" operator. C++0x changes this, so it may not be a necissary change on your system, but it doesn't cause any problems if you do put the space in.

Tabs/MAGtab.cpp calls the Sleep(…) function, which is windows specific. I added the following block at line 32 to take care of this:

#ifndef WIN32
#define Sleep(n) usleep((n)*10)
#endif

Sleep(…) takes its arguments as miliseconds, and usleep takes microseconds (hence the times 10). usleep(…) varies between different unix versions, so YMMV on Mac OS X or other BSD's.

In the same file there were some errors having to do with overloaded operators. I broke the statements over several lines, and that seemed to do the trick. On line 291

dx = (1.0/mag)*(xd-x);

becomes
x= (xd-x);
dx = (1.0/mag)*(x);

and on line 323
setConfig(vq + vdq);

becomes
vq = vq+vdq;
setConfig(vq);

In Tools/Kinematics.cpp on line 3

#include <Math.h>

should be
#include <math.h>

Typo? Windows/Linux naming incompatibility? I'm not sure. I've tested the code to make sure everything runs as it should, and with the change it looks like it does.

In Tools/PSO.cpp some standard headers are missing. I added them around line 21:

#include <stdlib.h>
#include <cstring>

And finally, in Tools/Transform.cpp I added the following snippet around line 296:

 #ifndef WIN32
 double Vec3::norm(void) const {
     double res;
     ::norm(res,*this);
     return res;
 }
 Vec3 Vec3::normalize(void) const {
     Vec3 res;
     ::normalize(res,*this);
     return res;
 }
 #endif

If you look in Tools/Transform.h, there's a comment at line 136 mentions the code doesn't work on Ubuntu, and it has to do with namespace scope and when friend functions become defined. So the following code from the header
#ifdef WIN32
    // TODO: Does not work with Ubuntu
    double norm(void) const {
      double res;
      ::norm(res, *this);
      return res;
    }
    Vec3 normalize(void) const {
      Vec3 res;
      ::normalize(res, *this);
      return res;
    }
#endif

becomes
#ifdef WIN32
    double norm(void) const {
      double res;
      ::norm(res, *this);
      return res;
    }
    Vec3 normalize(void) const {
      Vec3 res;
      ::normalize(res, *this);
      return res;
    }
#else
double norm(void) const;
Vec3 normalize(void) const;
#endif

So that the functions Vec3::norm() and Vec3::normalize() have prototypes.

Thats it for the changes in the code. I found I needed one final change to get the configure script to run correctly. On line 68 I changed

echo -e '\t$(cc) $(CFLAGS) -o $@ $^  `wx-config --libs` `wx-config --libs gl,core,base` \n' >> $makefile

to
echo -e '\t$(cc) $(CFLAGS) -o $@ $^  `wx-config --libs` `wx-config --libs gl,core,base` -lGL -lGLU\n' >> $makefile

This just explicitly includes the openGL and GLU libraries.

With these modifications I was able to get RST compiled and running by running ./configure and make. Hope this helps!

Subscription expired — please renew

Pro account upgrade has expired for this site and the site is now locked. If you are the master administrator for this site, please renew your subscription or delete your outstanding sites or stored files, so that your account fits in the free plan.