By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,383 Members | 2,070 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,383 IT Pros & Developers. It's quick & easy.

[SQLite] Compiling in PHP statically?

P: n/a
Hello

I need to compile PHP5 with SQLite statically and without PDO.
I don't need DB-independence, so it's fine using sqlite_*() functions
instead of PDO.

1. I've downloaded, compiled, and installed
sqlite.org/sqlite-3.5.4.tar.gz, and...
2. used "--with-sqlite --disable-pdo", but it fails.

Those others failed too:
--disable-pdo --with-sqlite=/usr/local/lib/libsqlite3.a
--disable-pdo --with-sqlite=/usr/local/lib/libsqlite3.la
--disable-pdo --with-sqlite=/usr/local/lib/libsqlite3.so.0.8.6

FWIW, I edited PHP5's makefile before rerunning make after each time.

=What's the right way to statically link SQLite while disabling PDO
altogether?

BTW, when using "--with-sqlite" as-is, how does make know where to
find the SQLite library?

Thank you.
Jan 29 '08 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Gilles Ganault wrote:
Hello

I need to compile PHP5 with SQLite statically and without PDO.
I don't need DB-independence, so it's fine using sqlite_*() functions
instead of PDO.

1. I've downloaded, compiled, and installed
sqlite.org/sqlite-3.5.4.tar.gz, and...
2. used "--with-sqlite --disable-pdo", but it fails.

Those others failed too:
--disable-pdo --with-sqlite=/usr/local/lib/libsqlite3.a
--disable-pdo --with-sqlite=/usr/local/lib/libsqlite3.la
--disable-pdo --with-sqlite=/usr/local/lib/libsqlite3.so.0.8.6

FWIW, I edited PHP5's makefile before rerunning make after each time.

=What's the right way to statically link SQLite while disabling PDO
altogether?

BTW, when using "--with-sqlite" as-is, how does make know where to
find the SQLite library?

Thank you.
You don't say what messages you get, so we have no idea what might be wrong.

If you don't tell where sqllite is located, config looks for it in the
system's default environment.

Also, you should also not need to do any editing of the makefile before
rerunning. In fact, it's not a good idea to do so. But you do want to
do a

make clean

before doing a second compile.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jan 29 '08 #2

P: n/a
On Mon, 28 Jan 2008 21:27:58 -0500, Jerry Stuckle
<js*******@attglobal.netwrote:
>You don't say what messages you get, so we have no idea what might be wrong.
This kind of error:

===================
os_unix.c:(.text+0x149): undefined reference to `dlclose'
ext/pdo_sqlite/sqlite/src/os_unix.o: In function `sqlite3UnixDlsym':
os_unix.c:(.text+0x14e): undefined reference to `dlsym'
collect2: ld returned 1 exit status
ext/pdo_sqlite/sqlite/src/os_unix.o: Inmake[1]: *** [sapi/cli/php]
Error 1
make[1]: *** Waiting for unfinished jobs....
function `sqlite3UnixDlopen':
os_unix.c:(.text+0x15f): undefined reference to `dlopen'
ext/pdo_sqlite/sqlite/src/os_unix.o: In function `sqlite3UnixDlclose':
os_unix.c:(.text+0x149): undefined reference to `dlclose'
ext/pdo_sqlite/sqlite/src/os_unix.o: In function `sqlite3UnixDlsym':
os_unix.c:(.text+0x14e): undefined reference to `dlsym'
collect2: ld returned 1 exit status
make[1]: *** [sapi/cgi/php-cgi] Error 1
make[1]: Leaving directory
`/home/compile/astlinux-trunk/build_i586/php-5.2.5'
make: ***
[/home/compile/astlinux-trunk/build_i586/php-5.2.5/sapi/cgi/php-cgi]
Error 2
===================
>If you don't tell where sqllite is located, config looks for it in the
system's default environment.
Maybe that's what the problem is. BTW, which among the three files
does it use to compile SQLite statically into PHP5's binary?

/usr/local/lib/libsqlite3.a
/usr/local/lib/libsqlite3.la
/usr/local/lib/libsqlite3.so.0.8.6
>Also, you should also not need to do any editing of the makefile before
rerunning. In fact, it's not a good idea to do so. But you do want to
do a

make clean

before doing a second compile.
"make clean" itself returns errors :-/

=========
make: [sfdisk-clean] Error 2 (ignored)
make -j2 -C /home/compile/astlinux-trunk/build_i586/sipp-2.0.1.src
clean
make: *** /home/compile/astlinux-trunk/build_i586/sipp-2.0.1.src: No
such file or directory. Stop.
make: *** [sipp-clean] Error 2
=========

I'll just scrap the thing and start again.

Do you know what SQLite-related switches to put in the command-line,
what steps to take before (eg. editing some env't variable, etc.) so
it does what I need, which is disable PDO and add SQLite statically?

Thank you.
Jan 29 '08 #3

P: n/a
Gilles Ganault wrote:
On Mon, 28 Jan 2008 21:27:58 -0500, Jerry Stuckle
<js*******@attglobal.netwrote:
>You don't say what messages you get, so we have no idea what might be wrong.

This kind of error:

===================
os_unix.c:(.text+0x149): undefined reference to `dlclose'
ext/pdo_sqlite/sqlite/src/os_unix.o: In function `sqlite3UnixDlsym':
os_unix.c:(.text+0x14e): undefined reference to `dlsym'
collect2: ld returned 1 exit status
ext/pdo_sqlite/sqlite/src/os_unix.o: Inmake[1]: *** [sapi/cli/php]
Error 1
make[1]: *** Waiting for unfinished jobs....
function `sqlite3UnixDlopen':
os_unix.c:(.text+0x15f): undefined reference to `dlopen'
ext/pdo_sqlite/sqlite/src/os_unix.o: In function `sqlite3UnixDlclose':
os_unix.c:(.text+0x149): undefined reference to `dlclose'
ext/pdo_sqlite/sqlite/src/os_unix.o: In function `sqlite3UnixDlsym':
os_unix.c:(.text+0x14e): undefined reference to `dlsym'
collect2: ld returned 1 exit status
make[1]: *** [sapi/cgi/php-cgi] Error 1
make[1]: Leaving directory
`/home/compile/astlinux-trunk/build_i586/php-5.2.5'
make: ***
[/home/compile/astlinux-trunk/build_i586/php-5.2.5/sapi/cgi/php-cgi]
Error 2
===================
>If you don't tell where sqllite is located, config looks for it in the
system's default environment.

Maybe that's what the problem is. BTW, which among the three files
does it use to compile SQLite statically into PHP5's binary?

/usr/local/lib/libsqlite3.a
/usr/local/lib/libsqlite3.la
/usr/local/lib/libsqlite3.so.0.8.6
Not positive, but I think the .a. But I'm not an expert on linux.
>Also, you should also not need to do any editing of the makefile before
rerunning. In fact, it's not a good idea to do so. But you do want to
do a

make clean

before doing a second compile.

"make clean" itself returns errors :-/

=========
make: [sfdisk-clean] Error 2 (ignored)
make -j2 -C /home/compile/astlinux-trunk/build_i586/sipp-2.0.1.src
clean
make: *** /home/compile/astlinux-trunk/build_i586/sipp-2.0.1.src: No
such file or directory. Stop.
make: *** [sipp-clean] Error 2
=========
Sounds like you've got something really screwed up.
I'll just scrap the thing and start again.
I think that's the best solution.
Do you know what SQLite-related switches to put in the command-line,
what steps to take before (eg. editing some env't variable, etc.) so
it does what I need, which is disable PDO and add SQLite statically?

Thank you.
Check the output of ./config --help. But IIRC, it's something like:

--with-sqllite=/path/to/development/libs

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jan 29 '08 #4

P: n/a
On Mon, 28 Jan 2008 22:10:10 -0500, Jerry Stuckle
<js*******@attglobal.netwrote:
>Sounds like you've got something really screwed up.
I've never its "clean" option, so it might be broken without my doing
anythign. I'll just delete and start again.
>Check the output of ./config --help. But IIRC, it's something like:

--with-sqllite=/path/to/development/libs
So libs=compiled version? I'll try this instead:

PHP5_SQLITE+=--disable-pdo --without-pdo-sqlite --with-sqlite

If NOK,

PHP5_SQLITE+=--disable-pdo --without-pdo-sqlite
--with-sqlite=/usr/local/lib/libsqlite3.a

The exemples I found all their disable SQLite, or compile it with PDO
and dynamically.

Thanks.
Jan 29 '08 #5

P: n/a
Gilles Ganault wrote:
On Mon, 28 Jan 2008 22:10:10 -0500, Jerry Stuckle
<js*******@attglobal.netwrote:
>Sounds like you've got something really screwed up.

I've never its "clean" option, so it might be broken without my doing
anythign. I'll just delete and start again.
>Check the output of ./config --help. But IIRC, it's something like:

--with-sqllite=/path/to/development/libs

So libs=compiled version? I'll try this instead:

PHP5_SQLITE+=--disable-pdo --without-pdo-sqlite --with-sqlite

If NOK,

PHP5_SQLITE+=--disable-pdo --without-pdo-sqlite
--with-sqlite=/usr/local/lib/libsqlite3.a

The exemples I found all their disable SQLite, or compile it with PDO
and dynamically.

Thanks.
The default is to include sqlite support. If you need to add it, just
use --with-sqlite=/path/to/files.

But your PHP5_SQLITE is not a valid configure option. You shouldn't be
using it.

You can get a full list of all configure options with

../configure --help configure.out

Then look at configure.out with your favorite text editor.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jan 29 '08 #6

P: n/a
On Mon, 28 Jan 2008 23:31:29 -0500, Jerry Stuckle
<js*******@attglobal.netwrote:
>The default is to include sqlite support. If you need to add it, just
use --with-sqlite=/path/to/files.
Unfortunately, while the former did work...

==========
PHP5_SQLITE+=--disable-pdo --without-pdo-sqlite --with-sqlite
==========

.... tthe latter doesn't:

==========
PHP5_SQLITE+=--disable-pdo --without-pdo-sqlite
--with-sqlite=/usr/local/lib/libsqlite3.a
==========
[...]
checking whether zend_object_value is packed... no
checking for sqlite support... yes
checking whether to enable UTF-8 support in sqlite (default:
ISO-8859-1)... no
checking for sqlite files in default path... not found
configure: error: Please reinstall the sqlite distribution from
http://www.sqlite.org
make: ***
[/home/compile/astlinux-trunk/build_i586/php-5.2.5/.configured] Error
1
==========
>But your PHP5_SQLITE is not a valid configure option. You shouldn't be
using it.
Probably, but it's part of a distro, and I don't have the skills to
make changes. I just wanted to tell make to use the external, more
modern version of SQLite.

With some many files out there, I can't figure out what settings it
needs to go outside the build tree.
>You can get a full list of all configure options with
./configure --help configure.out
Then look at configure.out with your favorite text editor.
No trace of this file when running "find . -name "configure.out". But
then ""./configure" says "No such file or directory". I just run
"make" and magic happens.

Unless I find something soon, I'll just go with the embedded 2.8.17.

Thanks.
Jan 29 '08 #7

P: n/a
..oO(Gilles Ganault)
>On Mon, 28 Jan 2008 23:31:29 -0500, Jerry Stuckle
<js*******@attglobal.netwrote:
>>The default is to include sqlite support. If you need to add it, just
use --with-sqlite=/path/to/files.

Unfortunately, while the former did work...

==========
PHP5_SQLITE+=--disable-pdo --without-pdo-sqlite --with-sqlite
==========

... tthe latter doesn't:

==========
PHP5_SQLITE+=--disable-pdo --without-pdo-sqlite
--with-sqlite=/usr/local/lib/libsqlite3.a
==========
Usually you don't point directly to a library, but to the base directory
where it's installed. Or just leave it empty, in many cases the DIR
value is optional.

Additionally you need the header files if you want to use a lib in PHP.
On a Debian system for example there are usually a "libfoo" package and
a "libfoo-dev" package, which is required if you want to link against
that lib in your application.

Another note: The PHP manual says that in recent versions SQLite depends
on PDO:

| Moreover, since PHP 5.1.0 SQLite depends on PDO it must be enabled too

and

| SQLite 3 is supported through PDO SQLite.

So I don't know if you can embed and use it without the PDO framework.
>>But your PHP5_SQLITE is not a valid configure option. You shouldn't be
using it.

Probably, but it's part of a distro, and I don't have the skills to
make changes. I just wanted to tell make to use the external, more
modern version of SQLite.
The typical way to compile something is

../configure [--options]
make
make install

That's it. There's no need to edit scripts or makefiles. The only thing
that I use on my box is a little script that calls ./configure with all
the required options, so I don't have to type them again and again.

Then, if you change a settting, call ./configure and make again.

Of course that's just how it works on a normal desktop box. There might
be differences on other distros or special systems like embedded
machines.

Micha
Jan 29 '08 #8

P: n/a
Gilles Ganault wrote:
On Mon, 28 Jan 2008 23:31:29 -0500, Jerry Stuckle
<js*******@attglobal.netwrote:
>The default is to include sqlite support. If you need to add it, just
use --with-sqlite=/path/to/files.

Unfortunately, while the former did work...

==========
PHP5_SQLITE+=--disable-pdo --without-pdo-sqlite --with-sqlite
==========

... tthe latter doesn't:

==========
PHP5_SQLITE+=--disable-pdo --without-pdo-sqlite
--with-sqlite=/usr/local/lib/libsqlite3.a
==========
[...]
checking whether zend_object_value is packed... no
checking for sqlite support... yes
checking whether to enable UTF-8 support in sqlite (default:
ISO-8859-1)... no
checking for sqlite files in default path... not found
configure: error: Please reinstall the sqlite distribution from
http://www.sqlite.org
make: ***
[/home/compile/astlinux-trunk/build_i586/php-5.2.5/.configured] Error
1
==========
>But your PHP5_SQLITE is not a valid configure option. You shouldn't be
using it.

Probably, but it's part of a distro, and I don't have the skills to
make changes. I just wanted to tell make to use the external, more
modern version of SQLite.
If it's part of a distro, that's an entirely different story. Each
distro typically has some other things in it, also.

Also, you don't give the filename - you give the PATH to the file.
configure will look for its own files. So it should just be /usr/local/lib.
With some many files out there, I can't figure out what settings it
needs to go outside the build tree.
>You can get a full list of all configure options with
./configure --help configure.out
Then look at configure.out with your favorite text editor.

No trace of this file when running "find . -name "configure.out". But
then ""./configure" says "No such file or directory". I just run
"make" and magic happens.

Unless I find something soon, I'll just go with the embedded 2.8.17.

Thanks.
Did they not ship a configure script with your distro? That's very
possible - many don't because it's only used to build PHP. But you need
it to change options.

The --with-sqlite is an option to configure, not something in the
makefile. configure builds the makefile, and any one option to
configure can make several changes to the makefile. You can't just
change the makefile without knowing *exactly* what you're doing.

If that's the case, you'll need to download the package from PHP and
build it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jan 29 '08 #9

This discussion thread is closed

Replies have been disabled for this discussion.