Leopard: Perl [3] : no suitable image found for mod_perl2

Beatnik on 2007-11-08T23:46:42

Leopard doesn't come with mod_perl 2 (but it does come with apache2). The instructions on this page returned me the same error as on the page:

no suitable image found. Did find:\n\t/usr/libexec/apache2/mod_perl.so: no matching architecture in universal wrapper
I checked which architectures were being built for mod_perl.so with:
file /usr/libexec/apache2/mod_perl.so
and I got:
./src/modules/perl/mod_perl.so: Mach-O universal binary with 2 architectures
./src/modules/perl/mod_perl.so (for architecture i386):	Mach-O bundle i386
./src/modules/perl/mod_perl.so (for architecture ppc7400):	Mach-O bundle ppc
It didn't list x86_64. A quick google revealed that people have had similar problems and that adding the actual architecture was the fix. I couldn't find a quick fix for Makefile.PL but updating all Makefiles by adding -arch x86_64 seemed to fix it:
lenore:mod_perl-2.0.3 root# file ./src/modules/perl/mod_perl.so
./src/modules/perl/mod_perl.so: Mach-O universal binary with 3 architectures
./src/modules/perl/mod_perl.so (for architecture i386):	Mach-O bundle i386
./src/modules/perl/mod_perl.so (for architecture x86_64):	Mach-O 64-bit bundle x86_64
./src/modules/perl/mod_perl.so (for architecture ppc7400):	Mach-O bundle ppc

httpd -t does not return any errors.

I seem to have similar problems with Apache::Request and DBI:
Can't load '/Library/Perl/5.8.8/darwin-thread-multi-2level/auto/APR/Request/Request.bundle' for module APR::Request: dlopen(/Library/Perl/5.8.8/darwin-thread-multi-2level/auto/APR/Request/Request.bundle, 1): no suitable image found.  Did find:\n\t/Library/Perl/5.8.8/darwin-thread-multi-2level/auto/APR/Request/Request.bundle: no matching architecture in universal wrapper at /System/Library/Perl/5.8.8/darwin-thread-multi-2level/DynaLoader.pm line 230.\n at /Library/Perl/5.8.8/darwin-thread-multi-2level/APR/Request/Param.pm line 27\nCompilation failed in require at /Library/Perl/5.8.8/darwin-thread-multi-2level/APR/Request/Param.pm line 27.\nBEGIN failed--compilation aborted at /Library/Perl/5.8.8/darwin-thread-multi-2level/APR/Request/Param.pm line 27.\nCompilation failed in require at /Library/Perl/5.8.8/darwin-thread-multi-2level/Apache2/Request.pm line 2.\nBEGIN failed--compilation aborted at /Library/Perl/5.8.8/darwin-thread-multi-2level/Apache2/Request.pm line 2.\n
and
Can't load '/Library/Perl/5.8.8/darwin-thread-multi-2level/auto/DBI/DBI.bundle' for module DBI: dlopen(/Library/Perl/5.8.8/darwin-thread-multi-2level/auto/DBI/DBI.bundle, 1): no suitable image found.  Did find:\n\t/Library/Perl/5.8.8/darwin-thread-multi-2level/auto/DBI/DBI.bundle: no matching architecture in universal wrapper at /System/Library/Perl/5.8.8/darwin-thread-multi-2level/DynaLoader.pm line 230.\n at /Library/Perl/5.8.8/darwin-thread-multi-2level/DBI.pm line 266\nBEGIN failed--compilation aborted at /Library/Perl/5.8.8/darwin-thread-multi-2level/DBI.pm line 266.\n
.. Architecture output:
lenore:hendrik root# file /Library/Perl/5.8.8/darwin-thread-multi-2level/auto/DBI/DBI.bundle 
/Library/Perl/5.8.8/darwin-thread-multi-2level/auto/DBI/DBI.bundle: Mach-O universal binary with 2 architectures
/Library/Perl/5.8.8/darwin-thread-multi-2level/auto/DBI/DBI.bundle (for architecture i386):	Mach-O bundle i386
/Library/Perl/5.8.8/darwin-thread-multi-2level/auto/DBI/DBI.bundle (for architecture ppc7400):	Mach-O bundle ppc
lenore:hendrik root# file /Library/Perl/5.8.8/darwin-thread-multi-2level/auto/APR/Request/Request.bundle
/Library/Perl/5.8.8/darwin-thread-multi-2level/auto/APR/Request/Request.bundle: Mach-O universal binary with 2 architectures
/Library/Perl/5.8.8/darwin-thread-multi-2level/auto/APR/Request/Request.bundle (for architecture i386):	Mach-O bundle i386
/Library/Perl/5.8.8/darwin-thread-multi-2level/auto/APR/Request/Request.bundle (for architecture ppc7400):	Mach-O bundle ppc
lenore:hendrik root# 
I'll investigate further, before I get my foot stuck in my mouth again.


We have (had) the same problem in common

greenyMike on 2008-01-18T22:02:23

I found your thread back and forth with pudge about the problem with dbd::mysql and thought I had finally found the conclusion to my problem, but couldn't find what you did after the point where your server logs were reporting:

dyld: lazy symbol binding failed: Symbol not found: _mysql_server_init
Referenced from: /Library/Perl/5.8.8/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
Expected in: dynamic lookup

dyld: Symbol not found: _mysql_server_init
Referenced from: /Library/Perl/5.8.8/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
Expected in: dynamic lookup

[Fri Jan 18 16:33:33 2008] [notice] child pid 5530 exit signal Trace/BPT trap (5)
Got some advice for a fellow developer? Are you still trying to find an answer on this one?

Re:We have (had) the same problem in common

Beatnik on 2008-01-24T21:06:10

I bumped into some other people that had similar problems and recompiling mod_perl worked for them. Recompiling mod_perl (and also DBI, mysql and DBD::mysql) didn't work for me. I still had the same errors. Any results on your side so far?

Re:We have (had) the same problem in common

greenyMike on 2008-01-24T22:07:31

Never did figure it out, in fact I gave up on building RT and went with bugzilla, which uses the mod_cgi that comes bundled with leopard.

MikesMacBook:~ mike$ file /usr/libexec/apache2/mod_cgi.so
/usr/libexec/apache2/mod_cgi.so: Mach-O universal binary with 4 architectures
/usr/libexec/apache2/mod_cgi.so (for architecture ppc7400): Mach-O bundle ppc
/usr/libexec/apache2/mod_cgi.so (for architecture ppc64): Mach-O 64-bit bundle ppc64
/usr/libexec/apache2/mod_cgi.so (for architecture i386): Mach-O bundle i386
/usr/libexec/apache2/mod_cgi.so (for architecture x86_64): Mach-O 64-bit bundle x86_64

Setting the Arch before running Makefile.PL

d15c1pl3 on 2008-02-01T11:57:20

If you add this to your ~/.profile

export ARCHFLAGS='-arch i386 -arch x86_64 -arch ppc -arch ppc64'

credit goes to: http://forums.devshed.com/perl-programming-6/issue-compiling-libapreq2-on-mac-os x-10-5-leopard-ppc-501979.html