views:

480

answers:

1

Hi, I am trying to comple mod_auth_kerb for apache on mac os x 10.5.7. I get no compilation errors, but when apache tries to load it:

org.apache.httpd[95092]: httpd: Syntax error on line 160 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/mod_auth_kerb.so into server: dlopen(/usr/libexec/apache2/mod_auth_kerb.so, 10): no suitable image found. Did find:\n\t/usr/libexec/apache2/mod_auth_kerb.so: mach-o, but wrong architecture

I have tried the following in the make file:

ARCHFLAGS='-arch ppc64' CPPFLAGS = -I. -Ispnegokrb5 $(KRB5_CPPFLAGS) $(KRB4_CPPFLAGS) $(DEFS) -mpowerpc64 -mcpu=G5 -mtune=G5 -arch ppc64 LDFLAGS = $(KRB5_LDFLAGS) $(KRB4_LDFLAGS) $(LIB_resolv) -mpowerpc64 -mcpu=G5 -mtune=G5 -arch ppc64 CFLAGS = -mpowerpc64 -mcpu=G5 -mtune=G5 -arch ppc64

I have looked in these threads:

http://lists.apple.com/archives/unix-porting/2008/Mar/msg00061.html

http://objectmix.com/apache/690208-re-mod_auth_kerb-mac-os-x-10-5-client.html

I also changed this in the source:

from krb5_rc_resolve_full
to __KerberosInternal_krb5_rc_resolve_full

I cannot get apache to load it and it claims it is the wrong architecture. I think apache is 64 bit from the ground up in this version of mac server so that is probably the problem. I just don't know how to get through it.

Line 160 is a red herring in the httpd.conf file (it has ##).

I don't know how to compile it correctly and was hoping for help.

I have a G5 PPC 64.

Thank you.

EDIT:

What is odd is this:

otool -hv mod_auth_kerb.so mod_auth_kerb.so: Mach header magic cputype cpusubtype caps filetype ncmds sizeofcmds flags

MH_MAGIC_64 PPC64 ALL 0x00 BUNDLE 10 1328 NOUNDEFS DYLDLINK TWOLEVEL

So I don't know what's wrong.

I am on the PPC64 and that's what it looks like I have compiled.

+1  A: 

If i'm following the question correctly, I think you will need to build/install a cross compiling toolchain to build it from PPC to x86_64 or another non-PPC architecture, or even in some cases, PPC to PPC64 and vice-versa.

I would not advise this if you are unfamiliar with GCC, the Unix toolchain and the Darwin foundation stuff in general.

You might be able to find Darwin toolchain setups on the web. Some links in the right direction:

  1. http://lists.apple.com/archives/darwin-development/2002/Dec/msg00062.html
  2. http://ranger.befunk.com/fink/darwin-cross/
  3. http://myownlittleworld.com/miscellaneous/computers/darwin-cross-distcc.html
  4. http://www.google.com/search?q=Darwin+cross+compilation
Aiden Bell
I'm not following. If I am on the PPC, why do I need the cross compiler to compile for x86_64? Also, why would it not give me erros with -arch ppc64 if it was not "right"? Just trying to understand, not questioning your wisdom. Thanks
johnny
@Johnny your source code will compile fine, because it is correct, but the resultant object will not be of the correct architecture, that is, it will not contain the right machine code. The ELF/Mac-style object format is architecture neutral, hence it working out from the headers that the object is the wrong architecture and not attempting to run it. Read up a bit on cross compilation and architectures and it will be obvious why.
Aiden Bell
Also, if you're compiling the module from source, usually the supplied configure script will determine the correct arch (ie, 32 or 64 bit etc).
Scott Hoffman