I am trying to compile libexplain 0.44.D001 on Solaris 9 Sparc with Sun Studio 12 and get compile errors.
These are the issues I encountered:
- First, the tarball does not contain the full files for bootstrapping like configure.ac. This makes debugging and fixing harder than necessary. I suggest adding them.
- The inclusion of sys/ptrace.h in libexplain/ptrace.h must be shielded. This is done in patch 0001-Shield-ptrace-defines.patch
- The usage of va_list needs an include of <stdarg.h> on Solaris. This is done in patch 0002-Include-stdarg.h-for-va_list.patch
- Functions defined to return void must not return anything, affecting libexplain/buffer/eio.c. This is done in patch 0003-Do-not-return-anything-in-void-functions.patch
- AI_NUMERICSERV is not defined on Solaris. This should probably be detected during configure time. This is done in 0004-Use-fallback-for-AI_NUMERICSERV.patch
- Solaris does not have O_NOFOLLOW. This is done in 0005-Solaris-does-not-have-O_NOFOLLOW.patch
- In stat struct st->mode is used instead of the correct st->st_mode. This is fixed in 0006-Fix-typo-of-stat-struct-member.patch
These are ugly hacks I needed for compilation as I didn't find a clean way for now:
- major() and minor() need header inclusions in Solaris. This is done in 0007-Need-headers-for-major-minor.patch
- For int16_t, int32_t and int64_t the include of inttypes.h is needed as for some reason ac/stdint.h does not work. This is done in 0008-inttypes.h-is-needed-for-int-_t.patch
- For mnttab access inclusion of sys/mnttab.h is necessary. This is done in 0009-Use-necessary-mnttab.h.patch
- sys/types.h is needed for size_t. This is done in 0010-Include-sys-types.h-for-size_t.patch
The patches can also be browsed at http://sourceforge.net/apps/trac/gar/browser/csw/mgar/pkg/libexplain/trunk/files
The compilation is now halting at yacc stage with some more errors I'll report separately.
If it helps I can offer an account on the buildfarm for regular Solaris compile checks.
Last things are link errors:
Undefined first referenced
symbol in file
mkdtemp libexplain/.libs/libexplain.so
unsetenv libexplain/.libs/libexplain.so
setenv libexplain/.libs/libexplain.so
strtof libexplain/.libs/libexplain.so
strtold libexplain/.libs/libexplain.so
explain_buffer_errno_ptrace libexplain/.libs/libexplain.so
explain_putchar_on_error_failed libexplain/.libs/libexplain.so
explain_putc_on_error_failed libexplain/.libs/libexplain.so
- Solaris 9 does not have functions for mkdtemp, unsetenv, setenv (only putenv), strtof and strtold.
- explain_buffer_errno_ptrace is marked static where it should probably be visible
- explain_putchar_on_error_failed and explain_putc_on_error_failed are shielded by __GNUC__ < 3 which is always false when not compiling with GCC. I suggest changing this to
#if defined(__GNUC__) && __GNUC__ < 3
I just retried with 0.45.D002. The following patches are still needed:
- 0004-Use-fallback-for-AI_NUMERICSERV.patch
- 0008-inttypes.h-is-needed-for-int-_t.patch
- 0010-Include-sys-types.h-for-size_t.patch
The following link errors remain:
Undefined first referenced
symbol in file
mkdtemp libexplain/.libs/libexplain.so
unsetenv libexplain/.libs/libexplain.so
setenv libexplain/.libs/libexplain.so
strtof libexplain/.libs/libexplain.so
strtold libexplain/.libs/libexplain.so
explain_putchar_on_error_failed libexplain/.libs/libexplain.so
explain_putc_on_error_failed libexplain/.libs/libexplain.so
The patch
0011-Make-sure-to-use-GCC-before-testing-GCC-specific-var.patch
takes care about the issue about explain_putchar_on_error_failed and explain_putc_on_error_failed are shielded by __GNUC__ < 3 which is always false when not compiling with GCC. It is now marked static only when the library is compiled with GCC.
For the remaining missing symbols there should be a check during configure time and some shielding with HAVE_* to skip wrappers for these:
- mkdtemp
- unsetenv
- setenv
- strtof
- strtold
This patch takes care of shielding the functions not available on Solaris 9:
0012-Shield-functions-not-available-on-Solaris-9-autoconf.patch
The detection code in configure.ac is still missing as I was unable to do a clean bootstrapping.
The inout for the ./configure file is in etc/configure.ac in an attempt to de-clutter the top-level directory.
If you can point me to a Solaris9 i386 iso, I could fix it all in one go.