Open jpcastberg opened 2 weeks ago
I can see something similar with 4.90.2 build on the homebrew side
npm error gyp verb node dev dir /private/tmp/code-server-20240615-37528-12y8ws/package/.brew_home/Library/Caches/node-gyp/20.14.0
npm error gyp verb python /Applications/Xcode.app/Contents/Developer/usr/bin/python3
npm error gyp verb `which` succeeded for `make` /opt/homebrew/Library/Homebrew/shims/mac/super/make
npm error gyp verb bin symlinks created symlink to "/Applications/Xcode.app/Contents/Developer/usr/bin/python3" in "/private/tmp/code-server-20240615-37528-12y8ws/package/lib/vscode/node_modules/kerberos/build/node_gyp_bins" and added to PATH
npm error gyp info spawn make
npm error gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
npm error In file included from ../src/kerberos.cc:1:
npm error In file included from ../src/kerberos.h:11:
npm error In file included from ../node_modules/node-addon-api/napi.h:2981:
npm error ../node_modules/node-addon-api/napi-inl.h:64:12: error: no matching function for call to 'napi_add_finalizer'
npm error status = napi_add_finalizer(env, obj, data, finalizer, hint, nullptr);
npm error ^~~~~~~~~~~~~~~~~~
npm error ../node_modules/node-addon-api/napi-inl.h:2192:29: note: in instantiation of function template specialization 'Napi::details::AttachData<Napi::MethodCallbackData<node_kerberos::KerberosClient, Napi::Value (*)(const Napi::CallbackInfo &)>>' requested here
npm error status = Napi::details::AttachData(env, *result, data);
npm error ^
npm error ../node_modules/node-addon-api/napi-inl.h:4165:16: note: in instantiation of function template specialization 'Napi::CreateFunction<Napi::MethodCallbackData<node_kerberos::KerberosClient, Napi::Value (*)(const Napi::CallbackInfo &)>>' requested here
npm error status = CreateFunction(env,
npm error ^
npm error ../node_modules/node-addon-api/napi-inl.h:4224:10: note: in instantiation of member function 'Napi::ObjectWrap<node_kerberos::KerberosClient>::DefineClass' requested here
npm error return DefineClass(env,
npm error ^
npm error ../src/kerberos.cc:42:9: note: in instantiation of member function 'Napi::ObjectWrap<node_kerberos::KerberosClient>::DefineClass' requested here
npm error DefineClass(env,
npm error ^
@jpcastberg Delete your /root/.cache/node-gyp
directory and try again.
The error is caused by node-pty
.
👉 Check https://github.com/microsoft/node-pty for possible issues on FreeBSD 13.
@benz0li Thanks for the direction - no dice though :( I don't see any issues in node-pty, open or closed that seem to relate to what I'm seeing. Though - I do see that I have the termios header file on the machine:
$ ls /usr/include | grep termios
termios.h
I have pretty limited knowledge of c, but it seems like it's not looking in the right place for my header files when node-pty's gyp script runs. Am going to attempt debugging this tonight...
Well - the good news is that for node-pty, all I needed to do was import the header file in the right block. I opened a pull request over there to fix that https://github.com/microsoft/node-pty/pull/688 . Unfortunately, I've hit another node-gyp built addon in vscode that isn't playing nice with Freebsd - Kerberos:
> kerberos@2.1.0 install
> prebuild-install --runtime napi || node-gyp rebuild
prebuild-install warn install No prebuilt binaries found (target=4 runtime=napi arch=x64 libc= platform=freebsd)
gyp info it worked if it ends with ok
gyp info using node-gyp@10.1.0
gyp info using node@20.14.0 | freebsd | x64
gyp info find Python using Python version 3.11.9 found at "/usr/local/bin/python3.11"
gyp info spawn /usr/local/bin/python3.11
gyp info spawn args [
gyp info spawn args '/home/john/kerberos/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 '/home/john/kerberos/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/john/kerberos/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/root/.cache/node-gyp/20.14.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/20.14.0',
gyp info spawn args '-Dnode_gyp_dir=/home/john/kerberos/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/20.14.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/home/john/kerberos',
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 ]
gyp info spawn gmake
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
gmake: Entering directory '/home/john/kerberos/build'
CXX(target) Release/obj.target/kerberos/src/kerberos.o
In file included from ../src/kerberos.cc:1:
In file included from ../src/kerberos.h:13:
In file included from ../src/kerberos_common.h:13:
../src/win32/kerberos_sspi.h:22:10: fatal error: 'windows.h' file not found
22 | #include <windows.h>
| ^~~~~~~~~~~
1 error generated.
gmake: *** [kerberos.target.mk:102: Release/obj.target/kerberos/src/kerberos.o] Error 1
gmake: Leaving directory '/home/john/kerberos/build'
gyp ERR! build error
gyp ERR! stack Error: `gmake` failed with exit code: 2
gyp ERR! stack at ChildProcess.<anonymous> (/home/john/kerberos/node_modules/node-gyp/lib/build.js:209:23)
gyp ERR! System FreeBSD 13.2-RELEASE-p10
gyp ERR! command "/usr/local/bin/node" "/home/john/kerberos/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /home/john/kerberos
gyp ERR! node -v v20.14.0
gyp ERR! node-gyp -v v10.1.0
gyp ERR! not ok
This Kerberos project, another vscode dependency, makes no mention of FreeBSD support - I take it that in order to run code-server, I'll need to make all of vscode's dependencies build nicely?
Again, thank ya'll for your help :)
Cross reference:
The kerberos
dependency is imported on demand, so if you are not using Kerberos then there should be no negative side effects to not having the dependency.
The only issue I could see is that if the problem building kerberos
causes npm to abort and not install some other required dependency, but I am not sure if npm is like this or if it always tries to install as much as it can.
If the former, this would be an annoying workaround, but one could download the tarball, remove kerberos
from lib/vscode/package.json
and then run npm install
in the root.
But maybe there is a more clever way of omitting a dependency from the user side. IMO it should be made an optional dependency; maybe that is something we should patch, or maybe they would accept it upstream.
I got it mostly working, though terminal and workspace search in files seem to be broken. Here are the steps:
run:
pkg install git npm-node20 krb5-devel
git clone https://github.com/mongodb-js/kerberos
git clone https://github.com/microsoft/node-pty.git
cd node-pty; npm install; cd ..
Then modify the following code in the kerberos directory to match the below (From: https://github.com/coder/code-server/issues/6499#issuecomment-1774897502):
kerberos/binding.gyp:
'include_dirs': [
"/usr/local/include",
"<!(node -p \"require('node-addon-api').include_dir\")"
],
['OS=="mac" or OS=="linux" or OS=="freebsd"', {
kerberos/src/kerberos_common.h:
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
then:
cd kerberos; npm install; cd ..;
then:
npm pack code-server;
tar -xzf code-server-4.90.2.tgz;
this will create a directory called package
- now modify:
package/lib/vscode/package.json
and change the lines for kerberos and node-pty and point them to the directories of the repos you downloaded:
"kerberos": "file:/path/to/kerberos",
"node-pty": "file:/path/to/node-pty",
then:
cd package;
npm install -g --unsafe-perm
This should give you the code-server
binary in your path, which you can run. If you're like me and are running code-server
on a remote machine, run as so:
code-server --bind-addr '0.0.0.0:8080'
It'll print the location of a file where you can get your password. Hope this helps someone!
Nice!
The terminal relies on node-pty
of course but it seems weird it is broken since you got it building, right? Maybe there is some other native module still failing.
Workspace search depends on the @vscode/ripgrep
module which downloads the rg
binary, maybe it is downloading one incompatible with FreeBSD (should be located at lib/vscode/node_modules/@vscode/ripgrep/bin/rg
).
Is there an existing issue for this?
OS/Web Information
code-server --version
: 4.90.2 via npmSteps to Reproduce
Install node 20:
Install dependencies per instructions described here
Attempt to install via install script:
Expected
code-server should install successfully
Actual
errors are generated during the install process, installation fails.
Logs
Screenshot/Video
No response
Does this bug reproduce in native VS Code?
This cannot be tested in native VS Code
Does this bug reproduce in GitHub Codespaces?
This cannot be tested in GitHub Codespaces
Are you accessing code-server over a secure context?
Notes
Thank you in advance for the help - I am very excited to use code-server for work as it now supports node 20, which we have on our remote machines. Happy to do as much troubleshooting as needed.