[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster] Compiling cpp client in mac osx



Hi,

Regarding the compilation:

Neither the build.properties CFLAGS or the command line worked. I shouldn't worry about this, using a include directive should work.

Regarding the msgUtil.c and gethostbyname_r:

From what I could gather __MacOSX__ should be implicitly defined. I made the following change on msgUtil:

----
#ifndef _WINDOWS /* Windows does not support the reentrant ..._r() functions */
# if defined(__sun)
# define HAVE_FUNC_GETHOSTBYNAME_R_5 /* SUN */
# elif defined(__alpha)
# define HAVE_FUNC_GETHOSTBYNAME_R_3 /* OSF1 V5.1 1885 alpha */
# elif defined(__FreeBSD__)
# define LOCAL_GETHOSTBYNAME_R /* FreeBSD */
/* this should actually work for other platforms... so long as they support pthreads
Jota -> it Does! I used it on MacOSX */
# elif defined(__MacOSX__)
# define LOCAL_GETHOSTBYNAME_R /* Mac OSX */
# elif defined(__hpux) /* with gcc 2.8 - 3.4.3 */
# else
//!!!Jota - OSX is a BSD-like system, thus defining LOCAL_GETHOSTBYNAME_R also works on OSX.
//!!!It should be react to __MacOSX__ but my system didn't acknowlegde the define.
# define HAVE_FUNC_GETHOSTBYNAME_R_6 /* Linux */
# endif
#endif
----


It compiled and worked! Thus the code for BSD also works on Mac. - results below -

cesar:~/src/xmlBlaster/src/c/util jota$ gcc -g -Wall -o msgUtil msgUtil.c helper.c -I.. -DMSG_UTIL_MAIN=1 -D__MacOSX__
cesar:~/src/xmlBlaster/src/c/util jota$ ./msgUtil
Hello 'localhost'



But xmlBlaster still has problems in the ./build process. It seems that the __MacOSX__ isn't defined. In order to compile I changed the


#  elif defined(__hpux) /* with gcc 2.8 - 3.4.3 */
#  else
#    define HAVE_FUNC_GETHOSTBYNAME_R_6 /* Linux */
#  endif
#endif

to

#  elif defined(__hpux) /* with gcc 2.8 - 3.4.3 */
#  else
#    define LOCAL_GETHOSTBYNAME_R /* Linux */
#  endif
#endif

Also, the prebind problem still exists. Unfortunately I don't have experience with the cppTasks. Can we change options in cppTasks so that the prebind doesn't get used?


In short:

- The malloc.h is in the wrong place. XmlBlaster need an include directive
- Even though the BSD code works, the __MacOSX__ doesn't seem to be defined.
- In binding phase , MacOSX uses prebind (as do the cppTasks). We need a workabout on this, maybe turn it off and using the old fashion -L/usr/lib -L/sw/lib -lsqlite -lz


Thanks, Ricardo Jota