[imp] Darwin / MacOS X compilation

Mike Weller imp at weller.ws
Tue Jan 7 22:08:10 PST 2003


Hi,

I'm trying to get IMP running on MacOS X 10.2 (Darwin 6.3).  IMP
requires that apache's PHP module supports mysql, imap and gettext.

I can get it to support mysql and gettext, but not imap!

I've been going insane trying to get this working. 

Here are my steps:
=================================================================
GETTEXT
=================================================================
http://mirrors.kernel.org/gnu/gettext/
 Downloaded gettext-0.11.5
# setenv LDFLAGS "-lcc_dynamic"
# ./configure --enable-shared --disable-static
# emacs config.h
  #define __USER_LABEL_PREFIX__ _

added   "const char *program_name;" to avoid unresolved symbols:
./libuniname/test-names.c
./tests/setlocale.c
./tests/tstgettext.c

# emacs intl/Makefile
 removed "-no-undefined"
  (needed to create libintl.dylib instead of libintl.a)
# make
# make install

=================================================================
IMAP library 
=================================================================
# ftp ftp.cac.washington.edu
# zcat pine4.51.tar.Z | tar -xvf -
# cd pine4.51
# ./build osx
# ln -s . include
   (otherwise php cant seem to find it)
IMAP static library created at c-client/c-client.a.  I manually created
shared dynamic library, libc-client.dylib
# cd c-client
# gcc -dynamiclib -flat_namespace -undefined suppress -install_name /usr/local/lib/libc-client.dylib -o libc-client.dylib *.o
  (actually, i wrote out the .o files in the same order "ar" used)
# cp libc-client.dylib  /usr/local/lib/libc-client.dylib

=================================================================
PHP with gettext
=================================================================
http://www.php.net
 Downloaded php-4.2.3
  (applied entropy.ch patch)...
# lynx -source http://www.entropy.ch/software/macosx/php/php-4.2.3-entropy.ch.patch > patch
# ln -s php-4.2.3 php-4.2.3-entropy.ch
# cat patch |patch -p0
   (that seems to have fixed a few things for MacOS X)
# ./configure --with-apxs --with-gettext
# emacs ext/gettext/php_gettext.h
  #define __USER_LABEL_PREFIX__ _
  (to avoid unresolved symbols that apache reports when it uses libphp4.so!
   -it was looking for libintl_gettext instead of _libintl_gettext)
# make
# make install

# ls -l /usr/libexec/httpd/libphp4.so
  (verified that file is new)
# apachectl graceful

This works!
http://mysite/horde/test.php
  shows that gettext and sql are YES.

=================================================================
PHP with gettext and imap
=================================================================
# ./configure --with-apxs --with-gettext --with-imap=/private/var/root/installs/pine4.51/ --with-imap-ssl
# make
# make install
# apachectl graceful
dyld: /usr/sbin/httpd Undefined symbols:
_checkpw

If I copy the last "gcc" command from the "make" command, and remove
"-undefined suppress", I can see that checkpw is unresolved,

nm does show that it's in there:
 # nm libphp4.so |grep -i checkpw
000ef35c T _checkpw

I looked back up in the errors, and did see this paragraph:
*** Warning: This library needs some functionality provided by -lc-client.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have.

...so, I figured maybe I needed to create a shared libc-client.dylib.

So, I decided to use libc-client.dylib instead of libc-client.a (static)
using the commands shows above (under IMAP section)...
I repeated the last "gcc" command to use libc-client.dylib instead.

Now, when I "apachectl graceful", it doesnt complain about the
checkpw symbol, but now I get:

dyld: /usr/sbin/httpd Undefined symbols:
_mm_critical
_mm_diskerror
_mm_dlog
_mm_exists
_mm_expunged
_mm_fatal
_mm_flags
_mm_list
_mm_log
_mm_login
_mm_lsub
_mm_nocritical
_mm_notify
_mm_searched
_mm_status
/usr/sbin/apachectl: line 171: 10446 Trace/BPT trap          $HTTPD -t

I did a search to find these symbols.  I managed to recreate the
libc-client.dylib to include these symbols by appending 
"../mailutil/mailutil.o" to:

# gcc -dynamiclib -flat_namespace -undefined suppress -install_name /usr/local/lib/libc-client.dylib -o libc-client.dylib *.o

Removing "-undefined suppress" and adding all the "-lssl", I confirmed that
there were NO unresolved symbols.

Now, the test!

# apachectl graceful
dyld: /usr/sbin/httpd Undefined symbols:
(1,17);0000000000000;0037777777777;,64,32;must_swap:(1,10),96,32;malloced:(1,18)=*(1,13),128,32;nstrings:(1,19)=(1,20)=r(1,20);0000000000000;0037777777777;,160,32;orig_tab:(1,21)=*(1,22)=k(1,23)=xsstring_desc:,192,32;trans_tab:(1,21),224,32;n_sysdep_strings:(1,19),256,32;orig_sysdep_tab:(1,24)=*(1,25)=k(1,26)=xssysdep_string_desc:,288,32;trans_sysdep_tab:(1,24),320,32;hash_size:(1,19),352,32;hash_tab:(1,27)=*(1,28)=k(1,19),384,32;must_swap_hash_tab:(1,10),416,32;codeset_cntr:(1,10),448,32;conv_tab:(1,29)=*(1,30)=*(1,3),480,32;plural:(1,31)=*(1,32)=xsexpression:,512,32;nplurals:(1,17),544,32;;
0000000;0037777777777;,64,32;must_swap:(1,10),96,32;malloced:(1,18)=*(1,13),128,32;nstrings:(1,19)=(1,20)=r(1,20);0000000000000;0037777777777;,160,32;orig_tab:(1,21)=*(1,22)=k(1,23)=xsstring_desc:,192,32;trans_tab:(1,21),224,32;n_sysdep_strings:(1,19),256,32;orig_sysdep_tab:(1,24)=*(1,25)=k(1,26)=xssysdep_string_desc:,288,32;trans_sysdep_tab:(1,24),320,32;/usr/sbin/apachectl: line 171:  8952 Trace/BPT trap          $HTTPD -t


I'm not really sure what to do at this point.  It seems that adding
mailutil.o damaged the dynamic library somehow.  I can use "nm",
and everything views fine.

Any suggestions would be appreciated!

-Mike


More information about the imp mailing list