Skip to content

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Sep 23, 2018

Since there is no need to patch libsqlite3 for our purposes, and since
libsqlite3 ≥ 3.3.9 (which is our current requirement) is widely
available on distros, there is no reason anymore to bundle the library.

Besides removing the bundled libsqlite, and adapting the configuration
respectively, we also fix the use of the SQLITE_ENABLE_COLUMN_METADATA
compile time constant to detect whether sqlite3_column_table_name() is
available by a working feature detection (otherwise bug_42589.phpt
would fail).

We also completely drop support for the obscure pdo_sqlite_external
extension (which could have been enabled on Windows only by passing
--pdo-sqlite-external to configure), since it is not needed anymore.

@staabm
Copy link
Contributor

staabm commented Sep 23, 2018

Side question: will unbundling of this huge libs also speedup CI run as a lot of code will be less to compile?

@cmb69
Copy link
Member Author

cmb69 commented Sep 23, 2018

will unbundling of this huge libs also speedup CI run as a lot of code will be less to compile?

I guess that the performance improvement would not really be noticable.

@cmb69
Copy link
Member Author

cmb69 commented Sep 23, 2018

The earlier Travis build failure has been caused by Xenial's libsqlite 3.11.0-1ubuntu1, which apparently exhibits bug https://sqlite.org/src/info/ef360601. I've added a respective SKIPIF clause to work around that. It might be appropriate to backport this fix to older PHP branches as well.

CHECK_HEADER_ADD_INCLUDE("sqlite3.h", "CFLAGS_PDO_SQLITE") &&
CHECK_HEADER_ADD_INCLUDE("sqlite3ext.h", "CFLAGS_PDO_SQLITE")
) {
EXTENSION("pdo_sqlite", "pdo_sqlite.c sqlite_driver.c sqlite_statement.c");
Copy link
Member

@KalleZ KalleZ Sep 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just making a note here, are we sure that we don't need the old CFLAGS like SQLITE_ENABLE_FTS3, SQLITE_ENABLE_FTS4, SQLITE_ENABLE_FTS5, SQLITE_ENABLE_JSON1 & SQLITE_CORE here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've grepped for these, and they are not used anywhere. However, if they were, that wouldn't work anyway, since the external libsqlite might have been compiled differently.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted, then we should be good to go then as I don't see any other obvious things at a glance

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, those are library flags, not extension flags. Pushed a repo now https://github.com/winlibs/sqlite3.

CHECK_HEADER_ADD_INCLUDE("sqlite3.h", "CFLAGS_SQLITE3") &&
CHECK_HEADER_ADD_INCLUDE("sqlite3ext.h", "CFLAGS_SQLITE3")
) {
EXTENSION("sqlite3", "sqlite3.c", null, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as for the pdo_sqlite/config.w32 note here

@cmb69 cmb69 mentioned this pull request Sep 23, 2018
Copy link
Contributor

@weltling weltling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some notes could be addressed, but actually looks good.

Thanks.


if test "$ZEND_DEBUG" = "yes"; then
debug_flags="-DSQLITE_DEBUG=1"
AC_MSG_CHECKING([for sqlite3 files in default path])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to prefer pkg-config and fallback to the below otherwise.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I've already thought about that, but would prefer if someone more knowledgable regarding the Linux build system to do that.

CHECK_HEADER_ADD_INCLUDE("sqlite3.h", "CFLAGS_PDO_SQLITE") &&
CHECK_HEADER_ADD_INCLUDE("sqlite3ext.h", "CFLAGS_PDO_SQLITE")
) {
EXTENSION("pdo_sqlite", "pdo_sqlite.c sqlite_driver.c sqlite_statement.c");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, those are library flags, not extension flags. Pushed a repo now https://github.com/winlibs/sqlite3.

}
if (CHECK_LIB("libsqlite3_a.lib;libsqlite3.lib", "pdo_sqlite", PHP_PDO_SQLITE) &&
CHECK_HEADER_ADD_INCLUDE("sqlite3.h", "CFLAGS_PDO_SQLITE") &&
CHECK_HEADER_ADD_INCLUDE("sqlite3ext.h", "CFLAGS_PDO_SQLITE")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be generalized into a function like it is done for OpenSSL. Not critical for now.

Also shared might be a better choice to prefer for the shared extension build.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I'll see to it.

Copy link
Contributor

@carusogabriel carusogabriel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also remove the lib from the "PHP source code directory structure" CONTRIBUTING section

@cmb69
Copy link
Member Author

cmb69 commented Sep 25, 2018

@carusogabriel Good catch!

Copy link
Member

@petk petk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also maybe worth updating in this patch or separately, file README.REDIST.BINS contains a mention of the bundled sqlite library.

Since there is no need to patch libsqlite3 for our purposes, and since
libsqlite3 ≥ 3.3.9 (which is our current requirement) is widely
available on distros, there is no reason anymore to bundle the library.

Besides removing the bundled libsqlite, and adapting the configuration
respectively, we also fix the use of the SQLITE_ENABLE_COLUMN_METADATA
compile time constant to detect whether sqlite3_column_table_name() is
available by a working feature detection (otherwise bug_42589.phpt
would fail).

We also completely drop support for the obscure pdo_sqlite_external
extension (which could have been enabled on Windows only by passing
`--pdo-sqlite-external` to configure), since it is not needed anymore.
We skip this test for libsqlite 3.11.0 to 3.14.1, since they have
bug https://sqlite.org/src/info/ef360601.
We also extract the SETUP_SQLITE3() function for code re-use.
@cmb69 cmb69 force-pushed the unbundle-libsqlite branch from 756480e to 3474cbd Compare September 29, 2018 22:08
@cmb69
Copy link
Member Author

cmb69 commented Sep 29, 2018

@petk Thanks! Done.

If there are no objections, I'm going to apply this PR on the next weekend.

Copy link
Contributor

@carusogabriel carusogabriel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also remove the library from Makefile.gcov exclusion list:

for dir in ext/bcmath/libbcmath ext/date/lib ext/fileinfo/libmagic ext/gd/libgd ext/mbstring/libmbfl ext/mbstring/oniguruma ext/pcre/pcre2lib ext/sqlite3/libsqlite ext/xmlrpc/libxmlrpc ext/zip/lib; do \

@cmb69
Copy link
Member Author

cmb69 commented Sep 30, 2018

Thanks, @carusogabriel!

@php-pulls
Copy link

Comment on behalf of cmb at php.net:

Applied via 6083a38.

@php-pulls php-pulls closed this Oct 6, 2018
@cmb69 cmb69 deleted the unbundle-libsqlite branch October 6, 2018 10:39
@cmb69
Copy link
Member Author

cmb69 commented Oct 6, 2018

salathe pushed a commit to salathe/phpdoc-en that referenced this pull request Oct 6, 2018
svn2github pushed a commit to svn2github/phpdoc_en that referenced this pull request Oct 7, 2018
heiglandreas pushed a commit to phpdoctest/en that referenced this pull request Feb 4, 2020
salathe pushed a commit to salathe/phpdoc-en that referenced this pull request Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants