Porting to StormOS

Introduction

Most of the time all you need to do to port an application to StormOS/Nexenta/Solaris is add a few headers and define a few missing types/functions. Other times things are a little more complicated, but usually the changes needed are minimal.

Common problems

Problem Solution
error: 'vasprintf' was not declared in this scope Include this file.
error: 'rindex' was not declared in this scope
#include <strings.h>
error: 'strcasestr' was not declared in this scope Include this file (may need slight modification).
error: 'bzero' was not declared in this scope
#include <strings.h>
ld: fatal: auxiliary filter option (-f, --auxiliary) is incompatible with building a dynamic executable remove -fno-strict-aliasing from CFLAGS
_pam_macro.h not found change to pam_appl.h
"Compiler or options invalid for pre-UNIX 03 X/Open applications and pre-2001 POSIX applications"
#define _XOPEN_SOURCE 600
warning: implicit declaration of function 'strdup'
#define _XOPEN_SOURCE 1
#define _XOPEN_SOURCE_EXTENDED 1
/usr/bin/ld: cannot find -ldemangle
apt-get install nevada-compat
ln -s usr/lib/libdemange.so.1 /usr/lib/libdemangle.so
App builds fine but segfaults on start. If running the app with LD_PRELOAD=/lib/libpthread.so works then you need to move -lpthread to the front.
error: 'struct msghdr' has no member named 'msg_flags'

error: 'struct msghdr'

error: 'struct msghdr' has no member named 'msg_controllen'

#define _XOPEN_SOURCE 1
#define _XOPEN_SOURCE_EXTENDED 1

Useful links