animetosho / Nyuu

Flexible usenet binary posting tool
221 stars 32 forks source link

Installation issue on FreeBSD #79

Closed cuckys closed 4 years ago

cuckys commented 4 years ago

I'm trying to install it on a FreeBSD server but I'm getting the following error(s). Not sure if it is actually supported on FreeBSD

# npm install -g nyuu --unsafe-perm
/usr/local/bin/nyuu -> /usr/local/lib/node_modules/nyuu/bin/nyuu.js

> yencode@1.1.1 install /usr/local/lib/node_modules/nyuu/node_modules/yencode
> node-gyp rebuild

gmake: Entering directory '/usr/local/lib/node_modules/nyuu/node_modules/yencode/build'
  CXX(target) Release/obj.target/crcutil/crcutil-1.0/code/crc32c_sse4.o
warning: unknown warning option '-Wno-expansion-to-defined' [-Wunknown-warning-option]
1 warning generated.
  CXX(target) Release/obj.target/crcutil/crcutil-1.0/code/multiword_64_64_cl_i386_mmx.o
warning: unknown warning option '-Wno-expansion-to-defined' [-Wunknown-warning-option]
1 warning generated.
  CXX(target) Release/obj.target/crcutil/crcutil-1.0/code/multiword_64_64_gcc_amd64_asm.o
warning: unknown warning option '-Wno-expansion-to-defined' [-Wunknown-warning-option]
1 warning generated.
  CXX(target) Release/obj.target/crcutil/crcutil-1.0/code/multiword_64_64_gcc_i386_mmx.o
warning: unknown warning option '-Wno-expansion-to-defined' [-Wunknown-warning-option]
1 warning generated.
  CXX(target) Release/obj.target/crcutil/crcutil-1.0/code/multiword_64_64_intrinsic_i386_mmx.o
warning: unknown warning option '-Wno-expansion-to-defined' [-Wunknown-warning-option]
1 warning generated.
  CXX(target) Release/obj.target/crcutil/crcutil-1.0/code/multiword_128_64_gcc_amd64_sse2.o
warning: unknown warning option '-Wno-expansion-to-defined' [-Wunknown-warning-option]
1 warning generated.
  CXX(target) Release/obj.target/crcutil/crcutil-1.0/examples/interface.o
warning: unknown warning option '-Wno-expansion-to-defined' [-Wunknown-warning-option]
1 warning generated.
  AR(target) Release/obj.target/crcutil.a
  COPY Release/crcutil.a
  CXX(target) Release/obj.target/yencode_sse2/src/encoder_sse2.o
In file included from ../src/encoder_sse2.cc:4:
../src/encoder_sse_base.h:109:15: error: use of undeclared identifier '_lzcnt_u32'; did you mean '__tzcnt_u32'?
                        bitIndex = _lzcnt_u32(mask);
                                   ^~~~~~~~~~
                                   __tzcnt_u32
/usr/include/clang/3.4.1/bmiintrin.h:72:1: note: '__tzcnt_u32' declared here
__tzcnt_u32(unsigned int __X)
^
In file included from ../src/encoder_sse2.cc:4:
../src/encoder_sse_base.h:518:17: error: use of undeclared identifier '_lzcnt_u32'; did you mean '__tzcnt_u32'?
                                        bitIndex = _lzcnt_u32(mask);
                                                   ^~~~~~~~~~
                                                   __tzcnt_u32
/usr/include/clang/3.4.1/bmiintrin.h:72:1: note: '__tzcnt_u32' declared here
__tzcnt_u32(unsigned int __X)
^
2 errors generated.
gmake: *** [yencode_sse2.target.mk:108: Release/obj.target/yencode_sse2/src/encoder_sse2.o] Error 1
gmake: Leaving directory '/usr/local/lib/node_modules/nyuu/node_modules/yencode/build'
gyp ERR! build error 
gyp ERR! stack Error: `gmake` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System FreeBSD 10.3-STABLE
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/nyuu/node_modules/yencode
gyp ERR! node -v v10.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! yencode@1.1.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the yencode@1.1.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-08-01T19_36_39_631Z-debug.log
animetosho commented 4 years ago

Thanks for posting all the info.

I don't see why it wouldn't work on FreeBSD, though the compiler there is Clang 3.4.1, which is rather old, and I haven't really tried it with such.
It looks like Clang < 3.6 uses a different name for the lzcnt intrinsic, which is a little annoying.

Are you able to test building the node-yencode module from source? You'll need to download the code package and run node-gyp rebuild in the directory.
If you're able, in the src/common.h file in the node-yencode package, try making the following edit - find:

#if defined(__clang__) && defined(__APPLE__) && __clang_major__ < 9

replace with:

#if defined(__clang__) && ((defined(__APPLE__) && __clang_major__ < 9) || __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 6))

After that, issue node-gyp rebuild and see if it builds without errors.

If that change works, I can push it and hopefully make it work for you.

cuckys commented 4 years ago

Well... I admit my system is a bit outdated. I have tried now building node-yencode but I'm getting a zlib error:

# node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@7.0.0
gyp info using node@10.12.0 | freebsd | x64
gyp info find Python using Python version 2.7.13 found at "/usr/local/bin/python"
gyp http GET https://nodejs.org/download/release/v10.12.0/node-v10.12.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v10.12.0/node-v10.12.0-headers.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack ZlibError: zlib: invalid distance too far back
gyp ERR! stack     at Unzip.write (/usr/local/lib/node_modules/node-gyp/node_modules/minizlib/index.js:148:22)
gyp ERR! stack     at Unpack.write (/usr/local/lib/node_modules/node-gyp/node_modules/tar/lib/parse.js:363:19)
gyp ERR! stack     at IncomingMessage.ondata (_stream_readable.js:666:20)
gyp ERR! stack     at IncomingMessage.emit (events.js:187:15)
gyp ERR! stack     at addChunk (_stream_readable.js:283:12)
gyp ERR! stack     at readableAddChunk (_stream_readable.js:264:11)
gyp ERR! stack     at IncomingMessage.Readable.push (_stream_readable.js:219:10)
gyp ERR! stack     at HTTPParser.parserOnBody (_http_common.js:122:22)
gyp ERR! stack     at TLSSocket.socketOnData (_http_client.js:441:20)
gyp ERR! stack     at TLSSocket.emit (events.js:182:13)
gyp ERR! System FreeBSD 10.3-STABLE
gyp ERR! command "/usr/local/bin/node" "/usr/local/bin/node-gyp" "rebuild"
gyp ERR! cwd /usr/home/msam/node-yencode-1.1.1
gyp ERR! node -v v10.12.0
gyp ERR! node-gyp -v v7.0.0
gyp ERR! not ok 
animetosho commented 4 years ago

I haven't seen that one before. I did a search, and found this issue which seems to pertain to FreeBSD and Node version 10. I don't know your exact configuration, but perhaps try some of the suggestions there, to see if it helps.

cuckys commented 4 years ago

I just want to point out that I have now successfully installed it along with parpar without any issues after I finally updated my system. Thanks.

animetosho commented 4 years ago

Thanks for the information!