[SQLite] Compiling in PHP statically?

[SQLite] Compiling in PHP statically?

am 29.01.2008 03:07:07 von DFS

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.

Re: [SQLite] Compiling in PHP statically?

am 29.01.2008 03:27:58 von Jerry Stuckle

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.
jstucklex@attglobal.net
==================

Re: [SQLite] Compiling in PHP statically?

am 29.01.2008 03:37:39 von DFS

On Mon, 28 Jan 2008 21:27:58 -0500, Jerry Stuckle
wrote:
>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.

Re: [SQLite] Compiling in PHP statically?

am 29.01.2008 04:10:10 von Jerry Stuckle

Gilles Ganault wrote:
> On Mon, 28 Jan 2008 21:27:58 -0500, Jerry Stuckle
> wrote:
>> 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.
jstucklex@attglobal.net
==================

Re: [SQLite] Compiling in PHP statically?

am 29.01.2008 04:53:36 von DFS

On Mon, 28 Jan 2008 22:10:10 -0500, Jerry Stuckle
wrote:
>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.

Re: [SQLite] Compiling in PHP statically?

am 29.01.2008 05:31:29 von Jerry Stuckle

Gilles Ganault wrote:
> On Mon, 28 Jan 2008 22:10:10 -0500, Jerry Stuckle
> wrote:
>> 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.
jstucklex@attglobal.net
==================

Re: [SQLite] Compiling in PHP statically?

am 29.01.2008 06:40:40 von DFS

On Mon, 28 Jan 2008 23:31:29 -0500, Jerry Stuckle
wrote:
>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/.configur ed] 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.

Re: [SQLite] Compiling in PHP statically?

am 29.01.2008 09:17:13 von Michael Fesser

..oO(Gilles Ganault)

>On Mon, 28 Jan 2008 23:31:29 -0500, Jerry Stuckle
> wrote:
>>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

Re: [SQLite] Compiling in PHP statically?

am 29.01.2008 11:59:18 von Jerry Stuckle

Gilles Ganault wrote:
> On Mon, 28 Jan 2008 23:31:29 -0500, Jerry Stuckle
> wrote:
>> 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/.configur ed] 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.
jstucklex@attglobal.net
==================