WSO2 Web Services Framework/C on Mac OS X

ian.lincoln.midcoast.com's picture

I'm trying to install WSO2 WSF/C on Mac OS X for use in a perl script and running into a problem making platforms/unix

The problem and then my workaround are described below. In a nutshell the mac osx/FreeBSD section of code is not getting compiled because HAVE_GETIFADDRS is not defined.

uuid_gen_unix.c compiles with the modification below. I'm now working on digest.c ....

and digest failed because (as far as I can tell) ...

The minimal required version of openssl is now 0.9.8 while Mac OS 10.5 ships 0.9.7 something. Download and compile openssl 0.9.8k yourself and pass the compile switch --with-openssl-dir=DIR to specify the correct directory.  (see the end of the post for the details)

System Mac OS X 10.5.8 (Leopard)

Xcode 3.1.4 (the Leopard SDK)

Source code distribution...

http://dist.wso2.org/products/wsf/c/2.0.0/wso2-wsf-c-src-2.0.0.zip

configured with

WSFC_HOME=/opt/wso2/wsf_c

./configure --prefix=${WSFC_HOME}

First Error message...

make  all-recursive
Making all in src
Making all in platforms/unix
/bin/sh ../../../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../include -I../../../include/platforms -I../../../include/platforms/unix    -g -O2 -D_LARGEFILE64_SOURCE -ansi -Wall -Wno-implicit-function-declaration -D_GNU_SOURCE -Wno-long-double  -MT uuid_gen_unix.lo -MD -MP -MF .deps/uuid_gen_unix.Tpo -c -o uuid_gen_unix.lo uuid_gen_unix.c
 gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../include -I../../../include/platforms -I../../../include/platforms/unix -g -O2 -D_LARGEFILE64_SOURCE -ansi -Wall -Wno-implicit-function-declaration -D_GNU_SOURCE -Wno-long-double -MT uuid_gen_unix.lo -MD -MP -MF .deps/uuid_gen_unix.Tpo -c uuid_gen_unix.c  -fno-common -DPIC -o .libs/uuid_gen_unix.o
uuid_gen_unix.c: In function axutil_uuid_get_mac_addr:
uuid_gen_unix.c:330: error: SIOCGARP undeclared (first use in this function)
uuid_gen_unix.c:330: error: (Each undeclared identifier is reported only once
uuid_gen_unix.c:330: error: for each function it appears in.)
make[7]: *** [uuid_gen_unix.lo] Error 1
make[6]: *** [all-recursive] Error 1

Looking at the code it seems as if this something is not set quite right.

This is the else statement the begins axutil_uuid_get_mac_addr() compiling which generates the error above...

# else                          /* Solaris-ish */

/* code modified from that posted on:
 * http://forum.sun.com/jive/thread.jspa?threadID=84804&tstart=30
 */

char *AXIS2_CALL
axutil_uuid_get_mac_addr()
{

But this is the if part of that else statement (so above it compiles the solarish version instead of the MacOSX version below).


#ifdef HAVE_GETIFADDRS   /* NetBSD, MacOSX, etc... */

#ifndef max
# define        max(a,b)        ((a) > (b) ? (a) : (b))
#endif                          /* !max */

char *AXIS2_CALL
axutil_uuid_get_mac_addr(
)
{

Adding a define just before that to force the NetBSD, MacOSX version and see what happens.
# define HAVE_GETIFADDRS     /* Ian Hope Springs Eternal 12-6-2009 */

and the error is....

Making all in src
Making all in platforms/unix
/bin/sh ../../../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../include -I../../../include/platforms -I../../../include/platforms/unix    -g -O2 -D_LARGEFILE64_SOURCE -ansi -Wall -Wno-implicit-function-declaration -D_GNU_SOURCE -Wno-long-double  -MT uuid_gen_unix.lo -MD -MP -MF .deps/uuid_gen_unix.Tpo -c -o uuid_gen_unix.lo uuid_gen_unix.c
 gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../include -I../../../include/platforms -I../../../include/platforms/unix -g -O2 -D_LARGEFILE64_SOURCE -ansi -Wall -Wno-implicit-function-declaration -D_GNU_SOURCE -Wno-long-double -MT uuid_gen_unix.lo -MD -MP -MF .deps/uuid_gen_unix.Tpo -c uuid_gen_unix.c  -fno-common -DPIC -o .libs/uuid_gen_unix.o
uuid_gen_unix.c: In function axutil_uuid_get_mac_addr:
uuid_gen_unix.c:284: error: dereferencing pointer to incomplete type
uuid_gen_unix.c:286: error: dereferencing pointer to incomplete type
uuid_gen_unix.c:286: error: dereferencing pointer to incomplete type
uuid_gen_unix.c:288: error: dereferencing pointer to incomplete type

Sorry Long explantion in a plea for help building this for the Mac and getting out of this quagmire....

And I solved that problem. It was my fault I did not define HAVE_GETIFADDRS soone enough, moving it here before the $ifdef HAVE_GETIFADDRS and the compile finishes.

# define HAVE_GETIFADDRS     /* Ian Hope Springs Eternal 12-6-2009 */

 

#ifdef HAVE_GETIFADDRS

 

#include <ifaddrs.h>

 

#endif

 

Next Problem which I have not looked at yet...

digest.c: In function ‘openssl_sha256’:
digest.c:73: error: ‘SHA256_CTX’ undeclared (first use in this function)
digest.c:73: error: (Each undeclared identifier is reported only once
digest.c:73: error: for each function it appears in.)
digest.c:73: error: syntax error before ‘c’
digest.c:74: error: ‘SHA256_DIGEST_LENGTH’ undeclared (first use in this function)
digest.c:77: error: ‘c’ undeclared (first use in this function)
digest.c:74: warning: unused variable ‘md’
make[6]: *** [digest.lo] Error 1 

Found the new openssl here.

http://www.openssl.org/source/
4179422 Nov  5 17:20:01 2009 openssl-0.9.8l.tar.gz (MD5) (SHA1) (PGP sign)  [LATEST]

Straight up install with

  $ ./config
  $ make
  $ make test
  $ make install

And a straight up hack of digest.c to point to the new header files installed to /usr/local/ssl

#include </usr/local/ssl/include/openssl/sha.h>
#include </usr/local/ssl/include/openssl/md5.h>
/*
12-9-2009 Ian Adding after installing openssl-0.9.8.l from http://www.openssl.org/source/
#include <openssl/sha.h>
#include <openssl/md5.h>
*/

It made and installed without complaining.

I sure hope it works!

Ian

dongleberry.mac.com's picture

Thanks for posting this Ian. Very helpful!

Ian, I cannot thank you enough for posting this summary of how you resolved these issues. The only thing I would add, for anyone else trying to get this to compile on Snow Leopard, is that you'll have to switch to the older GCC to get this to compile without errors. Using these arguments to configure will help. ./configure --prefix=${WSFC_HOME} CC="gcc-4.0" CXX="g++-4.0" Thanks again. DB
hugo.mig.gmail.com's picture

hey guys i can't get it to

hey guys i can't get it to compile successfully i'm getting the following error PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/wsf.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20090626/wsf.so, 9): no suitable image found. Did find:\n\t/usr/lib/php/extensions/no-debug-non-zts-20090626/wsf.so: mach-o, but wrong architecture in Unknown on line 0
brad.pixilla.com's picture

HAVE_GETIFADDRS

This probably works for the HAVE_GETIFADDRS issue. ./configure 'CPPFLAGS=-DHAVE_GETIFADDRS'
leonel.urbina.softonitg.com's picture

error on MAC OS X 10.6

still stuck trying to compile this on mac .. any help guys???
library project main code
Learn Cloud
Learn
Cloud

The WSO2 Application Server is a reliable application server that can host your enterprise web applications. The WSO2 Application Server as a Service is offered in StratosLive, the WSO2 Platform as a Service. This article explains how a simple web application can be developed and deployed from Carbon Studio to the WSO2 Application Server...

Latest Webinar
Different groups within an organization need to monitor different Key Performance Indicators (KPIs) - An operations team will be interested in the response times of business services and loads of each service,..
Thursday, February 9th 2012, 09.00 AM (PST)

Thursday, February 9th 2012, 10.00 AM (GMT)