#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Location
    europe
    Posts
    287
    Rep Power
    14

    Issue compiling libapreq2 on MAC OSX 10.5 Leopard PPC


    Hi,
    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
    version....ok
    cookie.....ok
    params.....ok
    parsers....ok
    error......ok
    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[2]: *** [test] Error 255
    make[1]: *** [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!
  2. #2
  3. !~ /m$/
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    May 2004
    Location
    Reno, NV
    Posts
    4,259
    Rep Power
    1810
    I haven't tried building it yet, but the response here looks helpful:
    http://use.perl.org/articles/07/11/09/2241222.shtml

    I'll give it a try tonight. I've been meaning to install mod_perl at home again after the Leopard upgrade.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Location
    europe
    Posts
    287
    Rep Power
    14
    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:
    Platform:
    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
  6. #4
  7. !~ /m$/
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    May 2004
    Location
    Reno, NV
    Posts
    4,259
    Rep Power
    1810
    I installed on a Dual G5 tower, with Leopard and the default Apache 2 server:
    power-mac-g5.local (/) % uname -a
    Darwin mark-heaths-power-mac-g5.local 9.1.0 Darwin Kernel Version 9.1.0: Wed Oct 31 17:48:21 PDT 2007; root:xnu-1228.0.2~1/RELEASE_PPC Power Macintosh powerpc PowerMac7,2 Darwin

    power-mac-g5.local (/) % perl -V
    Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
    Platform:
    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 17:17:11 pdt 2007; root:xnu-1166.6~1release_ppc power macintosh '

    power-mac-g5.local (/) % httpd -V
    Server version: Apache/2.2.6 (Unix)
    Server built: Sep 23 2007 18:07:19
    Downloaded mod_perl-2.0-current.tar.gz

    Expanded, then cd to mod_perl-2.0.3/

    Used the flags mentioned here:
    http://www.ehmac.ca/mac-ipod-help-tr...i-leopard.html
    export ARCHFLAGS='-arch i386 -arch x86_64 -arch ppc -arch ppc64'
    But I use tcsh:
    setenv ARCHFLAGS '-arch i386 -arch x86_64 -arch ppc -arch ppc64'
    perl Makefile.PL

    Please provide a full path to 'apxs' executable
    (press Enter if you don't have it installed): /usr/sbin/apxs

    [warning] mod_perl dso library will be built as mod_perl.so
    [warning] You'll need to add the following to httpd.conf:
    [warning]
    [warning] LoadModule perl_module modules/mod_perl.so
    [warning]
    [warning] depending on your build, mod_perl might not live in
    [warning] the modules/ directory.

    [warning] Check the results of
    [warning]
    [warning] $ /usr/sbin/apxs -q LIBEXECDIR
    [warning]
    [warning] and adjust the LoadModule directive accordingly.
    make
    ...
    Manifying blib/man3/mod_perl2.3pm
    Manifying blib/man3/ModPerl::Config.3pm
    Manifying blib/man3/Bundle::Apache2.3pm
    Manifying blib/man3/Apache2::Build.3pm
    Manifying blib/man3/ModPerl::CScan.3pm
    Manifying blib/man3/ModPerl::Code.3pm
    make test
    Failed Test Stat Wstat Total Fail Failed List of Failed
    -------------------------------------------------------------------------------
    t/api/server_const.t 3 1 33.33% 3
    t/modperl/pnotes.t 78 13 16.67% 23-27 49-52 75-78
    4 tests and 12 subtests skipped.
    Failed 2/236 test scripts, 99.15% okay. 14/2618 subtests failed, 99.47% okay.
    [warning] server localhost:8529 shutdown
    [ error] error running tests (please examine t/logs/error_log)
    +--------------------------------------------------------+
    | Please file a bug report: http://perl.apache.org/bugs/ |
    +--------------------------------------------------------+
    make: *** [run_tests] Error 1
    sudo make install
    Code:
    +--------------------------------------------------------------+
    |                                                              |
    | 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/                               |
    |                                                              |
    +--------------------------------------------------------------+
    Edited httpd.conf
    power-mac-g5.local (~/Desktop/mod_perl-2.0.3) % sudo bbedit /etc/apache2/httpd.conf
    Code:
    LoadModule perl_module libexec/apache2/mod_perl.so
    
    # blah
    
    PerlModule Apache2::Status
    <Location /perl-status>
      SetHandler  perl-script
      PerlHandler Apache2::Status
    </Location>
    % apachectl configtest
    Syntax OK
    % sudo apachectl restart

    Pointed Safari at: http://localhost/perl-status
    Code:
    Embedded Perl version v5.8.8 for Apache/2.2.6 process 9148,
    running since Tue Jan 15 18:49:22 2008
    Environment
    Loaded Modules
    Inheritance Tree
    ISA Tree
    Perl Configuration
    Compiled Registry Scripts
    PerlRequire'd Files
    Signal Handlers
    Symbol Table Dump
    Success
  8. #5
  9. !~ /m$/
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    May 2004
    Location
    Reno, NV
    Posts
    4,259
    Rep Power
    1810
    Even better test results on a MacBook Pro with Intel processors. Same instructions used:
    Failed Test Stat Wstat Total Fail Failed List of Failed
    -------------------------------------------------------------------------------
    t/api/server_const.t 3 1 33.33% 3
    4 tests and 6 subtests skipped.
    Failed 1/236 test scripts, 99.58% okay. 1/2617 subtests failed, 99.96% okay.
    [warning] server localhost:8529 shutdown
    [ error] error running tests (please examine t/logs/error_log)
    +--------------------------------------------------------+
    | Please file a bug report: http://perl.apache.org/bugs/ |
    +--------------------------------------------------------+
    make: *** [run_tests] Error 1
  10. #6
  11. !~ /m$/
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    May 2004
    Location
    Reno, NV
    Posts
    4,259
    Rep Power
    1810
    Ok then.

    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:
    Can't load '/Library/Perl/5.8.8/darwin-thread-multi-2level/auto/DBI/DBI.bundle' for module DBI:
    ...no matching architecture in universal wrapper
    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:
    Code:
    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
    But here is perl on the same machine:
    Code:
    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
    Boom.

    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.
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2008
    Posts
    3
    Rep Power
    0
    Just to be sure, did you recompile Apache as 32 bit?

    I am running Leopard on Intel and running into the exact same problem.
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Location
    europe
    Posts
    287
    Rep Power
    14
    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.
  16. #9
  17. !~ /m$/
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    May 2004
    Location
    Reno, NV
    Posts
    4,259
    Rep Power
    1810
    Originally Posted by levonb
    Just to be sure, did you recompile Apache as 32 bit?
    Yeah, I did. I was never happy about it though. Others got it working, so I'm going to try again.
  18. #10
  19. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2008
    Posts
    3
    Rep Power
    0
    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:

    sudo make


    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[2]: *** [htpasswd] Error 1
    make[1]: *** [all-recursive] Error 1
    make: *** [all-recursive] Error 1

    Any ideas?
  20. #11
  21. !~ /m$/
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    May 2004
    Location
    Reno, NV
    Posts
    4,259
    Rep Power
    1810
    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!
  22. #12
  23. !~ /m$/
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    May 2004
    Location
    Reno, NV
    Posts
    4,259
    Rep Power
    1810
    file is not of required architecture
    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.

    perl:
    Code:
    ./Configure -de -Dprefix=/usr -Duseshrlib
    apache2:
    Code:
    configure --prefix=/usr/local/apache2 --enable-mods-shared=all
    mod_perl:
    Code:
    perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs
    libapreq2:
    Code:
    ./configure --with-apache2-apxs=/usr/local/apache2/bin/apxs
    perl Makefile.PL --with-apache2-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.

    Oh, this was the quote of the day when I was researching:
    Nope, we build perl universal, much like README.macosx (though without the SDK stuff). Then we strip out the architecture we don't need to save space on the final hardware. We also strip out the - arch flags from Config.pm because most users only want the architecture that matches what they have.

    ------------------------------------------------------------------------ --
    Edward Moy
    Apple Computer, Inc.
    osdir.com
    Last edited by keath; March 20th, 2008 at 02:50 AM.
  24. #13
  25. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2008
    Posts
    3
    Rep Power
    0
    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'

    Cheers,
    Levon Barker

IMN logo majestic logo threadwatch logo seochat tools logo