WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: trouble with node and/or gcc  (Read 689 times)

Offline saladin

  • WikiUser
  • *
  • Posts: 13
trouble with node and/or gcc
« on: April 05, 2018, 10:09:03 AM »
I want to install a node module. I install node.tcz, then I go to install the node module, and I get this:

Code: [Select]
Error: Cannot find module 'npmlog'
I google that, and apparently it's an error with older versions of node. All I have to do is install a new version. So I download the source and ./configure, make, and I get this:

Code: [Select]
Build issue error: '__builtin_isnan' is not a member of 'std'
This is weird, because it looks like people were having this error more than ten years ago, but the tce version of gcc is just a few months old. Apparently I have to modify the source code, or install a patch, but I can't figure out where that patch is, or even if a patch from ten years ago will solve the problem I'm having today.

What's the easiest way for me to get my module installed? I don't really care if gcc works in the future, because I don't plan on keeping it when I remaster. I'm just using it to create a tcz of working node + module that I can use for the remaster, and then I'm done with gcc.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 10006
Re: trouble with node and/or gcc
« Reply #1 on: April 05, 2018, 10:33:37 AM »
The following worked for me on CorePure64:
Code: [Select]
tce-load -i compiletc python openssl-dev icu-dev c-ares-dev http-parser-dev libuv-dev

cd node-v9.5.0

CC="gcc -flto -fuse-linker-plugin -mtune=generic -Os -pipe" CXX="g++ -flto -fuse-linker-plugin -mtune=generic -Os -pipe -fno-exceptions -D_GLIBCXX_USE_C99_MATH" ./configure --prefix=/usr/local --shared-cares --shared-openssl --shared-zlib [--with-intl=system-icu] --without-npm --shared-http-parser --shared-libuv

[icu too old]

find . -name common.gypi -type f -exec sed -i 's/-O3//g' {} \;
find . -name node.gypi -type f -exec sed -i 's/-O3//g' {} \;

make [40m 51.07s]
sudo make install

Offline saladin

  • WikiUser
  • *
  • Posts: 13
Re: trouble with node and/or gcc
« Reply #2 on: April 05, 2018, 11:27:59 AM »
I'm on 32 bit core, and it seems that c-ares-dev http-parser-dev aren't available. Is there a way I can do this without?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 10006
Re: trouble with node and/or gcc
« Reply #3 on: April 05, 2018, 10:32:15 PM »
You might be able to compile without c-ares and http-parser, (remember to use "-D_GLIBCXX_USE_C99_MATH") did you try?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 10006
Re: trouble with node and/or gcc
« Reply #4 on: April 06, 2018, 01:37:04 AM »
This seems to work:
Code: [Select]
tce-load -i compiletc python openssl-dev

cd node-v9.5.0

CC="gcc -flto -fuse-linker-plugin -march=i486 -mtune=i686 -Os -pipe" CXX="g++ -flto -fuse-linker-plugin -march=i486 -mtune=i686 -Os -pipe -fno-exceptions -D_GLIBCXX_USE_C99_MATH" ./configure --prefix=/usr/local --shared-openssl --shared-zlib --without-npm

Offline saladin

  • WikiUser
  • *
  • Posts: 13
Re: trouble with node and/or gcc
« Reply #5 on: April 06, 2018, 07:12:53 PM »
Still not working for me. I'm getting something different now:

Code: [Select]
virtual memory exhausted: Cannot allocate memory
lto-wrapper: fatal error: g++ returned 1 exit status
compilation terminated.
/usr/local/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[1]: *** [deps/v8/src/mksnapshot.target.mk:167: /mnt/sdb1/note/out/Release/mksnapshot] Error 1

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 10006
Re: trouble with node and/or gcc
« Reply #6 on: April 06, 2018, 10:39:57 PM »
It looks like you ran out of memory, lto uses a lot of it - you could assign more memory or remove "-flto -fuse-linker-plugin".

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 10006
Re: trouble with node and/or gcc
« Reply #7 on: April 07, 2018, 04:23:59 AM »
updated node extension posted

Offline saladin

  • WikiUser
  • *
  • Posts: 13
Re: trouble with node and/or gcc
« Reply #8 on: April 08, 2018, 09:31:28 AM »
Without "-flto -fuse-linker-plugin", I get

Code: [Select]
In file included from ../src/node.cc:37.0:
../src/node_crypto.h:39:10: fatal error: openssl/ssl.h: No such file or directory

With the new extension you posted, I get a different error because there's no npm.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 10006
Re: trouble with node and/or gcc
« Reply #9 on: April 08, 2018, 09:48:20 AM »
Your compiling error is because you have not loaded openssl-dev.

As mentioned in the node extension info file, npm is a separate extension.

Offline saladin

  • WikiUser
  • *
  • Posts: 13
Re: trouble with node and/or gcc
« Reply #10 on: April 08, 2018, 01:05:50 PM »
Ok, got openssl-dev. Now I have a new error:

Code: [Select]
if [ ! -r node -o ! -L node ]; then ln -fs out/Release/node node; fi
ln: node: Operation not permitted
make: *** [Makefile:91: node] Error 1

And of course I can't install the module from the tcz extensions because "read-only filesystem" and "Often virtualized file systems, or other file systems that don't support symlinks, give this error." So I've unpacked everything and copied the files out by hand. That's just given me another error:

Code: [Select]
Error: Cannot find module '../lib/utils/unsupported.js'
Damn, didn't occur to me until after I rebooted, but maybe I could have installed this missing module with npm? I'll have to try unpacking everything again.
« Last Edit: April 08, 2018, 01:07:25 PM by saladin »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 10006
Re: trouble with node and/or gcc
« Reply #11 on: April 09, 2018, 03:19:05 AM »
If you believe it is a problem with following symlinks you can use the apps gui copy selected extensions to fs flag for node and npm.

I was able to load and run npm-gui as a test without this (I think).

I did not see any errors while compiling - unless you were trying "make install" without sudo?

Offline saladin

  • WikiUser
  • *
  • Posts: 13
Re: trouble with node and/or gcc
« Reply #12 on: April 14, 2018, 07:05:52 PM »
Not sure what I was doing. Couldn't reproduce the error after that. I ended up getting a different error though.

I downloaded the Tiny Core ISO and used that GUI tool you recommended, and it worked. Seems like it was a symlink problem.

Thanks for your help!