eclipse-theia / theia

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
http://theia-ide.org
Eclipse Public License 2.0
20.12k stars 2.5k forks source link

Error building @theia/node-pty #5168

Closed jankeromnes closed 5 years ago

jankeromnes commented 5 years ago

Description

Installing Theia dependencies is broken in Gitpod, and in particular building @theia/node-pty.

Reproduction Steps

  1. Open Theia in Gitpod
  2. See the errors in the automated build log

OS and Theia version:

Linux 4.15.0-1028-gcp / trunk

Diagnostics:

This is the full log when yarn is run:

yarn install v1.16.0
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
warning monaco-languageclient@0.9.0: The engine "vscode" appears to be invalid.
warning vscode-base-languageclient@4.4.0: The engine "vscode" appears to be invalid.
info fsevents@1.2.4: The platform "linux" is incompatible with this module.
info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning " > istanbul-instrumenter-loader@3.0.1" has unmet peer dependency "webpack@^2.0.0 || ^3.0.0 || ^4.0.0".
warning " > tslint-language-service@0.9.9" has incorrect peer dependency "typescript@>= 2.3.1 < 3".
warning "workspace-aggregator-64b51a41-eda4-45b4-92c7-b94c817f5662 > @theia/application-manager > font-awesome-webpack@0.0.5-beta.2" has unmet peer dependency "font-awesome@>=4.3.0".
warning "workspace-aggregator-64b51a41-eda4-45b4-92c7-b94c817f5662 > @theia/debug > requestretry@3.1.0" has unmet peer dependency "request@2.*.*".
warning "workspace-aggregator-64b51a41-eda4-45b4-92c7-b94c817f5662 > @theia/application-manager > font-awesome-webpack > less-loader@2.2.3" has incorrect peer dependency "less@^2.3.1".
[5/5] Building fresh packages...
[6/14] ⢀ @theia/node-pty
[2/14] ⢀ dtrace-provider
[3/14] ⢀ electron
[4/14] ⢀ native-keymap
error /workspace/theia/node_modules/@theia/node-pty: Command failed.
Exit code: 1
Command: node scripts/install.js
Arguments:
Directory: /workspace/theia/node_modules/@theia/node-pty
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@10.15.3 | linux | x64
gyp http GET https://nodejs.org/download/release/v10.15.3/node-v10.15.3-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v10.15.3/node-v10.15.3-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v10.15.3/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v10.15.3/SHASUMS256.txt
gyp info spawn /usr/bin/python
gyp info spawn args [ '/workspace/theia/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   '/workspace/theia/node_modules/@theia/node-pty/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/workspace/theia/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/gitpod/.node-gyp/10.15.3/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/gitpod/.node-gyp/10.15.3',
gyp info spawn args   '-Dnode_gyp_dir=/workspace/theia/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/gitpod/.node-gyp/10.15.3/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/workspace/theia/node_modules/@theia/node-pty',
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 make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/workspace/theia/node_modules/@theia/node-pty/build'
  CXX(target) Release/obj.target/pty/src/unix/pty.o
In file included from ../../../nan/nan.h:50,
                 from ../src/unix/pty.cc:20:
/home/gitpod/.node-gyp/10.15.3/include/node/uv.h:24: error: unterminated #ifndef
 #ifndef UV_H

In file included from ../../../nan/nan.h:50,
                 from ../src/unix/pty.cc:20:
/home/gitpod/.node-gyp/10.15.3/include/node/uv.h:1468:69: error: ‘size’ has not been declared
 UV_EXTERN int uv_ip4_name(const struct sockaddr_in* src, char* dst, size
                                                                     ^~~~
In file included from /usr/include/c++/8/bits/stl_algobase.h:59,
                 from /usr/include/c++/8/memory:62,
                 from /home/gitpod/.node-gyp/10.15.3/include/node/v8.h:21,
                 from /home/gitpod/.node-gyp/10.15.3/include/node/node.h:63,
                 from ../../../nan/nan.h:51,
                 from ../src/unix/pty.cc:20:
/usr/include/x86_64-linux-gnu/c++/8/bits/c++config.h:236:1: error: expected ‘,’ or ‘...’ before ‘namespace’
 namespace std
 ^~~~~~~~~
In file included from /usr/include/c++/8/new:40,
                 from /usr/include/c++/8/ext/new_allocator.h:33,
                 from /usr/include/x86_64-linux-gnu/c++/8/bits/c++allocator.h:33,
                 from /usr/include/c++/8/bits/allocator.h:46,
                 from /usr/include/c++/8/memory:63,
                 from /home/gitpod/.node-gyp/10.15.3/include/node/v8.h:21,
                 from /home/gitpod/.node-gyp/10.15.3/include/node/node.h:63,
                 from ../../../nan/nan.h:51,
                 from ../src/unix/pty.cc:20:
/usr/include/c++/8/exception:35:37: error: expected ‘)’ before end of line
 #pragma GCC visibility push(default)
                                     ^
                                     )
In file included from ../../../nan/nan.h:50,
                 from ../src/unix/pty.cc:20:
/home/gitpod/.node-gyp/10.15.3/include/node/uv.h:1468:26: note: to match this ‘(’
 UV_EXTERN int uv_ip4_name(const struct sockaddr_in* src, char* dst, size
                          ^
In file included from /usr/include/c++/8/new:40,
                 from /usr/include/c++/8/ext/new_allocator.h:33,
                 from /usr/include/x86_64-linux-gnu/c++/8/bits/c++allocator.h:33,
                 from /usr/include/c++/8/bits/allocator.h:46,
                 from /usr/include/c++/8/memory:63,
                 from /home/gitpod/.node-gyp/10.15.3/include/node/v8.h:21,
                 from /home/gitpod/.node-gyp/10.15.3/include/node/node.h:63,
                 from ../../../nan/nan.h:51,
                 from ../src/unix/pty.cc:20:
/usr/include/c++/8/exception:35:37: error: expected initializer before end of line
 #pragma GCC visibility push(default)
                                     ^
/usr/include/c++/8/exception:35:37: error: expected ‘}’ before end of line
In file included from ../../../nan/nan.h:50,
                 from ../src/unix/pty.cc:20:
/home/gitpod/.node-gyp/10.15.3/include/node/uv.h:27:12: note: to match this ‘{’
 extern "C" {
            ^
In file included from /usr/include/c++/8/new:40,
                 from /usr/include/c++/8/ext/new_allocator.h:33,
                 from /usr/include/x86_64-linux-gnu/c++/8/bits/c++allocator.h:33,
                 from /usr/include/c++/8/bits/allocator.h:46,
                 from /usr/include/c++/8/memory:63,
                 from /home/gitpod/.node-gyp/10.15.3/include/node/v8.h:21,
                 from /home/gitpod/.node-gyp/10.15.3/include/node/node.h:63,
                 from ../../../nan/nan.h:51,
                 from ../src/unix/pty.cc:20:
/usr/include/c++/8/exception:35:37: error: expected declaration before end of line
 #pragma GCC visibility push(default)
                                     ^
make: *** [pty.target.mk:101: Release/obj.target/pty/src/unix/pty.o] Error 1
make: Leaving directory '/workspace/theia/node_modules/@theia/node-pty/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/workspace/theia/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 4.15.0-1028-gcp
gyp ERR! command "/home/gitpod/.nvm/versions/node/v10.15.3/bin/node" "/workspace/theia/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /workspace/theia/node_modules/@theia/node-pty
jankeromnes commented 5 years ago

Could this be related to the use of Node 10?

The build errors have some similarities with https://github.com/microsoft/node-pty/issues/279.

jankeromnes commented 5 years ago

Strangely, when you retry a fresh Theia dependencies install (with THEIA_ELECTRON_SKIP_REPLACE_FFMPEG=1 yarn because of https://github.com/theia-ide/theia/pull/5055#issuecomment-491186650), it seems to work fine:

$ rm -rf node_modules
$ THEIA_ELECTRON_SKIP_REPLACE_FFMPEG=1 yarn
[...]
@theia/example-electron:     WARNING in Circular dependency detected:
@theia/example-electron:     ../../packages/plugin-ext/lib/common/index.js -> ../../packages/plugin-ext/lib/plugin/plugin-context.js -> ../../packages/plugin-ext/lib/plugin/tree/tree-views.js -> ../../packages/plugin-ext/lib/common/index.js
@theia/example-electron:
@theia/example-electron:     WARNING in Circular dependency detected:
@theia/example-electron:     ../../packages/plugin-ext/lib/plugin/plugin-context.js -> ../../packages/plugin-ext/lib/plugin/tree/tree-views.js ->../../packages/plugin-ext/lib/common/index.js -> ../../packages/plugin-ext/lib/plugin/plugin-context.js
@theia/example-electron:
@theia/example-electron:     WARNING in Circular dependency detected:
@theia/example-electron:     ../../packages/plugin-ext/lib/plugin/tree/tree-views.js -> ../../packages/plugin-ext/lib/common/index.js -> ../../packages/plugin-ext/lib/plugin/plugin-context.js -> ../../packages/plugin-ext/lib/plugin/tree/tree-views.js
lerna success run Ran npm script 'prepare' in packages:
lerna success - @theia/application-manager
lerna success - @theia/application-package
lerna success - @theia/cli
lerna success - @theia/ext-scripts
lerna success - @theia/bunyan
lerna success - @theia/callhierarchy
lerna success - @theia/console
lerna success - @theia/core
lerna success - @theia/cpp
lerna success - @theia/debug-nodejs
lerna success - @theia/debug
lerna success - @theia/editor-preview
lerna success - @theia/editor
lerna success - @theia/editorconfig
lerna success - @theia/extension-manager
lerna success - @theia/file-search
lerna success - @theia/filesystem
lerna success - @theia/getting-started
lerna success - @theia/git
lerna success - @theia/java-debug
lerna success - @theia/java
lerna success - @theia/json
lerna success - @theia/keymaps
lerna success - @theia/languages
lerna success - @theia/markers
lerna success - @theia/merge-conflicts
lerna success - @theia/messages
lerna success - @theia/metrics
lerna success - @theia/mini-browser
lerna success - @theia/monaco
lerna success - @theia/navigator
lerna success - @theia/outline-view
lerna success - @theia/output
lerna success - @theia/plugin-ext-vscode
lerna success - @theia/plugin-ext
lerna success - @theia/plugin
lerna success - @theia/preferences
lerna success - @theia/preview
lerna success - @theia/process
lerna success - @theia/python
lerna success - @theia/search-in-workspace
lerna success - @theia/task
lerna success - @theia/terminal
lerna success - @theia/textmate-grammars
lerna success - @theia/tslint
lerna success - @theia/typehierarchy
lerna success - @theia/typescript
lerna success - @theia/userstorage
lerna success - @theia/variable-resolver
lerna success - @theia/workspace
lerna success - @theia/example-browser
lerna success - @theia/example-electron
Done in 210.08s.
yarn run v1.16.0
$ theia check:hoisted -s
🔍  Analyzing hoisted dependencies in the Theia extensions...
📖  Summary:
The following dependency issues were detected in '@theia/core':
 - error: Dependency 'ajv' [6.5.4] was not hoisted to the root 'node_modules' folder. The same dependency already exists with version 6.5.3 at '/workspace/theia/node_modules/ajv'.
The following dependency issues were detected in '@theia/keymaps':
 - error: Dependency 'ajv' [6.5.4] was not hoisted to the root 'node_modules' folder. The same dependency already exists with version 6.5.3 at '/workspace/theia/node_modules/ajv'.
The following dependency issues were detected in '@theia/workspace':
 - error: Dependency 'ajv' [6.5.4] was not hoisted to the root 'node_modules' folder. The same dependency already exists with version 6.5.3 at '/workspace/theia/node_modules/ajv'.
⚠️  This is a reminder to fix the dependency issues.
Done in 0.44s.
Done in 273.76s.

I'm not sure what's different between the two runs.

AlexTugarev commented 5 years ago

@jankeromnes, please try again. Sometimes there is are hiccups with node-gyp builds.

e.g. from logs you can read such info:

/home/gitpod/.node-gyp/10.15.3/include/node/uv.h:24: error: unterminated #ifndef

so, node-gyp tried to download some headers, but they're likely broken. rm -rf ./node_modules && rm -rm ~/.node-gyp && yarn should do a clean build in such cases.

jankeromnes commented 5 years ago

This issue seems to have fixed itself. Closing for now.