Common Porting Issues


This page aims to catalogue issues porting programs to IRIX, and common solutions available both first and third party.

Missing Headers

Some common missing headers on more modern UNIX installations include:

  • endian.h - Defines endian byteswapping functions. Partially implemented in Libxg (Big Endian Functions Only!)
  • setenv.h - Defines setenv() (doesn't exist on IRIX)

Differences in threading

IRIX pthreads have some known differences from GNU/Linux, BSD and Solaris, which sometimes introduces incompatibilities.

CLOCK_MONOTONIC

This function sets a hardware counter unaffected by wall time (system time). IRIX has this functionality in <sys/ptimers.h>, it is called CLOCK_SGI_CYCLE.

Autoconf issues

IRIX keeps some old libraries around which should be ignored by some GNU programs and programs that assume that every library should be used.

Trying this should work:

ac_cv_lib_gen_getmntent=no \
ac_cv_lib_sun=no \
ac_cv_lib_sun_getpwnam=no \
ac_cv_lib_sun_getmntent=no \
ac_cv_lib_sun_yp_match=no \
ac_cv_lib_socket=no \
ac_cv_lib_socket_main=no \
./configure...

Dirent issues

IRIX has dirent.h but its struct doesn't name a number of types. There's two common errors seen, the first involves d_nameln. The others involve dirfd(), and d_type.

Both can be solved easily. For the first, strlen(dp->d_name) can replace the dp->d_nameln . For the other, add a define guard for #define dirfd(dp) (((DIR *) dp)->__dd_fd) for SGI systems. This exists on both GCC and MIPSPro. d_type is not as easily fixed.

err.h and __progname issues

These are common BSDisms and easily worked around. For the err.h functions, most can be replaced with fprintfs to stderr or stdout, depending on context. __progname can be determined via PATH_MAX variable assuming one knows the exact positions in the array to look for. IRIX-neweoe has examples in the grep implementation.