pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Make php-pdo_sqlite use pkgsrc sqlite (SOLVED)




25 sep 2009 kl. 20.58 skrev Leo R. Lundgren:

25 sep 2009 kl. 14.43 skrev Leo R. Lundgren:

I'm having a problem with php-pdo_sqlite, in that it is linking itself against my OS X 10.5.8 native sqlite 3.4, instead of the pkgsrc sqlite 3.6.16. I do have sqlite3 from pkgsrc installed:

        % pkg_info|grep sqlite
php5-pdo_sqlite-5.2.10 PHP extension for PHP Data Objects (SQLite v3)
        sqlite3-3.6.16      SQL Database Engine in a C Library

I am building php-pdo_sqlite like usual, no special settings. However, I have tried to mitigate the issue using the following in / usr/pkg/etc/mk.conf:

        PREFER_PKGSRC+=sqlite3

Using the PREFER_PKGSRC setting worked flawlessly when I had the same issue with freetype 2, so I presume that I am using this feature correctly. I also tried the same thing but with "sqlite" instead of "sqlite3", but none of those settings seem to make a difference. After restarting Apache with mod_php (also from pkgsrc), phpinfo() still reports the following:

        PDO:
        PDO support: enabled
        PDO drivers: sqlite

        pdo_sqlite:
        PDO Driver for SQLite 3.x: enabled
PECL Module version: 1.0.1 $Id: pdo_sqlite.c,v 1.10.2.6.2.4 2008/12/31 11:17:42 sebastian Exp $
        SQLite Library: 3.4.0

I want the last line above to say "SQLite Library: 3.6.16", or at least 3.5.4 since that version or newer is what I need PHP/PDO to use.

Maybe the problem is that php-pdo_sqlite doesn't respect PREFER_PKGSRC at all? Any idea what I can do to make php-pdo_sqlite link against pkgsrc's own sqlite3 instead och my system's sqlite3?

Addendum; tnn@ pointed out that php-pdo_sqlite should never choose native sqlite3. Indeed, looking at what the pdo_sqlite extension is linked against, there's no mention of anything but pkgsrc's sqlite:

        % otool -L /usr/pkg/lib/php/20040412/pdo_sqlite.so
        /usr/pkg/lib/php/20040412/pdo_sqlite.so:
/usr/pkg/lib/libsqlite3.0.dylib (compatibility version 9.0.0, current version 9.6.0) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)

It was also suggested that it might have to do with some incorrect runpaths. I'll try to have a look at that.


Problem solved!

I am not entirely sure if this is the correct way to solve the problem/ configure the loading of dynamic libraries as required by php- pdo_sqlite, but it works and doesn't seem to hacky.

I added an entry for DYLD_INSERT_LIBRARIES to /System/Library/ LaunchDaemons/org.apache.httpd.plist in order to make it load the pkgsrc sqlite3 library *before* the native sqlite3 library. This is the same file I've previously edited in order to make the system load the pkgsrc httpd instead of the native one (just changed the path to the executable).

Here's the file in its entirety (what I added was the "EnvironmentVariables" key and its associated dictionary):

        <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd ">
        <plist version="1.0">
        <dict>
                <key>EnvironmentVariables</key>
                <dict>
                        <key>DYLD_INSERT_LIBRARIES</key>
                        <string>/usr/pkg/lib/libsqlite3.0.dylib</string>
                </dict>
                <key>Label</key>
                <string>org.apache.httpd</string>
                <key>OnDemand</key>
                <false/>
                <key>ProgramArguments</key>
                <array>
                        <string>/usr/pkg/sbin/httpd</string>
                        <string>-D</string>
                        <string>FOREGROUND</string>
                </array>
                <key>SHAuthorizationRight</key>
                <string>system.preferences</string>
        </dict>
        </plist>

-|



Home | Main Index | Thread Index | Old Index