January 15th, 2008, 03:01 AM
Issue compiling libapreq2 on MAC OSX 10.5 Leopard PPC
porting an application from apache/mod_perl to mod_perl2 on MAC OSX 10.5 (PPC) i encountered some difficulties using the libapreq2 module. Runnning make test showed that it is not installed correctly and displayed the following error message:
/usr/bin/perl -MTest::Harness -e 'runtests(@ARGV)' version.tcookie.t params.t parsers.t error.t util.t
util.......FAILED tests 36-37
Failed 2/89 tests, 97.75% okay
Failed Test Stat Wstat Total Fail Failed List of Failed
util.t 89 2 2.25% 36-37
Failed 1/6 test scripts, 83.33% okay. 2/747 subtests failed, 99.73% okay.
make: *** [test] Error 255
make: *** [test] Error 2
make: *** [library_test] Error 2
There is but few about this error on the web. Would be great if someone knew a workaround or solution. Thanks a lot!
January 15th, 2008, 06:49 AM
January 15th, 2008, 08:04 AM
thanks, this may be useful on intels but my machine is a ppc. i set export ARCHFLAGS="-arch x86_32"
but still the same...
As only the util gives errors i will try to rearrange the application and stop using util...
btw. perl was not built with the same kernel
root# uname -a
Darwin server.somename 9.1.0 Darwin Kernel Version 9.1.0: Wed Oct 31 17:48:21 P DT 2007; root:xnu-1228.0.2~1/RELEASE_PPC Power Macintosh
root# perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
osname=darwin, osvers=9.0, archname=darwin-thread-multi-2level
uname='darwin omen.apple.com 9.0 darwin kernel version 9.0.0b5: mon sep 10 1 ...
Last edited by rayz; January 15th, 2008 at 08:09 AM.
Reason: additional info
January 15th, 2008, 07:01 PM
I installed on a Dual G5 tower, with Leopard and the default Apache 2 server:
Expanded, then cd to mod_perl-2.0.3/
Used the flags mentioned here:
But I use tcsh:
Please provide a full path to 'apxs' executable
(press Enter if you don't have it installed): /usr/sbin/apxs
sudo make install
| For details on getting started with mod_perl 2, see: |
| http://perl.apache.org/docs/2.0/user/intro/start_fast.html |
| Found a bug? File a bug report: |
| http://perl.apache.org/bugs/ |
% apachectl configtest
LoadModule perl_module libexec/apache2/mod_perl.so
% sudo apachectl restart
Pointed Safari at: http://localhost/perl-status
Embedded Perl version v5.8.8 for Apache/2.2.6 process 9148,
running since Tue Jan 15 18:49:22 2008
Compiled Registry Scripts
Symbol Table Dump
January 15th, 2008, 08:22 PM
Even better test results on a MacBook Pro with Intel processors. Same instructions used:
January 20th, 2008, 05:23 PM
First, let me acknowledge that I installed mod_perl rather than the requested libapreq. I hope I was in a really happy place that night.
Even so, there was a problem with my own install, which I only realized this weekend when I set up the registry and some of my scripts didn't work under mod-perl.
Apache::DBI wouldn't load, and this was the pertinent part of the error message in Apache's log:
Incidentally, the attempted libapreq2 build showed the same error during compilation. I understand the problem, but haven't found a solution.
On Macs, Apple uses universal binaries because they have to support several architectures. 32 and 64 bit PPC, and now 32 and 64 bit Intel processors. Here is what Apache2 looks like on Leopard:
But here is perl on the same machine:
power-mac-g5.local (~) % file /usr/sbin/httpd
/usr/sbin/httpd: Mach-O universal binary with 4 architectures
/usr/sbin/httpd (for architecture ppc7400): Mach-O executable ppc
/usr/sbin/httpd (for architecture ppc64): Mach-O 64-bit executable ppc64
/usr/sbin/httpd (for architecture i386): Mach-O executable i386
/usr/sbin/httpd (for architecture x86_64): Mach-O 64-bit executable x86_64
power-mac-g5.local (~) % file /usr/bin/perl
/usr/bin/perl: Mach-O universal binary with 2 architectures
/usr/bin/perl (for architecture ppc7400): Mach-O executable ppc
/usr/bin/perl (for architecture i386): Mach-O executable i386
Since both of my computers have 64 bit processors (one PPC and the other Intel), the OS selected a 64 bit Apache binary and launched that. CPAN's compiler flags are all set up to match the perl installation though, and since perl is 32 bit only, that's the way DBI was built. 64 bit Apache won't accept 32 bit plug-ins.
As near as I can tell, several people out there have experienced the problem, but the reported fix action of setting ARCHFLAGS made no difference for me. I'm not sure why it would either, since even if perl modules would compile as 64 bit, the native perl which would be embedded into Apache would be 32 bit still. I'm not an expert on such matters but it seems a basic incompatibility.
And so I recompiled Apache from scratch with a static perl built right in. Works great now.
March 19th, 2008, 09:38 AM
Just to be sure, did you recompile Apache as 32 bit?
I am running Leopard on Intel and running into the exact same problem.
March 19th, 2008, 10:34 AM
if you build mod_perl statically you first build the mod_perl and give it the path to the apache sources. after that you just run 'make install' in the apache directory. So perl is arranging everything for you, probably 32bitwise.
March 19th, 2008, 02:17 PM
Yeah, I did. I was never happy about it though. Others got it working, so I'm going to try again.
Originally Posted by levonb
March 19th, 2008, 02:34 PM
Compiling apache with static mod_perl doesn't seem to work for me on os x.
First, from within the mod_perl sources I do this:
perl Makefile.PL MP_USE_STATIC=1 MP_AP_PREFIX=../httpd-2.2.8 MP_AP_CONFIGURE="--with-mpm=prefork"
Then I cd to the httpd source and do:
I get the following error message after a minute of make doing its job:
ld: warning in .libs/htpasswd.o, file is not of required architecture
ld: warning in /Users/levonb/http_setup/httpd-2.2.8/srclib/pcre/.libs/libpcre.a, file is not of required architecture
Undefined symbols for architecture ppc:
"_main", referenced from:
start in crt1.10.5.o
ld: symbol(s) not found for architecture ppc
collect2: ld returned 1 exit status
lipo: can't open input file: /var/tmp//ccIL6h3n.out (No such file or directory)
make: *** [htpasswd] Error 1
make: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1
March 19th, 2008, 02:54 PM
I generally follow the instructions here: Oreilly
They are old. You won't need to do any of the patches they mention.
I've had some success building Apache 2, mod_perl2, and perl 5.10 today. Only thing is it comes out as a 32 bit binary still. I'm not sure why since I didn't set any compiler flags. I thought it would default to native architecture. Maybe Intel cheated me!
March 20th, 2008, 02:39 AM
I saw some of those errors tonight, but figured out how to avoid them. Has to do with linking to a universal binary. As near as I can figure it, the universal needs to be built as a dynamic or shared library. The platform you are building on probably won't have all the necessary architectures to link against.
I was able to compile apache and mod_perl as a static build earlier, and tonight I compiled perl 5.10 and apache2 with mod_perl2 as a shared module. It's quite easy in 32 bit form.
What I can't figure out is why the compiler and architecture flags seem to be ignored by gcc, though others claim they work. It just doesn't matter where I define them, I get a simple 386 build. The only way I got any change was in setting those flags in perl's Configure script with the -Accflags definition, but then I got errors during the compile and in the tests.
So, not a huge problem, but I have not been able to build 64 bit perl or Apache. I didn't want a universal binary, really; but I thought the natural build would have defaulted to 64 bit on this laptop. It's a Core 2 Duo processor, and Leopard supports 64 bit applications; don't know what the missing piece is.
32 bit perl and Apache builds with no errors, and that's more important to me.
warning: I write over the Apple supplied perl. Choose another prefix if you don't want to.
./Configure -de -Dprefix=/usr -Duseshrlib
configure --prefix=/usr/local/apache2 --enable-mods-shared=all
perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs
There are a few binary packages out there others created so you can just install a mod_perl enabled Apache. I prefer to mess it up myself.
perl Makefile.PL --with-apache2-apxs=/usr/local/apache2/bin/apxs
Oh, this was the quote of the day when I was researching:
Last edited by keath; March 20th, 2008 at 02:50 AM.
March 20th, 2008, 05:36 PM
Thanks for your help. I ended up giving up. I was getting some problems compiling apache. Something about not having a target to mod_perl.a
But for anyone's reference I ended up using xammp at apachefriends (sorry but not allowed to post a URL) binary distribution. They have an apache, perl 5.10 and mod_perl binary ready to go for mac os x leopard. (need to add the line 'LoadModule perl_module modules/mod_perl.so' to httpd.conf but otherwise it was 'plug n play'