Closed villisek closed 1 year ago
Same issue here when trying to compile LTS 14 on OpenBSD 7.0, no update or no one can help? :)
I'm attempting to build LTS 16.13.2 on OpenBSD 7.0 and ran into the same problem. I was able to get around that particular issue by running the following from the source directory after configure
has finished
sed -i -E 's/-ldl[[:space:]]*//' out/deps/openssl/*
That just prevents libdl
from being included, which as far as I know, it should not be when building on OpenBSD (and other BSD variants). I did not spend the time trying to find out exactly why the make files are being generated to include it in the first place, so this just removes it after it has already been added in the configure step.
The bad news is, that wasn't the last problem because now I get a new error message:
ld: error: undefined symbol: v8::base::Stack::GetStackStart()
when building the file:
node-v16.13.2/files/out/Release/mksnapshot
I'm using the Clang compilers that are included with OpenBSD 7.0
@nodejs/platform-freebsd @nodejs/build Tagging the FreeBSD folks and the Build folks as they are the most likely to be able to help, but this isn't a supported platform so there may not be much relevant expertise available.
That last error I received was due to me having edited a file trying to solve another error that complained about an undefined reference: pthread_getattr_np
I'm trying something else now, I'll report back later if I have any luck.
@nodejs/platform-freebsd @nodejs/build Tagging the FreeBSD folks and the Build folks as they are the most likely to be able to help, but this isn't a supported platform so there may not be much relevant expertise available.
Thanks!
That last error I received was due to me having edited a file trying to solve another error that complained about an undefined reference:
pthread_getattr_np
I confirm I faced that undefined reference when trying to compile Node v14.
I was able to compile after a few edits. OpenBSD uses W^X by default unless the program is run from /usr/local
. I'm using nvm to compile node which means it needs to run from my home directory. In order to do so, I have to mount my /home
partition with the option wxallowed
. So keep in mind you may need to add the wxallowed
mount option depending on where you install node. Hopefully in the future node (v8) will be completely usable with W^X.
The edits I made have to do with the v8
and openssl
dependencies, so I don't know if they are eligible to be merged into the node repository, or if they need to be fixed in their respective upstreams before being integrated with node.
The commit https://github.com/localscope/node/commit/1746ee6a9a2c40a853e64485fd2fa43de446d07b contains the changes I made; it is based on release 16.3.2
The build appears to be working fine for me so far, but I have not heavily tested it.
The edits I made have to do with the
v8
andopenssl
dependencies
We float several patches on v8
, fewer (possibly 0) for openssl
. But AFAIK we only float patches that have been submitted (and accepted) upstream (so that eventually we can stop floating them).
The edits I made have to do with the
v8
andopenssl
dependenciesWe float several patches on
v8
, fewer (possibly 0) foropenssl
. But AFAIK we only float patches that have been submitted (and accepted) upstream (so that eventually we can stop floating them).
@targos @tniessen Am I right about that?
I don't know about changes to openssl
source code, but here the changes are only in GYP files, which are not part of upstream, so submitting them here seems fine.
You are right about V8. We do have some floating patches that have not been submitted upstream but they are "temporary hacks" (mostly to support old Windows compilers) that do not make sense upstream.
About https://github.com/localscope/node/commit/1746ee6a9a2c40a853e64485fd2fa43de446d07b, I think it is worth trying to upstream the changes to src/base/platform/platform-openbsd.cc
and src/base/platform/platform-posix.cc
. See https://v8.dev/docs/contribute
I made a small revert because I discovered that the linker option wxneeded
is already included in common.gypi
, so my inclusion of it was redundant.
My latest commit is https://github.com/localscope/node/commit/62fdc1ffd63dde16c2404faf40df96a578ca7d78
Thank you all for your replies. I may have time on Sunday to try your patches. I'll tell you then :)
Note on one FreeBSD question above - we don't use libdl on FreeBSD, but we do provide it as a (dummy) filter library because so much software wants to add -ldl
$ readelf -d /usr/lib/libdl.so.1
Dynamic section at offset 0xd20 contains 27 entries:
Tag Type Name/Value
0x000000007fffffff FILTER Filter library: [libc.so.7]
0x0000000000000001 NEEDED Shared library: [libc.so.7]
0x000000000000000e SONAME Library soname: [libdl.so.1]
...
I made a small revert because I discovered that the linker option
wxneeded
is already included incommon.gypi
, so my inclusion of it was redundant.My latest commit is localscope@62fdc1f
Absolutely will try on the weekend and see how it does π π π Thank you so much π―
I made a small revert because I discovered that the linker option
wxneeded
is already included incommon.gypi
, so my inclusion of it was redundant.My latest commit is localscope@62fdc1f
Hi, I just tried on my OpenBSD 7.0 current
, it seems still not working, I confirmed I pull the fix-openbsd-build
branch with your latest fix commits:
But it still fail at the end (with different error):
My commands:
# Install dependencies
doas pkg_add gcc g++ llvm py3-llvm gas
# Set the vars
export CC=egcc
export CXX=eg++
# Clone your branch
git clone --branch fix-openbsd-build https://github.com/localscope/node.git node-16-openbsd
cd node-16-openbsd
# Compile instruction from official node repo
./configure --openssl-no-asm
gmake
And here is the error log:
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:40:43: warning: 'struct session_op' declared inside parameter list will not be visible outside of this definition or declaration
static int clean_devcrypto_session(struct session_op *sess) {
^~~~~~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c: In function 'clean_devcrypto_session':
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:41:20: error: 'CIOCFSESSION' undeclared (first use in this function); did you mean 'SIOCSETVLAN'?
if (ioctl(cfd, CIOCFSESSION, &sess->ses) < 0) {
^~~~~~~~~~~~
SIOCSETVLAN
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:41:20: note: each undeclared identifier is reported only once for each function it appears in
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:41:39: error: dereferencing pointer to incomplete type 'struct session_op'
if (ioctl(cfd, CIOCFSESSION, &sess->ses) < 0) {
^~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:45:28: error: invalid application of 'sizeof' to incomplete type 'struct session_op'
memset(sess, 0, sizeof(struct session_op));
^~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c: At top level:
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:60:23: error: field 'sess' has incomplete type
struct session_op sess;
^~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:78:48: error: 'CRYPTO_DES_CBC' undeclared here (not in a function); did you mean 'CRYPTO_AES_CBC'?
{ NID_des_cbc, 8, 8, 8, EVP_CIPH_CBC_MODE, CRYPTO_DES_CBC },
^~~~~~~~~~~~~~
CRYPTO_AES_CBC
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:91:50: error: 'CRYPTO_ARC4' undeclared here (not in a function); did you mean 'CRYPTO_ONCE'?
{ NID_rc4, 1, 16, 0, EVP_CIPH_STREAM_CIPHER, CRYPTO_ARC4 },
^~~~~~~~~~~
CRYPTO_ONCE
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:114:7: error: 'CRYPTO_CAMELLIA_CBC' undeclared here (not in a function); did you mean 'CRYPTO_AES_CBC'?
CRYPTO_CAMELLIA_CBC },
^~~~~~~~~~~~~~~~~~~
CRYPTO_AES_CBC
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c: In function 'cipher_init':
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:158:25: error: '(const struct cipher_data_st *)&<erroneous-expression>' is a pointer; did you mean to use '->'?
if (cipher_ctx->sess.ses != 0 &&
^
->
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:159:33: warning: passing argument 1 of 'clean_devcrypto_session' from incompatible pointer type [-Wincompatible-pointer-types]
clean_devcrypto_session(&cipher_ctx->sess) == 0)
^~~~~~~~~~~~~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:40:55: note: expected 'struct session_op *' but argument is of type 'const struct cipher_data_st (*)[1]'
static int clean_devcrypto_session(struct session_op *sess) {
~~~~~~~~~~~~~~~~~~~^~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:162:21: error: '(const struct cipher_data_st *)&<erroneous-expression>' is a pointer; did you mean to use '->'?
cipher_ctx->sess.cipher = cipher_d->devcryptoid;
^
->
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:162:5: warning: statement with no effect [-Wunused-value]
cipher_ctx->sess.cipher = cipher_d->devcryptoid;
^~~~~~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:163:21: error: '(const struct cipher_data_st *)&<erroneous-expression>' is a pointer; did you mean to use '->'?
cipher_ctx->sess.keylen = cipher_d->keylen;
^
->
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:163:5: warning: statement with no effect [-Wunused-value]
cipher_ctx->sess.keylen = cipher_d->keylen;
^~~~~~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:164:21: error: '(const struct cipher_data_st *)&<erroneous-expression>' is a pointer; did you mean to use '->'?
cipher_ctx->sess.key = (void *)key;
^
->
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:164:5: warning: statement with no effect [-Wunused-value]
cipher_ctx->sess.key = (void *)key;
^~~~~~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:165:28: error: 'COP_ENCRYPT' undeclared (first use in this function); did you mean 'PKCS7_ENCRYPT'?
cipher_ctx->op = enc ? COP_ENCRYPT : COP_DECRYPT;
^~~~~~~~~~~
PKCS7_ENCRYPT
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:165:42: error: 'COP_DECRYPT' undeclared (first use in this function); did you mean 'CRD_F_ENCRYPT'?
cipher_ctx->op = enc ? COP_ENCRYPT : COP_DECRYPT;
^~~~~~~~~~~
CRD_F_ENCRYPT
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:165:20: warning: assignment to 'int' from 'const struct cipher_data_st *' makes integer from pointer without a cast [-Wint-conversion]
cipher_ctx->op = enc ? COP_ENCRYPT : COP_DECRYPT;
^
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:168:20: error: 'CIOCGSESSION' undeclared (first use in this function); did you mean 'SIOCSETVLAN'?
if (ioctl(cfd, CIOCGSESSION, &cipher_ctx->sess) < 0) {
^~~~~~~~~~~~
SIOCSETVLAN
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:168:20: warning: passing argument 2 of 'ioctl' makes integer from pointer without a cast [-Wint-conversion]
In file included from ../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:15:
/usr/include/sys/ioctl.h:52:16: note: expected 'long unsigned int' but argument is of type 'const struct cipher_data_st *'
int ioctl(int, unsigned long, ...);
^~~~~~~~~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c: In function 'cipher_do_cipher':
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:181:21: error: storage size of 'cryp' isn't known
struct crypt_op cryp;
^~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:189:12: warning: passing argument 1 of 'memset' discards 'const' qualifier from pointer target type [-Wdiscarded-array-qualifiers]
memset(&cryp, 0, sizeof(cryp));
^~~~~
In file included from ../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:11:
/usr/include/string.h:71:7: note: expected 'void *' but argument is of type 'const struct cipher_data_st (*)[1]'
void *memset(void *, int, size_t)
^~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:189:22: warning: passing argument 3 of 'memset' makes integer from pointer without a cast [-Wint-conversion]
memset(&cryp, 0, sizeof(cryp));
^~~~~~~~~~~~
In file included from ../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:11:
/usr/include/string.h:71:7: note: expected 'size_t' {aka 'long unsigned int'} but argument is of type 'const struct cipher_data_st *'
void *memset(void *, int, size_t)
^~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:190:9: error: '(const struct cipher_data_st *)&<erroneous-expression>' is a pointer; did you mean to use '->'?
cryp.ses = cipher_ctx->sess.ses;
^
->
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:190:32: error: '(const struct cipher_data_st *)&<erroneous-expression>' is a pointer; did you mean to use '->'?
cryp.ses = cipher_ctx->sess.ses;
^
->
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:190:5: warning: statement with no effect [-Wunused-value]
cryp.ses = cipher_ctx->sess.ses;
^~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:191:9: error: '(const struct cipher_data_st *)&<erroneous-expression>' is a pointer; did you mean to use '->'?
cryp.len = inl;
^
->
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:191:5: warning: statement with no effect [-Wunused-value]
cryp.len = inl;
^~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:192:9: error: '(const struct cipher_data_st *)&<erroneous-expression>' is a pointer; did you mean to use '->'?
cryp.src = (void *)in;
^
->
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:192:5: warning: statement with no effect [-Wunused-value]
cryp.src = (void *)in;
^~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:193:9: error: '(const struct cipher_data_st *)&<erroneous-expression>' is a pointer; did you mean to use '->'?
cryp.dst = (void *)out;
^
->
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:193:5: warning: statement with no effect [-Wunused-value]
cryp.dst = (void *)out;
^~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:194:9: error: '(const struct cipher_data_st *)&<erroneous-expression>' is a pointer; did you mean to use '->'?
cryp.iv = (void *)iv;
^
->
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:194:5: warning: statement with no effect [-Wunused-value]
cryp.iv = (void *)iv;
^~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:195:9: error: '(const struct cipher_data_st *)&<erroneous-expression>' is a pointer; did you mean to use '->'?
cryp.op = cipher_ctx->op;
^
->
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:195:5: warning: statement with no effect [-Wunused-value]
cryp.op = cipher_ctx->op;
^~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:197:9: error: '(const struct cipher_data_st *)&<erroneous-expression>' is a pointer; did you mean to use '->'?
cryp.flags = 0;
^
->
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:197:5: warning: statement with no effect [-Wunused-value]
cryp.flags = 0;
^~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:220:20: error: 'CIOCCRYPT' undeclared (first use in this function)
if (ioctl(cfd, CIOCCRYPT, &cryp) < 0) {
^~~~~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:220:20: warning: passing argument 2 of 'ioctl' makes integer from pointer without a cast [-Wint-conversion]
In file included from ../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:15:
/usr/include/sys/ioctl.h:52:16: note: expected 'long unsigned int' but argument is of type 'const struct cipher_data_st *'
int ioctl(int, unsigned long, ...);
^~~~~~~~~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:181:21: warning: unused variable 'cryp' [-Wunused-variable]
struct crypt_op cryp;
^~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c: In function 'cipher_ctrl':
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:312:16: warning: passing argument 1 of 'memset' discards 'const' qualifier from pointer target type [-Wdiscarded-array-qualifiers]
memset(&to_cipher_ctx->sess, 0, sizeof(to_cipher_ctx->sess));
^~~~~~~~~~~~~~~~~~~~
In file included from ../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:11:
/usr/include/string.h:71:7: note: expected 'void *' but argument is of type 'const struct cipher_data_st (*)[1]'
void *memset(void *, int, size_t)
^~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:312:41: warning: passing argument 3 of 'memset' makes integer from pointer without a cast [-Wint-conversion]
memset(&to_cipher_ctx->sess, 0, sizeof(to_cipher_ctx->sess));
^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:11:
/usr/include/string.h:71:7: note: expected 'size_t' {aka 'long unsigned int'} but argument is of type 'const struct cipher_data_st *'
void *memset(void *, int, size_t)
^~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:313:52: error: '(const struct cipher_data_st *)&<erroneous-expression>' is a pointer; did you mean to use '->'?
return cipher_init(to_ctx, cipher_ctx->sess.key, EVP_CIPHER_CTX_iv(ctx),
^
->
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:314:47: error: 'COP_ENCRYPT' undeclared (first use in this function); did you mean 'PKCS7_ENCRYPT'?
(cipher_ctx->op == COP_ENCRYPT));
^~~~~~~~~~~
PKCS7_ENCRYPT
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:314:44: warning: comparison between pointer and integer
(cipher_ctx->op == COP_ENCRYPT));
^~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:313:36: warning: passing argument 2 of 'cipher_init' from incompatible pointer type [-Wincompatible-pointer-types]
return cipher_init(to_ctx, cipher_ctx->sess.key, EVP_CIPHER_CTX_iv(ctx),
^~~~~~~~~~~~~~~~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:149:66: note: expected 'const unsigned char *' but argument is of type 'const struct cipher_data_st *'
static int cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
~~~~~~~~~~~~~~~~~~~~~^~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:317:16: warning: passing argument 1 of 'memset' discards 'const' qualifier from pointer target type [-Wdiscarded-array-qualifiers]
memset(&cipher_ctx->sess, 0, sizeof(cipher_ctx->sess));
^~~~~~~~~~~~~~~~~
In file included from ../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:11:
/usr/include/string.h:71:7: note: expected 'void *' but argument is of type 'const struct cipher_data_st (*)[1]'
void *memset(void *, int, size_t)
^~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:317:38: warning: passing argument 3 of 'memset' makes integer from pointer without a cast [-Wint-conversion]
memset(&cipher_ctx->sess, 0, sizeof(cipher_ctx->sess));
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:11:
/usr/include/string.h:71:7: note: expected 'size_t' {aka 'long unsigned int'} but argument is of type 'const struct cipher_data_st *'
void *memset(void *, int, size_t)
^~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c: In function 'cipher_cleanup':
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:332:36: warning: passing argument 1 of 'clean_devcrypto_session' from incompatible pointer type [-Wincompatible-pointer-types]
return clean_devcrypto_session(&cipher_ctx->sess);
^~~~~~~~~~~~~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:40:55: note: expected 'struct session_op *' but argument is of type 'const struct cipher_data_st (*)[1]'
static int clean_devcrypto_session(struct session_op *sess) {
~~~~~~~~~~~~~~~~~~~^~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c: In function 'prepare_cipher_methods':
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:347:23: error: storage size of 'sess' isn't known
struct session_op sess;
^~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:350:12: warning: passing argument 1 of 'memset' discards 'const' qualifier from pointer target type [-Wdiscarded-array-qualifiers]
memset(&sess, 0, sizeof(sess));
^~~~~
In file included from ../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:11:
/usr/include/string.h:71:7: note: expected 'void *' but argument is of type 'const struct cipher_data_st (*)[1]'
void *memset(void *, int, size_t)
^~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:350:22: warning: passing argument 3 of 'memset' makes integer from pointer without a cast [-Wint-conversion]
memset(&sess, 0, sizeof(sess));
^~~~~~~~~~~~
In file included from ../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:11:
/usr/include/string.h:71:7: note: expected 'size_t' {aka 'long unsigned int'} but argument is of type 'const struct cipher_data_st *'
void *memset(void *, int, size_t)
^~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:351:9: error: '(const struct cipher_data_st *)&<erroneous-expression>' is a pointer; did you mean to use '->'?
sess.key = (void *)"01234567890123456789012345678901234567890123456789";
^
->
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:351:5: warning: statement with no effect [-Wunused-value]
sess.key = (void *)"01234567890123456789012345678901234567890123456789";
^~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:360:13: error: '(const struct cipher_data_st *)&<erroneous-expression>' is a pointer; did you mean to use '->'?
sess.cipher = cipher_data[i].devcryptoid;
^
->
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:360:9: warning: statement with no effect [-Wunused-value]
sess.cipher = cipher_data[i].devcryptoid;
^~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:361:13: error: '(const struct cipher_data_st *)&<erroneous-expression>' is a pointer; did you mean to use '->'?
sess.keylen = cipher_data[i].keylen;
^
->
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:361:9: warning: statement with no effect [-Wunused-value]
sess.keylen = cipher_data[i].keylen;
^~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:362:24: error: 'CIOCGSESSION' undeclared (first use in this function); did you mean 'SIOCSETVLAN'?
if (ioctl(cfd, CIOCGSESSION, &sess) < 0
^~~~~~~~~~~~
SIOCSETVLAN
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:362:24: warning: passing argument 2 of 'ioctl' makes integer from pointer without a cast [-Wint-conversion]
In file included from ../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:15:
/usr/include/sys/ioctl.h:52:16: note: expected 'long unsigned int' but argument is of type 'const struct cipher_data_st *'
int ioctl(int, unsigned long, ...);
^~~~~~~~~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:363:27: error: 'CIOCFSESSION' undeclared (first use in this function); did you mean 'SIOCSETVLAN'?
|| ioctl(cfd, CIOCFSESSION, &sess.ses) < 0)
^~~~~~~~~~~~
SIOCSETVLAN
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:363:46: error: '(const struct cipher_data_st *)&<erroneous-expression>' is a pointer; did you mean to use '->'?
|| ioctl(cfd, CIOCFSESSION, &sess.ses) < 0)
^
->
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:363:27: warning: passing argument 2 of 'ioctl' makes integer from pointer without a cast [-Wint-conversion]
|| ioctl(cfd, CIOCFSESSION, &sess.ses) < 0)
^~~~~~~~~~~~
In file included from ../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:15:
/usr/include/sys/ioctl.h:52:16: note: expected 'long unsigned int' but argument is of type 'const struct cipher_data_st *'
int ioctl(int, unsigned long, ...);
^~~~~~~~~~~~~
../deps/openssl/openssl/crypto/engine/eng_devcrypto.c:347:23: warning: unused variable 'sess' [-Wunused-variable]
struct session_op sess;
^~~~
gmake[1]: *** [deps/openssl/openssl.target.mk:815: /home/wison/temp/node-16-openbsd/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/engine/eng_devcrypto.o] Error 1
gmake: *** [Makefile:110: node] Error 2
Any idea?:)
(Sorry I didn't have time to try myself. I will try that at evening and tell you the results.)
I made a small revert because I discovered that the linker option
wxneeded
is already included incommon.gypi
, so my inclusion of it was redundant. My latest commit is localscope@62fdc1fHi, I just tried on my
OpenBSD 7.0 current
, it seems still not working, I confirmed I pull thefix-openbsd-build
branch with your latest fix commits:But it still fail at the end (with different error):
I am facing the exact same issue using GCC and G++. It's been compiling under Clang/Clang++ in single thread (just for trying that setting) for more than 5 hours, I'll tell you tomorrow if it succeeds.
I haven't come across that error, but I have been compiling with the Clang compilers included with OpenBSD 7.0, (not the ones from pkgs), so hopefully using those will help. I did try building with gcc/g++ before, but it said it couldn't find a usable assembler so I just switched to using Clang. In case you're not already aware, when using Clang you should not need to pass --openssl-no-asm
.
@wisonye Those missing constants are related to crypto(4) but I believe that's been removed in openbsd 5.7. You probably want to exclude e_devcrypto.c from the build.
Yes I already noticed about the no ASM flag with clang.
Your GCC issue may be related to the fact the commands are named egcc and eg++ which you need to provide via CC and CXX env variables. I'll be able to tell you the results of building using Clang as soon as I'm back home.
It compiled with your branch, using:
CC=clang CXX=clang++ ./configure
gmake -j4
Thank you so much for your help :)
Oh good, I'm glad it worked for you :)
Today I tried building it with Clang compilers using --openssl-no-asm
and got the error you were getting. So it looks like it's not an issue with the compiler, but something with the configuration when not using an assembler.
Okay, so that explains the issue with GCC/G++!
It compiled with your branch, using:
CC=clang CXX=clang++ ./configure gmake -j4
Thank you so much for your help :)
Actaully, it doesn't work for me, same command, but fail:
# `clang/clang++ --version`
OpenBSD clang version 13.0.0
Target: amd64-unknown-openbsd7.0
Thread model: posix
InstalledDir: /usr/bin
# `uname -a`
OpenBSD wison_bsd.my.domain 7.0 GENERIC#277 amd64
Error happen after .... (not sure, at least over 20 mins compilation):
I see that was run from your home directory, did you verify that your /home
partition is mounted with the wxallowed
option?
You should be able to check with the command:
mount | grep "/home .*wxallowed"
Your /home
partition does not have that option set, but /usr/local
does. You can either enable it on /home
or try building it under /usr/local
(e.g. creating a directory such as /usr/local/nodesrc
to build it in)
If you want to enable it on /home
you should be able to temporarily do so by running:
mount -uo wxallowed /home
You can permanently change it, by adding wxallowed
to the appropriate line in /etc/fstab
If you're just building under /home
and plan on installing to /usr/local
then the temporary option should suffice.
Your
/home
partition does not have that option set, but/usr/local
does. You can either enable it on/home
or try building it under/usr/local
(e.g. creating a directory such as/usr/local/nodesrc
to build it in)If you want to enable it on
/home
you should be able to temporarily do so by running:mount -uo wxallowed /home
You can permanently change it, by adding
wxallowed
to the appropriate line in/etc/fstab
If you're just building under
/home
and plan on installing to/usr/local
then the temporary option should suffice.
Hi thanks, that works :+1:
But .... it seems not stable
? As every time I install something by running npm -g install XXX
, it always said terminated by signal SIGABRT (Abort)
:
It causes sometimes installation works (like the typescript
case, as /usr/local/lib/node_modules/typescript/bin/tsc
has beend installed and it works fine), but sometimes installation is broken (like the typescript-language-server
didn't finish, no executable at all)...
And actually, it always fails when installing a lot of dependencies (any of my projects), the node_modules
folder always missing dependencies and the project can't run correctly :(
I built v16.14.0 on an openbsd7.0 vm by largely following this issue. The build and install eventually finished without errors, gmake test-only
passed 2716 tests and failed 762. npm install fails, but I'll get to that in a minute. I'll try to consolidate my build process into steps below.
/home
so I had to remount with wxallowed
export CC=cc
export CXX=c++
./configure --prefix /home/nodejs/nodejs_v16.14.0/
gmake
overnight, forgot to time it. Then gmake install
.export PATH=/home/nodejs/nodejs_v16.14.0:$PATH
because why not, this is only a test.At thus point I can call node, npm, npx, and corepack without arguments just fine. I have tried a few npm installs and they have failed with the same error.
npm ERR! code 1
npm ERR! path /home/nodejs/peppermint/node_modules/node
npm ERR! command failed
npm ERR! command sh -c node installArchSpecificPackage
npm ERR! npm ERR! code E404
npm ERR! npm ERR! 404 Not Found - GET https://registry.npmjs.org/node-openbsd-x64 - Not found
npm ERR! npm ERR! 404
npm ERR! npm ERR! 404 'node-openbsd-x64@17.4.0' is not in this registry.
npm ERR! npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! npm ERR! 404
npm ERR! npm ERR! 404 Note that you can also install from a
npm ERR! npm ERR! 404 tarball, folder, http url, or git url.
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR! /home/nodejs/.npm/_logs/2022-03-18T00_35_20_432Z-debug-0.log
npm ERR! node:internal/modules/cjs/loader:936
npm ERR! throw err;
npm ERR! ^
npm ERR!
npm ERR! Error: Cannot find module 'node-openbsd-x64/package.json'
npm ERR! Require stack:
npm ERR! - /home/nodejs/peppermint/node_modules/node/installArchSpecificPackage.js
npm ERR! at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
npm ERR! at Function.resolve (node:internal/modules/cjs/helpers:108:19)
npm ERR! at ChildProcess.<anonymous> (/home/nodejs/peppermint/node_modules/node-bin-setup/index.js:19:27)
npm ERR! at ChildProcess.emit (node:events:520:28)
npm ERR! at maybeClose (node:internal/child_process:1092:16)
npm ERR! at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {
npm ERR! code: 'MODULE_NOT_FOUND',
npm ERR! requireStack: [
npm ERR! '/home/nodejs/peppermint/node_modules/node/installArchSpecificPackage.js'
npm ERR! ]
npm ERR! }
npm ERR! A complete log of this run can be found in:
npm ERR! /home/nodejs/.npm/_logs/2022-03-18T00_34_11_453Z-debug-0.log
So as far as I can tell, npm is looking for the modules I am attempting to install but not finding a https://registry.npmjs.org/node-openbsd-x64
directory to retrieve them from. I'm not sure how, but I'm hoping I can trick npm into looking for freebsd modules. I'll try to report back if I find anything more.
It looks like you are trying to install another copy of node from npm. If not intentionally, then maybe it is a dependency in some package.json you're working with. Either way OpenBSD builds of node are not available via npm which would explain the error you are getting. If it is your own project and you don't need v17 of node, then you may be able to just remove the node dependency to see if the rest will install.
You know, I wondered if it might have been trying to retrieve a newer version of node. I dismissed it because I didn't think it would do that when I was already running stable, and because I've always heard nvm is for node versions (I'm still a little green with nodejs).
I have attempted to run npm install yarn
, which failed with the same message as in my previous message. I also tried an npm install
on peppermint ticket managment. Peppermint did contain "node": "^17.4.0"
in dependencies and "@types/node": "17.0.4"
in devdependencies. I removed both of those lines then tried npm install
again and there were no complaints about node... but alas it could not find a suitable version of the node bcrypt_lib module.
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-openbsd-x64-unknown.tar.gz
It seems to me the next step is to try to install or build bcrypt myself. Thanks to you all for the help you have provided!
So I git pulled https://github.com/kelektiv/node.bcrypt.js/ and did an npm install. It installed itself in the appropriate place and I ran npm run dev
and was greeted with a very exciting "Internal Server Error" upon curling the listening port, 3000.
In case it might help anyone else, I'd just like to point out that the patches, Makefile, etc. for the OpenBSD node 16 port are here: https://github.com/openbsd/ports/tree/master/lang/node
I might fork node and rebase some of these patches against node 18, and see if I can get 18 running on OpenBSD... (However, if I run out of time, I may need to switch to a different OS for my current project and revisit this in I guess a few weeks or so.)
In case it might help anyone else, I'd just like to point out that the patches, Makefile, etc. for the OpenBSD node 16 port are here: https://github.com/openbsd/ports/tree/master/lang/node
I might fork node and rebase some of these patches against node 18, and see if I can get 18 running on OpenBSD... (However, if I run out of time, I may need to switch to a different OS for my current project and revisit this in I guess a few weeks or so.)
I made an attempt at getting v18 to work earlier this month. I was able to get it to build and thought at first that it was working alright, but when I used npm to install a large number of dependencies it would crash. If I remember correctly, I could install a small number of dependencies without issue. I did not run into that problem when I built v16.
Since I did not actually need v18, and v16 has been available in OpenBSD pkgs since version 7.1, I just installed the pkg version for now.
If you're interested, the edits I made to build v18 are at: https://github.com/localscope/node/tree/openbsd-build-v18
In case it might help anyone else, I'd just like to point out that the patches, Makefile, etc. for the OpenBSD node 16 port are here: https://github.com/openbsd/ports/tree/master/lang/node I might fork node and rebase some of these patches against node 18, and see if I can get 18 running on OpenBSD... (However, if I run out of time, I may need to switch to a different OS for my current project and revisit this in I guess a few weeks or so.)
I made an attempt at getting v18 to work earlier this month. I was able to get it to build and thought at first that it was working alright, but when I used npm to install a large number of dependencies it would crash. If I remember correctly, I could install a small number of dependencies without issue. I did not run into that problem when I built v16.
Since I did not actually need v18, and v16 has been available in OpenBSD pkgs since version 7.1, I just installed the pkg version for now.
If you're interested, the edits I made to build v18 are at: https://github.com/localscope/node/tree/openbsd-build-v18
But the reality is that npm install
always fails, and I have no luck getting my front-end and backend projects to work. So that means it's unreliable, even passing the node
package build or install.
I really want to switch my daily OS from MacOS/ArchLinux to OpenBSD, I keep giving it a try since Feb, but I still have to give up eventually, as I said above, you even can't finish the npm install
.
The same case for the rust project, yes, you can install rustc
and cargo
in OpenBSD, but cargo-watch
not working, and many weird things happen in the real life even though it works sometimes.
Hopefully, you guys will figure out the get node
stable in the real life, it really helps many developers I think)
@wisonye It sounds like I ran into the same issue you were having. Have you tried installing node from pkgs? Back when I built v16, pkgs only had v12 available which is why I built node myself. And that worked for me until v18 when I had the npm problem. But now I can use the pkgs build since they upgraded it to v16 and it is running fine for me. I'm curious if the pkgs build would give you any problems.
@localscope after I posted my comment, I saw your fork and your changes, but for me those changes alone were insufficient to get the build working -- it would still fail on src/cares_wrap.cc. However, your changes were still helpful!
https://github.com/barrykn/node/commits/v18.x-fix-openbsd has my changes so far. It's mostly just merges of various patches from the OpenBSD Ports version of node 16, but I also added localscope's changes to fix the build of node's bundled OpenSSL. With my changes, I was able to do the following:
# The appropriate ports need to be installed for these --shared-whatever options to work
CC=clang CXX=clang++ \
./configure --prefix=/usr/local \
--with-intl=system-icu \
--shared-brotli \
--shared-cares \
--shared-libuv \
--shared-nghttp2 \
--shared-nghttp3 \
--shared-ngtcp2 \
--shared-zlib
# My build/test VM only has 2 vCPUs, which is why I used -j3 not -j4
gmake -j3
# I had to add CC and CXX again for the tests to work
CC=clang CXX=clang++ gmake test-only
It builds, and 3708 tests pass, 22 fail. I need to deal with other stuff for a few hours before I'll get a chance to try installing this build and doing stuff with npm.
(The software I want to run supports node 16 in its current release, but is going to require node 18 in the next release, so node 16 would basically be a very-short-term option for me.)
@wisonye It sounds like I ran into the same issue you were having. Have you tried installing node from pkgs? Back when I built v16, pkgs only had v12 available which is why I built node myself. And that worked for me until v18 when I had the npm problem. But now I can use the pkgs build since they upgraded it to v16 and it is running fine for me. I'm curious if the pkgs build would give you any problems.
Yes, I use the pkgs install, but still have the problem: crashes when installing large dependencies, and that's the project package.json
, nothing I can do with it:) My last try was ..... around a few weeks ago:)
As of my last comment, npm was working but yarn wasn't. With one additional patch, unfortunately my fork of node v18 must now be installed to /usr/local and no other location, but on the upside, yarn classic now works. I think yarn berry is giving me the sigfault problem.
Oh, by the way, make sure the environment variables CC=clang
and CXX=clang++
are set before invoking npm or yarn. npm and yarn will often work without those variables set, but there are circumstances where those variables must be set, or npm or yarn will fail. An alternative might be to install OpenBSD ports/packages for gcc and g++, but I have not had a chance to test that yet, whereas setting the environment variables seems to work.
I have some vague idea of what's likely causing the segfault problem; I'm expecting it will either be reasonably easy or nearly impossible to fix, but I don't yet know which. Unfortunately I will have to set this project aside for the moment, for at least several days, possibly a couple weeks, to deal with some other stuff that's more urgent for me (unrelated to node or OpenBSD).
A diff to update OpenBSDs node port to 18.12.1 is available on the OpenBSD ports mailing list. Tests and comments are welcome. So far I have not been able to get npm to segfault when installing packages.
A diff to update OpenBSDs node port to 18.12.1 is available on the OpenBSD ports mailing list. Tests and comments are welcome. So far I have not been able to get npm to segfault when installing packages.
Thanks! I'll test it in the next few days (I'll try to test it in the next day or so, if I can).
@VlkrS regarding the patch on the ports mailing list, I noticed this:
-+CXX := /usr/bin/clang++
-+CC := /usr/bin/clang
++CXX := /usr/bin/c++
++CC := /usr/bin/c
This looks like a typo to me -- I think it should be /usr/bin/cc
not /usr/bin/c
.
(I have not finished looking over the patch yet, nor have I had a chance to try building and testing. Hopefully within the next 24 hours...)
@VlkrS I didn't find anything else wrong in the patch. I applied the one fix (/usr/bin/cc instead of /usr/bin/c) and built and installed it successfully (on amd64).
It still had segfaults for me, however I was able to find the cause of the problem and fix it! The user account I used for running node was in the default login class, which was limiting datasize to 1GB. Raising the limit to 2GB got rid of all the segfaults. In retrospect I should have put that user account in its own login class (and I will be doing that before I deploy the system).
Thank you, @barrykn. @villisek I would suggest closing this bug on account of the two supported versions of OpenBSD (7.1 and 7.2) having node 16.x in their ports and -current being able to build 18.x
Closing per the above comment and also because v16.x went out of support earlier this month.
Version
node-16.13.1
Platform
OpenBSD 7.0 GENERIC#224 amd64
Subsystem
No response
What steps will reproduce the bug?
pkg_add
../configure.sh
with properCC=egcc CXX=eg++
env variables (also tried with clang and clang++, just in case). When trying to configure with gcc and g++, requires--openssl-no-asm
.gmake
(with or without-j4
)How often does it reproduce? Is there a required condition?
No response
What is the expected behavior?
Expected NodeJS to compile.
What do you see instead?
Got an error.
When compiled with GCC/G++ :
When compiled with Clang/Clang++ :
Additional information
Maybe related to
libexecinfo
which is considered required in the building guide; the lib is now included in OpenBSD:(Sorry if I'm not reporting correctly/at the right place, first contribution here! I also know Clang/Clang++ aren't the compilers recommended, but I also wanted to try with them. So I recognise giving Clang/Clang++ compile logs might be irrelevant in that particular case)