php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55917 mac os x build via pear creates invalid bundle
Submitted: 2003-11-11 17:11 UTC Modified: 2004-02-08 10:09 UTC
From: brlcad at NO_SPAM dot mac dot com Assigned: wez (profile)
Status: Closed Package: SQLite (PECL)
PHP Version: 4.3.3 OS: Mac OS X 10.2.8
Private report: No CVE-ID: None
 [2003-11-11 17:11 UTC] brlcad at NO_SPAM dot mac dot com
Description:
------------
If I go through the usual steps to build sqlite via pear install on mac 
os x 10.2.8, it ends up creating a .so that will not load via the php 
dl() or automatically via the php.ini. A dynamic library is created 
instead of a bundle.

This causes an error when you try to load the library:

cat example <<END
sh-2.05a# php sqlite.php

Warning: dl(): Unable to load dynamic library '/usr/local/lib/php/
extensions/sqlite.so' - not a Mach-O MH_BUNDLE file type in /
private/tmp/tmp9GcwuC/SQLite-1.0/sqlite.php on line 3

Fatal error: Call to undefined function: sqlite_libversion() in /
private/tmp/tmp9GcwuC/SQLite-1.0/sqlite.php on line 6 
END

There is a /usr/local/lib/php/extensions/sqlite.so file with proper 
permissions, it is merely linked incorrectly.

I was able to work around the problem by halting a pear install 
during mid build, running configure myself and relinking the binary 
with the correct options. Instead of -dynamiclib, use -bundle, and 
remove the -install_name option:

sh-2.05a# gcc -bundle -flat_namespace -undefined suppress -o 
.libs/sqlite.so sqlite.lo libsqlite/src/opcodes.lo libsqlite/src/parse.lo 
libsqlite/src/encode.lo libsqlite/src/auth.lo libsqlite/src/btree.lo 
libsqlite/src/build.lo libsqlite/src/delete.lo libsqlite/src/expr.lo 
libsqlite/src/func.lo libsqlite/src/hash.lo libsqlite/src/insert.lo 
libsqlite/src/main.lo libsqlite/src/os.lo libsqlite/src/pager.lo libsqlite/
src/printf.lo libsqlite/src/random.lo libsqlite/src/select.lo libsqlite/
src/table.lo libsqlite/src/tokenize.lo libsqlite/src/update.lo libsqlite/
src/util.lo libsqlite/src/vdbe.lo libsqlite/src/attach.lo libsqlite/src/
btree_rb.lo libsqlite/src/pragma.lo libsqlite/src/vacuum.lo libsqlite/
src/copy.lo libsqlite/src/where.lo libsqlite/src/trigger.lo -lc

This worked for me and everything was happy once I copied it into 
place. As a side note, the dynamic libs are what you want to do for 
a library that compiled code will link against, just apparently not the 
mechanism php is/was set up to use (php could have used the 
equivalent to dlopen, but they apparently favored using bundles 
instead). Hope this helps someone. :)

Cheers!
Sean

p.s. I submitted this as a bug to the sqlite folks, and they said it's a 
php folk problem.  It is recorded under sqlite ticket #487.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-08 09:07 UTC] gurugeek@php.net
Hello,
SQLite is now part of PECL (http://pecl.php.net) that 
said I do run SQLite on a Mac OSX 10.3.2 and the correct 
procedure to setup sqlite on a Mac running OS X 10.2+ is 
as follow:

on terminal:
setenv PATH /usr/local/php/bin:$PATH 

pear download SQLite 

pear install SQLite-1.X.tgz 

edit your php.ini
at /usr/local/php/lib/php.ini (e.g. pico  sudo /usr/
local/php/lib/php.ini of if you run fink you can use joe 
or vim)

adding: 
extension=sqlite.so 

update the extension dir on php.ini
extension_dir = "/usr/local/php/lib/php/extensions/no-
debug-non-zts-20020429/" 
 
restart apache (sudo apachectl restart)
 
I tried this method on an Imac G4 1 Ghz, an Emac G4 1 
Ghz and an Ibook G3 900 without being able to replicate 
your errors.

It is probably an outdated bug.

Thanks again for your contribution to PEAR,
Regards
David Costa

P.S. I think we should close this bug report. I will be 
more then willing to so do that after the approval from 
the PECL package lead or PECL QA.

 [2004-02-08 10:09 UTC] wez@php.net
apparently no longer an issue; closing.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Mar 06 14:01:22 2021 UTC