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

patch for OpenBSD to fix undeclared identifier forkpty #637

Open
ericlenio opened this issue Oct 12, 2023 · 0 comments
Open

patch for OpenBSD to fix undeclared identifier forkpty #637

ericlenio opened this issue Oct 12, 2023 · 0 comments

Comments

@ericlenio
Copy link

Environment details

  • OS: OpenBSD
  • OS version: 7.1
  • node-pty version: 1.0.0

Issue description

I was getting this error while compiling:

> [email protected] install
> node-gyp rebuild

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | openbsd | x64
gyp info find Python using Python version 3.9.13 found at "/usr/local/bin/python3"
gyp info spawn /usr/local/bin/python3
gyp info spawn args [
gyp info spawn args   '/home/el13/incubator/node-pty/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/el13/incubator/node-pty/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/el13/incubator/node-pty/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/el13/.cache/node-gyp/16.14.2/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/el13/.cache/node-gyp/16.14.2',
gyp info spawn args   '-Dnode_gyp_dir=/home/el13/incubator/node-pty/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/el13/.cache/node-gyp/16.14.2/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/el13/incubator/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 args ]
gypgmake: Entering directory '/home/el13/incubator/node-pty/build'
 info  CXX(target) Release/obj.target/pty/src/unix/pty.o
 spawn gmake
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
../src/unix/pty.cc:296:9: error: use of undeclared identifier 'forkpty'
  pid = forkpty(&master, nullptr, static_cast<termios*>(term), static_cast<winsize*>(&winp));
        ^
../src/unix/pty.cc:413:13: error: use of undeclared identifier 'openpty'
  int ret = openpty(&master, &slave, nullptr, NULL, static_cast<winsize*>(&winp));
            ^
2 errors generated.
gmake: *** [pty.target.mk:113: Release/obj.target/pty/src/unix/pty.o] Error 1
gmake: Leaving directory '/home/el13/incubator/node-pty/build'
gyp ERR! build error 

I was able to compile with this patch:

diff --git a/src/unix/pty.cc b/src/unix/pty.cc
index 309d38f..0889772 100644
--- a/src/unix/pty.cc
+++ b/src/unix/pty.cc
@@ -38,6 +38,8 @@
 #include <util.h>
 #elif defined(__FreeBSD__)
 #include <libutil.h>
+#elif defined(__OpenBSD__)
+#include <util.h>
 #endif
 
 /* Some platforms name VWERASE and VDISCARD differently */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant