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

dev-util/electron-20.3.12-r1: Not possible to build with python 3.11.x #238

Closed
Imred-Gemu opened this issue Jun 23, 2023 · 10 comments
Closed
Labels
bug Something isn't working

Comments

@Imred-Gemu
Copy link

I need to build Electron 19 or 20 due to the tree sitter issue in VSCode. As far as I understand, the only workaround for this currently is to use a version of Electron <21, however it is possible to build neither version with the current default version of Python from the main Gentoo repository. Both fail with the same error as shown in the attached logs: ValueError: invalid mode: 'rU'.
build.log

@Imred-Gemu Imred-Gemu added the bug Something isn't working label Jun 23, 2023
@PF4Public
Copy link
Owner

Please try patching it like this:

--- a/tools/grit/grit/util.py
+++ b/tools/grit/grit/util.py
@@ -209,7 +209,7 @@
     mode = 'rb'
     encoding = None
   else:
-    mode = 'rU'
+    mode = 'r'
 
   with io.open(filename, mode, encoding=encoding) as f:
     return f.read()

@PF4Public
Copy link
Owner

BTW, what issue are you referring to exactly? There is an issue on ppc64 platform, that makes electron-19 and electron-20 the only options for now (and it is the reason I keep them in overlay).

If you're on amd64 platform, you could try building vscode with electron-25. You need to build manually with the help of ebuild utility and revert e80a226 in environment before src_configure step.

At least it worked for me:
image

@Imred-Gemu
Copy link
Author

BTW, what issue are you referring to exactly? There is an issue on ppc64 platform, that makes electron-19 and electron-20 the only options for now (and it is the reason I keep them in overlay).

If you're on amd64 platform, you could try building vscode with electron-25. You need to build manually with the help of ebuild utility and revert e80a226 in environment before src_configure step.

At least it worked for me: image

I did see that you had mentioned you were able to build VSCode with Electron 25 in another issue, however when I tried it with app-editors/vscode-1.79.2, I received the same error: Error: bad export type for tree_sitter_typescript_external_scanner_create: undefined. The commit you mentioned looks like it only changed the live ebuild, is that the only version you had working with Electron 25?

@PF4Public
Copy link
Owner

PF4Public commented Jun 24, 2023

You need to build manually with the help of ebuild utility and revert e80a226 in environment before src_configure step.

As I've written above you need to replace /usr/bin/node with node in order to attempt building via electron's built-in node instead of the system node. This would be only possible if you build with ebuild instead of emerge.

Alternatively you could try downgrading system node.

@Imred-Gemu
Copy link
Author

As I've written above you need to replace /usr/bin/node with node in order to attempt building via electron's built-in node instead of the system node. This would be only possible if you build with ebuild instead of emerge.

Sorry, I hadn't looked in the ebuild for app-editors/vscode-1.79.2, I see now it has the same changes. After switching it back to using Electron as Node, I was able to build using Electron 25, thank you very much for your help. I am building Electron 20 with the patch you suggested for the original issue, I will post if it succeeds or not.

@Imred-Gemu
Copy link
Author

dev-util/electron-20.3.12-r1 built successfully with the above patch and the dependency on the xml use flag from the Python package removed, as this use flag was dropped in the 3.11.x Python ebuilds.

@NriotHrreion
Copy link

NriotHrreion commented Feb 17, 2024

BTW, what issue are you referring to exactly? There is an issue on ppc64 platform, that makes electron-19 and electron-20 the only options for now (and it is the reason I keep them in overlay).

If you're on amd64 platform, you could try building vscode with electron-25. You need to build manually with the help of ebuild utility and revert e80a226 in environment before src_configure step.

At least it worked for me: image

@PF4Public I've read through the issues you created about the tree_sitter_tsx_external_scanner_create. And I got here and tried to change my electron version from 27.3.2 to 25.1.1 in package.json.

But when I re-ran yarn to re-install the dependencies, it stuck at

[4/4] Building fresh packages...
[20/20] ⠈ windows-foreground-love
[8/20] ⠈ @vscode/windows-process-tree
[18/20] ⠈ electron
[14/20] ⠈ node-pty
[5/20] ⠈ @vscode/spdlog

for a while and then reported

error D:\vscode\node_modules\electron: Command failed.
Exit code: 1
Command: node install.js
Arguments:
Directory: D:\vscode\node_modules\electron
Output:
ReadError: The server aborted pending request
    at IncomingMessage.<anonymous> (D:\vscode\node_modules\got\dist\source\core\index.js:809:31)
    at Object.onceWrapper (node:events:632:28)
    at IncomingMessage.emit (node:events:530:35)
    at origin.emit (D:\vscode\node_modules\@szmarczak\http-timer\dist\source\index.js:43:20)
    at IncomingMessage._destroy (node:_http_incoming:224:10)
    at _destroy (node:internal/streams/destroy:121:10)
    at IncomingMessage.destroy (node:internal/streams/destroy:83:5)

Btw, I've tried multiple times and it always ends with this error. So I made this comment under this issue page to find some help.

@NriotHrreion
Copy link

NriotHrreion commented Feb 17, 2024

I tried some other versions (19 20 etc.) of electron just now and got RequestError: read ECONNRESET and RequestError: socket hang up error. Plus, I didn't use any proxy app during the installation.

And the version 28 will still get tree_sitter_tsx_external_scanner_create error after installing dependencies and running yarn watch.

@NriotHrreion
Copy link

I solved this by switching my node version from 20.11.1 to 18.16.0.

@PF4Public
Copy link
Owner

@NriotHrreion You seem to be on Windows. On Linux I solve this issue by running electron as node: ELECTRON_RUN_AS_NODE=1 electron. This works since electron has node 18 inside. The other solution (as you've already discovered) is to downgrade the real node and use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants