Version 0.98 is used in the Sage maths project
The latest release of matplot lib is 1.0, but we can't upgrade to 1.0,
as there's a conflict of header files
/usr/include/stdlib.h:144: error: declaration of C function ‘void
swab(const char*, char*, ssize_t)’ conflicts with
/usr/include/unistd.h:496: error: previous declaration ‘void
swab(const void*, void*, ssize_t)’ here
error: command 'gcc' failed with exit status 1
Error building matplotlib package.
It appears Solaris has two different definitions of swab(). If one
reads the header files, it explains why. This is from stdlib.h, but no
doubt similar exists on unistd.h
* swab() has historically been in <stdlib.h> as delivered from AT&T
* and continues to be visible in the default compilation environment.
* As of Issue 4 of the X/Open Portability Guides, swab() was declared
* in <unistd.h>. As a result, with respect to X/Open namespace the
* swab() declaration in this header is only visible for the XPG3
#if (defined(__EXTENSIONS__) || \
(!defined(_STRICT_STDC__) && !defined(_POSIX_C_SOURCE))) && \
(!defined(_XOPEN_SOURCE) || (defined(_XPG3) && !
#if defined(_LP64) || defined(_I32LPx)
typedef long ssize_t; /* size of something in bytes or -1 */
typedef int ssize_t; /* (historical version) */
#endif /* !_SSIZE_T */
extern void swab(const char *, char *, ssize_t);
#endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
Does anyone know how to get around this? The Matplot lib developers
have added this code in version 1.0, but it does not work.
// Prevent multiple conflicting definitions of swab from stdlib.h and
#if defined(__sun) || defined(sun)
That simply does not work. You can see a bit more about this at
Does anyone know what the matplot lib developers might be doing wrong?
Clearly there is no harm in having both stdlib.h and unistd.h in the
same file, but I assume somehow they have set something which exposes
We would like to update matplot lib in Sage, but until the Solaris
issue is sorted out, it can't happen.
Any ideas, Dave ??
> Does anyone know how to get around this? The Matplot lib developers
> have added this code in version 1.0, but it does not work.
> // Prevent multiple conflicting definitions of swab from stdlib.h and
> #if defined(__sun) || defined(sun)
> #if defined(_XPG4)
> #undef _XPG4
> #if defined(_XPG3)
> #undef _XPG3
> That simply does not work. You can see a bit more about this at
I assume they have __EXTENSIONS__ (the left side of the OR) defined