touche icon indicating copy to clipboard operation
touche copied to clipboard

Unable to build on Debian Bullseye

Open m-roberts opened this issue 2 years ago • 4 comments

Describe the bug

git clone https://github.com/JoseExposito/touche.git
cd touche/
sudo apt build-dep .
dpkg-buildpackage

Full output here: https://pastebin.com/PQJycDe5 Relevant output:

Found ninja-1.10.1 at /usr/bin/ninja
   dh_auto_build
	cd obj-arm-linux-gnueabihf && LC_ALL=C.UTF-8 ninja -j4 -v
[1/9] /usr/bin/glib-compile-resources data/data.gresource.xml --sourcedir ../data --internal --generate --target data/com.github.joseexposito.touche.data.gresource --dependency-file data/com.github.joseexposito.touche.data.gresource.d
[2/9] /usr/bin/node /home/pi/touche/bundle/scripts/build.js /home/pi/touche /home/pi/touche/obj-arm-linux-gnueabihf/bundle plain com.github.joseexposito.touche false elementary /usr/share/touchegg/touchegg.conf
FAILED: bundle/com.github.joseexposito.touche.js
/usr/bin/node /home/pi/touche/bundle/scripts/build.js /home/pi/touche /home/pi/touche/obj-arm-linux-gnueabihf/bundle plain com.github.joseexposito.touche false elementary /usr/share/touchegg/touchegg.conf
internal/modules/cjs/loader.js:818
  throw err;
  ^
 
Error: Cannot find module 'webpack'
Require stack:
- /home/pi/touche/bundle/scripts/build.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/pi/touche/bundle/scripts/build.js:20:17)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/pi/touche/bundle/scripts/build.js' ]
}
[3/9] /usr/bin/meson --internal msgfmthelper data/desktop.in data/com.github.joseexposito.touche.desktop desktop ../data/../po
[4/9] /usr/bin/meson --internal msgfmthelper data/app.appdata.xml.in data/com.github.joseexposito.touche.appdata.xml xml ../data/../po
[5/9] c++ -Isubprojects/libtouche/libtouche.so.p -Isubprojects/libtouche -I../subprojects/libtouche -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -g -O2 -ffile-prefix-map=/home/pi/touche=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -MD -MQ subprojects/libtouche/libtouche.so.p/touche.cpp.o -MF subprojects/libtouche/libtouche.so.p/touche.cpp.o.d -o subprojects/libtouche/libtouche.so.p/touche.cpp.o -c ../subprojects/libtouche/touche.cpp
ninja: build stopped: subcommand failed.

The main part:

Error: Cannot find module 'webpack'

I am not very experienced in this area, so I'm not sure what is required.

Environment

  • Build method: standard Debian package tooling on latest stable version of Debian

m-roberts avatar Aug 05 '21 23:08 m-roberts

Hi Mike,

You are missing the npm install step as described here: https://github.com/JoseExposito/touche/blob/master/HACKING.md#compilation

Long story short, I needed an XML parsers and GJS doesn't have one... But npm does.

If you check how the package is generated by CI: https://github.com/JoseExposito/touche/blob/master/.github/workflows/release.yml#L42

You'll notice that with every stable release, I distribute an archive.tar.gz that you can use to build the package without npm.

Let me know if that works for you.

JoseExposito avatar Aug 06 '21 05:08 JoseExposito

In an ideal world, these additional steps would be captured in debian/rules so that dpkg-buildpackage actually invokes these extra commands.

See here for an example of how we handle some npm dependencies from within the Debian packaging system.

m-roberts avatar Aug 09 '21 10:08 m-roberts

I think that adding that rule will be affected by https://github.com/pi-top/action-debian-package/issues/19

JoseExposito avatar Aug 09 '21 15:08 JoseExposito

So this worked for me:

diff --git a/debian/rules b/debian/rules
index 2d33f6a..15c531a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,3 +2,12 @@

 %:
        dh $@
+
+
+override_dh_auto_build:
+       npm ci
+       dh_auto_build
+
+override_dh_clean:
+       rm -rf node_modules
+       dh_clean

Note that we are no longer using the action that you have for building - see here for an example.

This is the repo that handles the build action. I recommend that you give it a try, as we are using it across our entire codebase with much success.

Instead of uses: pi-top/debian-package-build-action@master, I would suggest uses: pi-top/debian-package-build-action@7377e3b0f0e86813246273c35516bda5707e42df or something instead, so that you get repeatable behaviour. Our tooling is still developing, and so from time to time we have breaking changes...

Anyway, hope this helps! We are simply patching touche's source to achieve this same effect until (if?) it is resolved upstream. Note, for some reason we also need to replace npm (>= 3) with npm in the control file, but I'm not sure why.

m-roberts avatar Sep 15 '21 13:09 m-roberts