#289 Player-2.1.0rc2: QNX Neutrino 6.2.0 compatibility bigpatch

Player (393)

I've tried to compile Player on some old embedded computer running QNX Neutrino 6.2.0 (POSIX-compatible real time UNIX system). Before I've compiled Player I had to install some additional software from QNXPUB CD (things like bash, autotools and all other popular GNU utils).
I thing this patch is REALLY WORTH TO APPLY since troubles I've met are common for people trying to compile Player on unfamiliar platforms.
My problems were:
# gcc --version
This old compiler does not accept C99 coding style, so all variables should be defined before actual code. Only libplayerc, tests and examples are affected by this issue.
2. Although g++ command is present and working well, no C++ headers (<iostream>, <fstream> and so on) nor STL headers (<map>, <vector>, <queue>, <deque> ad so on) are provided. It's not a big problem since majority of Player is C-style code wrapped by C++ classes, only few drivers had to be easily rewritten (for example, cout's and cerr's had to be replaced with Player's preffered macros: PLAYER_MSG's, PLAYER_WARN's and PLAYER_ERROR's). However, drivers that use STL internally must be disabled. Some parts of code includes STL headers not using STL at all. I've cleaned up that mess and these parts of code compiles fine now.
3. QNX's compiler is very strict about including headers. For example, strncasecmp manual page on every UNIX (including Linux) says this function is defined in strings.h so to use that on QNX C code, strings.h must be included. The same goes to bzero (also from strings.h), however manual says it's deprecated, so I've wiped out bzero's and replaced it with preffered memset()'s from regular string.h header.
4. Some things are missing in QNX. The hardest problem is with xdr_longlong_t() function: sunrpc on QNX does not provide that, however C/C++ compiler allows to use 64-bit long long type. The only solution was to port it from Linux. I guess whole 'replace' infractructure was designed for such cases, although I have no ideas how to add new things, so I've put it into dummy.c file. I know it is not the best place for such function SO I DIDN'T PUT IT INTO THE PATCH! Also configure scripts should detect if xdr_longlong_t() replacement should occur (and my patch does not fix that). Ported code looks like that:

#include <rpc/types.h>
#include <rpc/xdr.h>

typedef long long int __quad_t;
typedef __quad_t quad_t;

* XDR hyper integers
* same as xdr_u_hyper - open coded to save a proc call!
bool_t xdr_hyper (XDR *xdrs, quad_t *llp)
long int t1, t2;

if (xdrs->x_op == XDR_ENCODE)
t1 = (long) ((*llp) >> 32);
t2 = (long) (*llp);
return (XDR_PUTLONG(xdrs, &t1) && XDR_PUTLONG(xdrs, &t2));

if (xdrs->x_op == XDR_DECODE)
if (!XDR_GETLONG(xdrs, &t1) || !XDR_GETLONG(xdrs, &t2))
return FALSE;
*llp = ((quad_t) t1) << 32;
*llp |= (uint32_t) t2;
return TRUE;

if (xdrs->x_op == XDR_FREE)
return TRUE;

return FALSE;

bool_t xdr_longlong_t (XDR *xdrs, quad_t *llp)
return xdr_hyper(xdrs, llp);

Other missing things (B230400, NDFBITS, CRTSCTS, roundup(), howmany()) were easily fixed with great help from googles. There's no SA_RESTART define in QNX (and as I realised, no workaround will ever exist). SA_RESTART is used in libplayerc. Noting wrong happens (at least on QNX) if it is not in use, so #ifdef directive solves the problem.
Don't be scared by roundup()/howmany() defines in poll() replacement (replace/poll.c), these are preprocessor macros really (of course, missing in QNX) and for my patch were backported from Linux - they really looks like that.
5. libplayerc's client.c should use HAVE_POLL define to corectly choose which header to include!
6. Some "unused variables" warnings fixed in examples.

Other problems:
1. QNX does not need -lpthread linker flag for POSIX pthreads, and does not provide separate libpthread.a/.so library, POSIX threads are part of system library.
2. The same goes for -ldl, There's no libdl.a/.so, aldhough libltdl.a is present. I was able to build support for plugins, however I wasn't able to load any later compiled plugin driver!
3. playerc.pc pkg-config's helper should be generated more carefully (I had the same problem on Solaris): On some systems libplayerc-using programs should link agains some more libraries. On QNX corresponding linker flags are: -lsocket -lrpc -ljpeg -lz -lplayerutils
Strangely, -lplayerutils was also required during crosscompilig code for CRIS/ETRAX computer runnign Linux.
4. configure flags:
--disable-sicklms400 --disable-vfh --disable-erratic --disable-kartowriter --disable-festival --disable-mica2 --disable-accel_calib --disable-rcore_xbridge --disable-localbb --disable-cameracompress --without-playercc
jpeglib on QNX 6.2.0 is too old to compile fine cameracompress/camerauncompress drivers, strangely, I was able to compile support for jpeg decompression inside of libplayerc (that's why playerc.pc should have -ljpeg flag now)
5. I've read somewhere there's OpenCV port for QNX. I didn't install it so I don't know if OpenCV-requiring drivers (there are few of them) compile fine.


  • Paul Osmialowski

    Logged In: YES
    Originator: YES

    I had to fix one thing in this patch, here's the latest version.

    File Added: player-2.1.0rc2.qnx_ready.20080606.patch

  • Toby Collett

    Toby Collett - 2008-06-14

    Logged In: YES
    Originator: NO

    fixed/patches in release-2-1-patches

  • Toby Collett

    Toby Collett - 2008-06-14
    • milestone: --> Release-2.1
    • status: open --> closed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks