element-hq / element-desktop

A glossy Matrix collaboration client for desktop.
https://element.io
GNU Affero General Public License v3.0
1.16k stars 266 forks source link

build fails with python 3.12 #1633

Open selfisekai opened 6 months ago

selfisekai commented 6 months ago

Steps to reproduce

  1. build element-desktop with keytar hak

Outcome

What did you expect?

keytar hak being built successfully

What happened instead?

gyp info it worked if it ends with ok
gyp info using node-gyp@8.4.1
gyp info using node@20.12.2 | linux | x64
gyp info find Python using Python version 3.12.3 found at "/usr/bin/python3"
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/builds/selfisekai/aports/testing/element-desktop/src/element-desktop-1.11.64/.hak/keytar/x86_64-alpine-linux-musl/build/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/builds/selfisekai/aports/testing/element-desktop/src/element-desktop-1.11.64/.hak/keytar/x86_64-alpine-linux-musl/build/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/builds/selfisekai/aports/testing/element-desktop/src/element-desktop-1.11.64/.hak/keytar/x86_64-alpine-linux-musl/build/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/include/electron/node_headers/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/usr/include/electron/node_headers',
gyp info spawn args   '-Dnode_gyp_dir=/builds/selfisekai/aports/testing/element-desktop/src/element-desktop-1.11.64/.hak/keytar/x86_64-alpine-linux-musl/build/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/usr/include/electron/node_headers/$(Configuration)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/builds/selfisekai/aports/testing/element-desktop/src/element-desktop-1.11.64/.hak/keytar/x86_64-alpine-linux-musl/build',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
Traceback (most recent call last):
  File "/builds/selfisekai/aports/testing/element-desktop/src/element-desktop-1.11.64/.hak/keytar/x86_64-alpine-linux-musl/build/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
    import gyp  # noqa: E402
    ^^^^^^^^^^
  File "/builds/selfisekai/aports/testing/element-desktop/src/element-desktop-1.11.64/.hak/keytar/x86_64-alpine-linux-musl/build/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
    import gyp.input
  File "/builds/selfisekai/aports/testing/element-desktop/src/element-desktop-1.11.64/.hak/keytar/x86_64-alpine-linux-musl/build/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/builds/selfisekai/aports/testing/element-desktop/src/element-desktop-1.11.64/.hak/keytar/x86_64-alpine-linux-musl/build/node_modules/node-gyp/lib/configure.js:259:16)
gyp ERR! stack     at ChildProcess.emit (node:events:518:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
gyp ERR! System Linux 6.1.41-0-lts
gyp ERR! command "/usr/bin/node" "/builds/selfisekai/aports/testing/element-desktop/src/element-desktop-1.11.64/.hak/keytar/x86_64-alpine-linux-musl/build/node_modules/.bin/node-gyp" "rebuild" "--arch" "x64"
gyp ERR! cwd /builds/selfisekai/aports/testing/element-desktop/src/element-desktop-1.11.64/.hak/keytar/x86_64-alpine-linux-musl/build
gyp ERR! node -v v20.12.2
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok 
1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Operating system

Alpine Linux edge

Application version

1.11.64

How did you install the app?

No response

Homeserver

No response

Will you send logs?

No

hardfalcon commented 6 months ago

On Archlinux, I could solve this by adding the python-setuptools package to the makedepends array in the PKGBUILD. Therefore I think that you can probably solve this on Alpine by adding the py3-setuptools package to the makedepends array in the APKBUILD file.

//EDIT: Also, see commit https://github.com/element-hq/element-desktop/commit/b2b7bcb5afe4b28a069ba299a55222c8ce0dfe29

t3chguy commented 6 months ago

Yeah this is a breaking change in Python 3.12 which we also had to workaround as per the commit @hardfalcon identified. Not sure what this issue is asking for?

selfisekai commented 6 months ago

forcing node-gyp 10 in keytar hak, which will bring this change: https://github.com/nodejs/gyp-next/commit/874233e19748f584f73461d636d4ae9f86a88c7b#diff-1ca01eae7eba1639aa26c577cf7693539f8423a7b3a979c944f4b44ff55922fc

t3chguy commented 6 months ago

Which we can't do without either the upstream making that change or something like https://github.com/element-hq/element-desktop/issues/1634