I saw some posts to this list and the user list from a couple of months
ago about issues building Axis2/C on AIX.  I managed to get 1.4.0 to
build (and run) on AIX 5.3 and thought I should post my experience.

I had to make some minor code changes and I am not sure the way I got it
to build is the best (putting -D_ALL_SOURCE in CFLAGS seems like a bit
of a hack).  I tried putting define of _ALL_SOURCE in an aix specific
header file but I got into a recursive include mess and gave up ton
that.  

Also, I have never used autoconf nor automake and my boxes don't have
versions that work with the distributed configure.ac and Makefile.am
files so I am not sure how the below "todo's" should be resolved.

Versions:
Axis2/C 1.4.0
AIX 5.3
gcc 4.2.0
native ld
native make


Below are errors encountered and what I did to get around them.
########################################################################
####
make: error:
uuid_gen_unix.c:36:26: error: sys/sockio.h: No such file or directory
"fix": surrounded #include <sys/sockio.h> with #ifdef HAVE_SYS_SOCKIO_H
in ./util/src/platforms/unix/uuid_gen_unix.c:
> /opt/freeware/bin/diff -c
../axis2c-src-1.4.0.orig/util/src/platforms/unix/uuid_gen_unix.c
util/src/platforms/unix/>
*** ../axis2c-src-1.4.0.orig/util/src/platforms/unix/uuid_gen_unix.c
Wed Jan  9 21:39:33 2008
--- util/src/platforms/unix/uuid_gen_unix.c     Tue Oct 28 16:07:58 2008
***************
*** 17,22 ****
--- 17,23 ----
   */

  #include <config.h>
+ #include <platforms/axutil_platform_auto_sense.h>

  #include <sys/ioctl.h>
  #include <string.h>
***************
*** 26,42 ****
  #include <fcntl.h>
  #include <unistd.h>
  #include <sys/types.h>
- #include <sys/socket.h>
  #include <sys/time.h>

  #ifdef HAVE_LINUX_IF_H
  # include <linux/if.h>
  #else
  # ifdef HAVE_NET_IF_H
- #  include <sys/sockio.h>
  #  include <net/if.h>
  #  include <net/if_arp.h>
  # endif
  # ifdef HAVE_NET_IF_TYPES_H
  #  include <net/if_types.h>
  # endif
--- 27,45 ----
  #include <fcntl.h>
  #include <unistd.h>
  #include <sys/types.h>
  #include <sys/time.h>

+ /* these ifdefs would be better in a header file
  #ifdef HAVE_LINUX_IF_H
  # include <linux/if.h>
  #else
  # ifdef HAVE_NET_IF_H
  #  include <net/if.h>
  #  include <net/if_arp.h>
  # endif
+ # ifdef HAVE_SOCKIO_H
+ #  include <sys/sockio.h>
+ # endif
  # ifdef HAVE_NET_IF_TYPES_H
  #  include <net/if_types.h>
  # endif

todo: configure should check for existence of sys/sockio.h and set
HAVE_SYS_SOCKIO_H
########################################################################
####
make error:
In file included from uuid_gen_unix.c:37:
/usr/include/net/if_arp.h:68: error: expected specifier-qualifier-list
before 'u_short'
"fix": define _ALL_SOURCE before include of sys/types.h
add "-D_ALL_SOURCE" to CFLAGS before running configure
########################################################################
####
make error:
from uuid_gen_unix.c:50:
../../../include/platforms/unix/axutil_unix.h:119:20: error: getopt.h:
No such file or directory
make: The error code from the last command is 1.
"fix": surrounded #include <getopt.h> with #ifdef HAVE_GETOPT_H in
...util/include/platforms/unix/axutil_unix.h:
> clude/platforms/unix/axutil_unix.h
util/include/platforms/unix/axutil_unix.h
<
*** ../axis2c-src-1.4.0.orig/util/include/platforms/unix/axutil_unix.h
Sun Mar  9 23:29:37 2008
--- util/include/platforms/unix/axutil_unix.h   Tue Oct 28 12:49:18 2008
***************
*** 116,122 ****
--- 116,124 ----
  #include "axutil_uuid_gen_unix.h"   /* uuid_gen unix implementation */
  #include <netinet/tcp.h>        /* TCP_NODELAY */
  #include <utime.h>
+ #ifdef HAVE_GETOPT_H
  #include <getopt.h>
+ #endif
  #include "axutil_date_time_util_unix.h"

      /* for file access handling */

todo: configure.ac: should check for existence of sys/sockio.h and set
HAVE_GETOPT_H

########################################################################
####
make error:
gcc -DHAVE_CONFIG_H -I. -I. -I../../.. -I../../../include
-I../../../include/platforms -I../../../include/platforms/unix -g -O2
-D_ALL_SOURCE -D_LARGEFILE64_SOURCE -ansi -Wall -Werror
-Wno-implicit-function-declaration -MT thread_unix.lo -MD -MP -MF
.deps/thread_unix.Tpo -c thread_unix.c -DPIC -o .libs/thread_unix.o
cc1: warnings being treated as errors
thread_unix.c: In function 'axutil_thread_once_init':
thread_unix.c:279: warning: missing braces around initializer
thread_unix.c:279: warning: (near initialization for
'once_init.__on_word')
"fix": added -DAXIS2_AIX to CFLAGS AND changed
util/src/platforms/unix/thread_unix.c as follows:
> c/platforms/unix/thread_unix.c util/src/platforms/unix/thread_unix.c
<
*** ../axis2c-src-1.4.0.orig/util/src/platforms/unix/thread_unix.c
Wed Jan  9 21:39:33 2008
--- util/src/platforms/unix/thread_unix.c       Tue Oct 28 12:49:20 2008
***************
*** 17,22 ****
--- 17,23 ----
   */

  #include <config.h>
+ #include "platforms/axutil_platform_auto_sense.h"
  #include "axutil_thread_unix.h"

  AXIS2_EXTERN axutil_threadattr_t *AXIS2_CALL
***************
*** 273,279 ****
  axutil_thread_once_init(
      axutil_allocator_t * allocator)
  {
! #ifdef AXIS2_SOLARIS
      static const pthread_once_t once_init = { PTHREAD_ONCE_INIT };
  #else
      static const pthread_once_t once_init = PTHREAD_ONCE_INIT;
--- 274,280 ----
  axutil_thread_once_init(
      axutil_allocator_t * allocator)
  {
! #if (defined(AXIS2_SOLARIS) || defined(AXIS2_AIX))
      static const pthread_once_t once_init = { PTHREAD_ONCE_INIT };
  #else
      static const pthread_once_t once_init = PTHREAD_ONCE_INIT;

########################################################################
####
make error:
../include/platforms/unix/axutil_uuid_gen_unix.h:57: error: field
'time_last' has incomplete type
plus a bunch more
"fix": this is also fixed if _ALL_SOURCE is defined before include of
sys/types.h
added -D_ALL_SOURCE to CFLAGS before configure
########################################################################
####
make error:
cc1: warnings being treated as errors
dir_handler.c: In function
'axutil_dir_handler_list_services_or_modules_in_dir':
dir_handler.c:72: warning: passing argument 3 of 'scandir' from
incompatible pointer type
dir_handler.c: In function
'axutil_dir_handler_list_service_or_module_dirs':
dir_handler.c:212: warning: passing argument 3 of 'scandir' from
incompatible pointer type
"fix":
* added -DAXIS2_AIX to CFLAGS
* changed dir_handler.c as follows: 
> /opt/freeware/bin/diff -c
../axis2c-src-1.4.0.orig/./util/src/dir_handler.c
./util/src/dir_handler.c
*** ../axis2c-src-1.4.0.orig/./util/src/dir_handler.c   Tue Mar 18
23:31:08 2008
--- ./util/src/dir_handler.c    Tue Oct 28 12:49:19 2008
***************
*** 31,37 ****

  extern int AXIS2_ALPHASORT(
      );
! #ifdef IS_MACOSX
  int dir_select(
      struct dirent *entry);
  #else
--- 31,37 ----

  extern int AXIS2_ALPHASORT(
      );
! #if (defined IS_MACOSX || defined AXIS2_AIX )
  int dir_select(
      struct dirent *entry);
  #else
***************
*** 39,47 ****
--- 39,53 ----
      const struct dirent *entry);
  #endif

+ #ifdef AXIS2_AIX
+ int
+ file_select(
+     struct dirent *entry);
+ #else
  int
  file_select(
      const struct dirent *entry);
+ #endif

  /**
   * List the dll files in the given service or module folder path
***************
*** 321,328 ****
  }

  int
! file_select(
!     const struct dirent *entry)
  {
      /** FIXME:
        * This block of code has been sitting here doing nothing.
--- 327,337 ----
  }

  int
! #if (defined IS_MACOSX || defined AXIS2_AIX)
! file_select( struct dirent *entry)
! #else
! file_select( const struct dirent *entry)
! #endif
  {
      /** FIXME:
        * This block of code has been sitting here doing nothing.
***************
*** 346,352 ****
          return (AXIS2_FALSE);
  }

! #ifdef IS_MACOSX
  int
  dir_select(
      struct dirent *entry)
--- 355,361 ----
          return (AXIS2_FALSE);
  }

! #if (defined IS_MACOSX || defined AXIS2_AIX)
  int
  dir_select(
      struct dirent *entry)
########################################################################
####
make error:
data_handler.c: In function 'axiom_data_handler_read_from':
data_handler.c:156: error: storage size of 'stat_p' isn't known
cc1: warnings being treated as errors
data_handler.c:156: warning: unused variable 'stat_p'
file: ./axiom/src/attachments/data_handler.c
"fix": define _ALL_SOURCE before include of sys/types.h (see above)
########################################################################
####
make error: (plus many more)
In file included from
../../../util/include/platforms/unix/axutil_unix.h:116,
from ../../../util/include/platforms/axutil_platform_auto_sense.h:51,
from ../../../util/include/axutil_uuid_gen.h:24,
from om_output.c:26:
../../../util/include/platforms/unix/axutil_uuid_gen_unix.h:57: error:
field 'time_last' has incomplete type
file: .../axiom/src/om/om_output.c
"fix":
add -D_ALL_SOURCE to CFLAGS

########################################################################
####
> make install
.
.
.
Target "install-data-am" is up to date.
Target "install" is up to date.
########################################################################
####runtime linker errors:
various errors including coredumps, libs not found, unable to load libs,
*.so missing from lib, etc.
try: 
export LDFLAGS=-Wl,-brtl
./configure ...

axis2_http_server still coredumps
make is not passing LDFLAGS to linker
"fix": add -Wl,-brtl to CFLAGS before configure
todo: makefile gen should pass LDFLAGS in Makefile's
todo: my build output has a bunch of warnings from gcc about -brtl:
gcc: -brtl: linker input file unused because linking not done
gcc: unrecognized option '-brtl'

########################################################################
####
rebuild from scratch
> export AXIS2C_HOME=$HOME/axis2c
> cd
> gtar xzf axis2c-src-1.4.0.tar.gz
> cd axis2c-src-1.4.0
> patch -p1 <../axis2c-src-1.4.0-aix-patch
# patch contents is just above diff output
> export CFLAGS="-DAXIS2_AIX -D_ALL_SOURCE -Wl,-brtl"
> ./configure --prefix=${AXIS2C_HOME}
> make install
.
.
.
Target "install" is up to date.

########################################################################
####
build of samples
> export AXIS2C_HOME=$HOME/axis2c
> export LIBPATH=$LIBPATH:${AXIS2C_HOME}/lib/
> cd $HOME/axis2c-src-1.4.0/samples
> export CFLAGS="-DAXIS2_AIX -D_ALL_SOURCE -Wl,-brtl"
> ./configure --prefix=$AXIS2C_HOME
-with-axis2=${AXIS2C_HOME}/include/axis2-1.4.0
> make install
.
.
.
Target "install" is up to date.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to