Some time ago I've proposed at playerstage-users that Player/Stage should
be built on SDL/SDL_net to make it more portable. It was some time after
I've ported libplayerc (1.6.5), playerv and videoplayer to MinGW. At that
time, the only problem i had to resolve was sockets usage (BSD vs
Winsock). Then new Player was released. This time porting became much
harder due to usage of xdr serialization. I had to write my own
implementation based on glibc code with usage of SDL endian-related
functions. Also I used SDL_net to replace BSD sockets in libplayerc.
Finally I've extracted these libraries from Player tree:
Then I tried to compile playerv and videoplayer using these libraries for
both Linux and Windows (using MinGW crosscompiler to build Windows
binaries). It wasn't easy, due to some nonportable nasties in Player code.
In my opinion, Player code should be cleaned a bit in some future. Some
noticable flaws are:
1. Usage of different naming styles for integer types (ie u_char, u_int,
uint, u_long and so on instead of uint8_t, uint32_t and so on). I suggest
to use only one naming style, the one proposed by stdint.h (or
SDL_types.h, but it may be not that nice). No other styles are available
in MinGW, and I guess there are more development enviroments that would
suffer from that.
2. No return values in some int-type functions - it causes a warning only,
but it looks ugly anyway.
3. Some others I don't remember now
My SDL port has unfortunately some caveats too:
1. I didn't know what to do with ___FLOAT_WORD_ORDER in XDR serialization,
finally I've set it to SDL_BYTEORDER in replace/endian.h and it should
work for most popular CPU's, but users of exotic architectures should be
warned that it may not work properly.
2. It still depends on things that may not be 100% portable, but I guess
they're available *almost* everywhere. These are:
- gettimeofday() from sys/time.h
- stdint.h (yep, SDL offers SDL_types.h instead)
- sys/param.h (for PATH_MAX only, I guess)
- limits.h (for *_MAX, LASTUNSIGNED and so on, I guess)
- g_usleep from glib in client programs (normally it was nanosleep() which
seem to be the safest sleep function in the world, unfortunately not
available on MinGW, Solaris and some other systems).
Probably SDL offers sufficient replacement for these things, but I didn't
feel that it's necessery to work them out.
Whole source tree (with Windows DLL's included) is available here:
it contains Makefiles that I've prepared.
I also have crosscompilation MinGW tree for x86 Linux suitable to unpack
in user's home directory, but it's 38MB big .bz2 image so I don't have any
suitable place to publish it. It contains SDL, SDL_net, SDL GUIlib, glib2,
gtk2, zlib, libjpeg, pango, atk, cairo, expat, fontconfig, fteetype,
gettext, lcms, libart, libexif, libpng, libiconv, tiff, xpm_nox and
I hope someone will make use of my job. I guess it may be the very first
step to SDL-based Player which would be the most portable robotic
software. SDL would cover topics like networking, endianness, threads,
types convention, shared libraries loading and very limited access to the
hardware (audio and joystick for now, other hardware access would be still
system-dependent). This woluld lead to native Player (and Stage!)
compilation for sysyems like M$ Windows (many of the students here hate
Cygwin, that makes Player hard to use during the classes!). I guess it
won't be an easy task since Player uses more libraries that may cause
portability problems: gsl, boost (wasn't good old C++ with good old STL
enough?), opencv, libgnomecanvas and so on.