thelounge / thelounge-archlinux

📦 Arch Linux package for The Lounge
https://aur.archlinux.org/packages/thelounge/
MIT License
4 stars 5 forks source link

Thelounge 3.0 and sqlite on ARM #8

Closed Superpiffer closed 5 years ago

Superpiffer commented 5 years ago

I'm doing some experiments with the new thelounge version on ArchlinuxArm. I've edited the PKGBUILD in order to use the new rc version and the sqlite log feature on a Raspberry Pi 3 and I have some issues.

On ARM architecture, the sqlite package doesn't exist on repo:

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.3/node-v67-linux-arm.tar.gz
node-pre-gyp WARN Pre-built binaries not found for sqlite3@4.0.3 and node@11.1.0 (node-v67 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp WARN Pre-built binaries not installable for sqlite3@4.0.3 and node@11.1.0 (node-v67 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error Connection closed while downloading tarball file

So npm tries to build the package, but if fails:

/home/pi/.node-gyp/11.1.0/include/node/v8.h:9701:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
sed: impossibile leggere ./Release/.deps/Release/obj.target/node_sqlite3/src/node_sqlite3.o.d.raw: File o directory non esistente
rm: impossibile rimuovere './Release/.deps/Release/obj.target/node_sqlite3/src/node_sqlite3.o.d.raw': File o directory non esistente
make: *** [node_sqlite3.target.mk:119: Release/obj.target/node_sqlite3/src/node_sqlite3.o] Error 1
make: *** Attesa per i processi non terminati....
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: sqlite3@4.0.3 (node_modules/thelounge/node_modules/sqlite3):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: sqlite3@4.0.3 install: `node-pre-gyp install --fallback-to-build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ thelounge@3.0.0-rc.4
added 275 packages from 260 contributors in 570.882s
grep: /home/pi/thelounge/pkg/thelounge-rc/usr/lib/node_modules/thelounge/node_modules/.bin/detect-libc: File o directory non esistente
grep: /home/pi/thelounge/pkg/thelounge-rc/usr/lib/node_modules/thelounge/node_modules/.bin/node-pre-gyp: File o directory non esistente
grep: /home/pi/thelounge/pkg/thelounge-rc/usr/lib/node_modules/thelounge/node_modules/.bin/rimraf: File o directory non esistente
grep: /home/pi/thelounge/pkg/thelounge-rc/usr/lib/node_modules/thelounge/node_modules/.bin/mkdirp: File o directory non esistente
grep: /home/pi/thelounge/pkg/thelounge-rc/usr/lib/node_modules/thelounge/node_modules/.bin/needle: File o directory non esistente
grep: /home/pi/thelounge/pkg/thelounge-rc/usr/lib/node_modules/thelounge/node_modules/.bin/nopt: File o directory non esistente
../src/database.cc: At global scope:
../src/database.cc:689:1: fatal error: opening dependency file ./Release/.deps/Release/obj.target/node_sqlite3/src/database.o.d.raw: File o directory non esistente
 }
 ^
compilation terminated.
make: *** [node_sqlite3.target.mk:119: Release/obj.target/node_sqlite3/src/database.o] Error 1
../src/statement.cc: At global scope:
../src/statement.cc:901:1: fatal error: opening dependency file ./Release/.deps/Release/obj.target/node_sqlite3/src/statement.o.d.raw: File o directory non esistente
 }
 ^
compilation terminated.
make: *** [node_sqlite3.target.mk:119: Release/obj.target/node_sqlite3/src/statement.o] Error 1
make: uscita dalla directory "/home/pi/thelounge/pkg/thelounge-rc/usr/lib/node_modules/thelounge/node_modules/sqlite3/build"
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
gyp ERR! System Linux 4.14.79-1-ARCH
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/pi/thelounge/pkg/thelounge-rc/usr/lib/node_modules/thelounge/node_modules/sqlite3/lib/binding/node-v67-linux-arm/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/home/pi/thelounge/pkg/thelounge-rc/usr/lib/node_modules/thelounge/node_modules/sqlite3/lib/binding/node-v67-linux-arm" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /home/pi/thelounge/pkg/thelounge-rc/usr/lib/node_modules/thelounge/node_modules/sqlite3
gyp ERR! node -v v11.1.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

After that I've tried to follow the new deb build method (https://github.com/thelounge/thelounge-deb/pull/33):

npm install -g --no-optional --prefix "$pkgdir/usr" "$srcdir/$_npmname-$_npmver.tgz"
npm install sqlite3 --no-lock-file --prefix "$pkgdir/usr/lib/node_modules/_npmname" --unsafe-perm

but the error is the same.

For some reason the only way to build sqlite with npm is adding --build-from-source (source: https://github.com/mapbox/node-sqlite3/issues/994#issuecomment-413998241): npm install sqlite3 --no-lock-file --prefix "$pkgdir/usr/lib/node_modules/_npmname" --unsafe-perm --build-from-source With this line, the package is built without errors.

For reference I attach my PKGBUILD file, hoping that this can be useful in preparation of the release of version 3.

I've found this issue only on ARM, on x64 works as expected with the original PKGBUILD. There is something that I'm missing and can be done without explicit build sqlite3 from source? Maybe have different lines in package() for different architectures? Thanks.

xPaw commented 5 years ago

There is something that I'm missing and can be done without explicit build sqlite3 from source?

Sadly the sqlite3 package does not provide precompiled binaries for ARM, so the only solution is to build it on your machine (or just skip it).

That being said you are using Node 11, which is not supported by sqlite3 yet.

Superpiffer commented 5 years ago

I've tried also with node 10 but I had the same problem. I know that I have to build it on my machine, but I'm confused because I thought that npm without the --build-from-source on an unsupported architecture was able to build the package.

xPaw commented 5 years ago

So to follow debian package we would need to do the following:

  1. Add --no-optional in pkgbuild
  2. Add sudo npm install sqlite3 --no-package-lock --prefix {figure out where arch installs it} --unsafe-perm in post_install

I'm unsure why --build-from-source is needed in this case, and whether it forcefully builds even if it can download a precompiled one. Maybe --fallback-to-build=true will also work?

Superpiffer commented 5 years ago

It's exactly what I did in my PKGBUILD. I've also tried --fallback-to-build=true but no luck,

Anyway, I think that the PKGBUILD for v3 should have those lines, to solve my problem I can manually add --build-from-source during installation. I don't know what else to do. Any ideas?

Here's the complete logs, with and without --build-from-source with node 10.

EDIT: Ok, I'va compared the logs and I found out that without the command, node-pre-gyp calls all the function two times:

> sqlite3@4.0.3 install /home/pi/thelounge/pkg/thelounge-rc/usr/lib/node_modules/thelounge/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.3/node-v64-linux-arm.tar.gz
node-pre-gyp WARN Pre-built binaries not found for sqlite3@4.0.3 and node@10.13.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp WARN Pre-built binaries not installable for sqlite3@4.0.3 and node@10.13.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error Connection closed while downloading tarball file
make: ingresso nella directory "/home/pi/thelounge/pkg/thelounge-rc/usr/lib/node_modules/thelounge/node_modules/sqlite3/build"
make: ingresso nella directory "/home/pi/thelounge/pkg/thelounge-rc/usr/lib/node_modules/thelounge/node_modules/sqlite3/build"
  ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3240000/sqlite3.c
  ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3240000/sqlite3.c
  TOUCH Release/obj.target/deps/action_before_build.stamp
  TOUCH Release/obj.target/deps/action_before_build.stamp
  CC(target) Release/obj.target/sqlite3/gen/sqlite-autoconf-3240000/sqlite3.o
  CC(target) Release/obj.target/sqlite3/gen/sqlite-autoconf-3240000/sqlite3.o
Release/obj/gen/sqlite-autoconf-3240000/sqlite3.c: In function ‘strftimeFunc’:
Release/obj/gen/sqlite-autoconf-3240000/sqlite3.c: In function ‘strftimeFunc’:
Release/obj/gen/sqlite-autoconf-3240000/sqlite3.c:13800:27: warning: cast between incompatible function types from ‘int (*)(void *)’ to ‘void (*)(void *)’ [-Wcast-function-type]
 #define SQLITE_DYNAMIC   ((sqlite3_destructor_type)sqlite3MallocSize)
                           ^
Release/obj/gen/sqlite-autoconf-3240000/sqlite3.c:21428:52: note: in expansion of macro ‘SQLITE_DYNAMIC’
                       z==zBuf ? SQLITE_TRANSIENT : SQLITE_DYNAMIC);
                                                    ^~~~~~~~~~~~~~
Release/obj/gen/sqlite-autoconf-3240000/sqlite3.c:13800:27: warning: cast between incompatible function types from ‘int (*)(void *)’ to ‘void (*)(void *)’ [-Wcast-function-type]
 #define SQLITE_DYNAMIC   ((sqlite3_destructor_type)sqlite3MallocSize)
                           ^
Release/obj/gen/sqlite-autoconf-3240000/sqlite3.c:21428:52: note: in expansion of macro ‘SQLITE_DYNAMIC’
                       z==zBuf ? SQLITE_TRANSIENT : SQLITE_DYNAMIC);
                                                    ^~~~~~~~~~~~~~

With the command, the functions are colled only one time:

> sqlite3@4.0.3 install /home/pi/thelounge/pkg/thelounge-rc/usr/lib/node_modules/thelounge/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
make: ingresso nella directory "/home/pi/thelounge/pkg/thelounge-rc/usr/lib/node_modules/thelounge/node_modules/sqlite3/build"
  ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3240000/sqlite3.c
  TOUCH Release/obj.target/deps/action_before_build.stamp
  CC(target) Release/obj.target/sqlite3/gen/sqlite-autoconf-3240000/sqlite3.o
Release/obj/gen/sqlite-autoconf-3240000/sqlite3.c: In function ‘strftimeFunc’:
Release/obj/gen/sqlite-autoconf-3240000/sqlite3.c:13800:27: warning: cast between incompatible function types from ‘int (*)(void *)’ to ‘void (*)(void *)’ [-Wcast-function-type]
 #define SQLITE_DYNAMIC   ((sqlite3_destructor_type)sqlite3MallocSize)
                           ^
Release/obj/gen/sqlite-autoconf-3240000/sqlite3.c:21428:52: note: in expansion of macro ‘SQLITE_DYNAMIC’
                       z==zBuf ? SQLITE_TRANSIENT : SQLITE_DYNAMIC);
                                                    ^~~~~~~~~~~~~~

Maybe that's the problem...

Superpiffer commented 5 years ago

Here's the problem: https://github.com/mapbox/node-pre-gyp/pull/428 I just tried and with Node 8 it works just fine. So we have to wait until this commit is merged in a new version. Thanks for all. :)

Superpiffer commented 5 years ago

I just tried to build with nodejs 11 the new stable version from AUR and it works! This issue can be closed now. :)