Skip to content

Commit 7917dc9

Browse files
committed
fix: build sqlite3 from source for older glibc compatibility
Prebuilt sqlite3 6.0.1 binaries require glibc 2.38, which is newer than Debian 12 (2.36) and Ubuntu 22.04 (2.35). Add a postinstall script to rebuild sqlite3 from source so npm install works on all supported platforms.
1 parent 736678f commit 7917dc9

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ COPY src /app/src/
1515
COPY tests /app/tests/
1616
WORKDIR /app
1717

18-
RUN npm install && npm rebuild sqlite3 --build-from-source
18+
RUN npm install
1919

2020
RUN mkdir -p /root/.chia/mainnet/config/ssl && mkdir -p /root/.chia/mainnet/cadt/v1
2121

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,33 @@ You'll need:
128128
129129
- Git
130130
- [nvm](https://github.com/nvm-sh/nvm) - This app uses `nvm` to align node versions across development, CI and production. If you're working on Windows, you should consider [nvm-windows](https://github.com/coreybutler/nvm-windows)
131+
- C/C++ build tools for compiling the SQLite native module (see below)
131132
- A working [Chia installation](https://docs.chia.net/installation/#using-the-cli) running wallet and datalayer (full node recommended)
132133

134+
##### Build Prerequisites
135+
136+
The `sqlite3` npm package is compiled from source during `npm install` to ensure compatibility across platforms. This requires a C/C++ toolchain and Python 3:
137+
138+
**Debian / Ubuntu:**
139+
140+
```
141+
sudo apt-get install -y build-essential python3
142+
```
143+
144+
**macOS:**
145+
146+
```
147+
xcode-select --install
148+
```
149+
133150
To install from source:
134151

135152
```
136153
git clone git@github.com:Chia-Network/cadt.git
137154
cd cadt
138155
nvm install
139156
nvm use
157+
npm install
140158
npm run start
141159
```
142160

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"test:v2:live:all": "npm run test:v2:live:organization:create && npm run test:v2:live:data && npm run test:v2:live:organization:delete",
4141
"resetTestDb": "rm -rf ./tests/test-dbs && mkdir -p ./tests/test-dbs",
4242
"resetMirrorDb": "npx sequelize-cli db:drop --env mirror",
43+
"postinstall": "cd node_modules/sqlite3 && node-gyp rebuild --napi_build_version=6",
4344
"prepare": "husky",
4445
"build": "babel src --keep-file-extension --out-dir build --copy-files && cp package.json ./build && node change-build-package-type-commonjs.cjs",
4546
"build-migrations": "babel migrations --keep-file-extension --out-dir dist/migrations --copy-files",

0 commit comments

Comments
 (0)