Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: fix --shared-sqlite builds #55969

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 43 additions & 18 deletions deps/sqlite/sqlite.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,51 @@
'sqlite_sources': [
'sqlite3.c',
],
'use_system_sqlite%': 0,
},
'targets': [
{
'target_name': 'sqlite',
'type': 'static_library',
'cflags': ['-fvisibility=hidden'],
'xcode_settings': {
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
},
'defines': [
'SQLITE_ENABLE_SESSION',
'SQLITE_ENABLE_PREUPDATE_HOOK'
'conditions': [
['use_system_sqlite==0', {
Copy link
Member

Choose a reason for hiding this comment

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

If you introduce this, something would need to toggle the value.

If configured with --shared-sqlite, this gyp file isn't included anyway (I verified that as part of #55409 (you can remove deps/sqlite if using --shared-sqlite and the build still works)) as per

node/node.gypi

Lines 231 to 233 in 6190bbc

[ 'node_shared_sqlite=="false"', {
'dependencies': [ 'deps/sqlite/sqlite.gyp:sqlite' ],
}],
-- if needed perhaps any addition defines should be set there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hum yeah that makes sense. For reference, I'm opening this because I'm getting undefined reference to sqlite3session_patchset'when working on https://github.com/NixOS/nixpkgs/pull/357699, and Nix is using--shared-sqlite`

'targets': [
{
'target_name': 'sqlite',
'type': 'static_library',
'cflags': ['-fvisibility=hidden'],
'xcode_settings': {
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
},
'defines': [
'SQLITE_ENABLE_SESSION',
'SQLITE_ENABLE_PREUPDATE_HOOK'
],
'include_dirs': ['.'],
'sources': [
'<@(sqlite_sources)',
],
'direct_dependent_settings': {
'include_dirs': ['.'],
},
},
],
'include_dirs': ['.'],
'sources': [
'<@(sqlite_sources)',
}, {
'targets': [
{
'target_name': 'sqlite',
'type': 'static_library',
'direct_dependent_settings': {
'defines': [
'USE_SYSTEM_SQLITE',
],
},
'defines': [
'USE_SYSTEM_SQLITE',
],
'link_settings': {
'libraries': [
'-lsqlite',
],
},
},
],
'direct_dependent_settings': {
'include_dirs': ['.'],
},
},
}],
],
}
7 changes: 6 additions & 1 deletion src/node_metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "node.h"
#include "simdjson.h"
#include "simdutf.h"
#include "sqlite3.h"
#include "undici_version.h"
#include "util.h"
#include "uv.h"
Expand All @@ -24,6 +23,12 @@
#include <zlib.h>
#endif // NODE_BUNDLED_ZLIB

#if defined(USE_SYSTEM_SQLITE)
#include <sqlite3.h>
#else
#include "sqlite3.h"
#endif // USE_SYSTEM_SQLITE

#if HAVE_OPENSSL
#include <openssl/crypto.h>
#include "ncrypto.h"
Expand Down
7 changes: 6 additions & 1 deletion src/node_sqlite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
#include "node.h"
#include "node_errors.h"
#include "node_mem-inl.h"
#include "sqlite3.h"
#include "util-inl.h"

#if defined(USE_SYSTEM_SQLITE)
#include <sqlite3.h>
#else
#include "sqlite3.h"
#endif // USE_SYSTEM_SQLITE

#include <cinttypes>

namespace node {
Expand Down
8 changes: 7 additions & 1 deletion src/node_sqlite.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@

#include "base_object.h"
#include "node_mem.h"
#include "sqlite3.h"
#include "util.h"

#if defined(USE_SYSTEM_SQLITE)
#include <sqlite3.h>
/* AOSP build requires relative paths. */
#else
#include "sqlite3.h"
#endif // USE_SYSTEM_SQLITE

#include <map>
#include <unordered_set>

Expand Down
7 changes: 6 additions & 1 deletion src/node_webstorage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@
#include "node_errors.h"
#include "node_mem-inl.h"
#include "path.h"
#include "sqlite3.h"
#include "util-inl.h"

#if defined(USE_SYSTEM_SQLITE)
#include <sqlite3.h>
#else
#include "sqlite3.h"
#endif // USE_SYSTEM_SQLITE

namespace node {
namespace webstorage {

Expand Down
8 changes: 7 additions & 1 deletion src/node_webstorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@

#include "base_object.h"
#include "node_mem.h"
#include "sqlite3.h"
#include "util.h"

#if defined(USE_SYSTEM_SQLITE)
#include <sqlite3.h>
/* AOSP build requires relative paths. */
#else
#include "sqlite3.h"
#endif // USE_SYSTEM_SQLITE

namespace node {
namespace webstorage {

Expand Down
Loading