Can't install Node.JS on linux machine - node.js

I am struggling to install Node.JS on a linux machine.
When I run brew install node , I get this output
```[c_test#whatever-server ~]$ brew install node
==> Installing dependencies for curl: glibc, gcc, pkg-config and openssl#1.1
==> Installing curl dependency: glibc
==> Downloading https://ftp.gnu.org/gnu/glibc/glibc-2.23.tar.gz
Updating Homebrew...
######################################################################## 100.0%
==> ../configure --disable-debug --disable-dependency-tracking --disable-silent-rules --prefix=/home/c_test/.linuxbrew/Cellar/glibc/2.23 --enable-obsolete-rpc --without-selinux --with-binutils=/home/c_
Last 15 lines from /home/c_test/.cache/Homebrew/Logs/glibc/01.configure:
checking version of gmake... 3.81, ok
checking for gnumsgfmt... no
checking for gmsgfmt... no
checking for msgfmt... msgfmt
checking version of msgfmt... 0.17, ok
checking for makeinfo... no
checking for sed... sed
checking version of sed... 4.2.1, ok
checking for gawk... gawk
checking version of gawk... 3.1.7, ok
checking if gcc -B/home/c_test/.linuxbrew/opt/binutils/bin/ is sufficient to build libc... no
checking for nm... nm
configure: error:
*** These critical programs are missing or too old: compiler
*** Check the INSTALL file for required versions.
READ THIS: https://docs.brew.sh/Troubleshooting```
I guess the gcc version is the good one:
gcc (GCC) 8.4.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I have a similar error when I try to build it from source:
./configure
WARNING: C++ compiler (CXX=g++, 4.4.7) too old, need g++ 6.3.0 or clang++ 8.0.0
ERROR: Did not find a new enough assembler, install one or build with
--openssl-no-asm.
Please refer to BUILDING.md

You are right, your compiler is out dated.
Nodesource has a pretty easy setup installer for node js based on your system and architecture which it checks automatically. Using apt/apt-get will usually also update the dependencies (eg gcc,g++):
See https://github.com/nodesource/distributions and for the latest
# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
sudo apt-get install -y nodejs
# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_13.x | bash -
apt-get install -y nodejs

Related

Installing g++ on windows subsystem for linux

A while back I activated Windows Subsystem for Linux on my machine but didn't use it much. Now I have an idea what I could use it for and that is why I'm trying to install gcc/++ 7 on my WSL and keep running into problems.
My idea was to download it and compile it by hand following this guide with:
../gcc/configure -v --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --prefix=${HOME}/software/gcc-7.3.0/installDir --enable-checking=release --enable-languages=c,c++,fortran --disable-multilib
This led to the following error:
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking LIBRARY_PATH variable... ok
checking GCC_EXEC_PREFIX variable... ok
checking whether to place generated files in the source directory... no
checking whether a default linker was specified... no
checking whether a default assembler was specified... no
checking for x86_64-linux-gnu-gcc... no
checking for gcc... no
checking for x86_64-linux-gnu-cc... no
checking for cc... no
checking for x86_64-linux-gnu-cl.exe... no
checking for cl.exe... no
configure: error: in `$HOME/software/gcc-7.3.0/build':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
Apparently, there was no(?) gcc installed at all. At least gcc and cc yielded "command not found". So my next step was installing gcc via:
sudo apt install gcc
This worked:
$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
However when trying the configure command from above I got:
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking LIBRARY_PATH variable... ok
checking GCC_EXEC_PREFIX variable... ok
checking whether to place generated files in the source directory... no
checking whether a default linker was specified... no
checking whether a default assembler was specified... no
checking for x86_64-linux-gnu-gcc... x86_64-linux-gnu-gcc
checking for C compiler default output file name...
configure: error: in `/home/seriously-ubuntu/software/gcc-7.3.0/build':
configure: error: C compiler cannot create executables
see `config.log' for more details.
So I tried to compile a simple c program by hand:
int main() {
return 42;
}
Which hints that something seems to be seriously broken
$ gcc foo.c
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: cannot find -lc
/usr/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
Any Ideas where I can even start to repair this? I wouldn't even mind reseting the whole WSL if this helps :/
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
UPDATE:
Before all of this I tried installing gcc7 / g++/ via apt without success:
$ sudo add-apt-repository ppa:jonathonf/gcc-7.1
$ sudo apt-get update
$ sudo apt-get install gcc-7 g++-7
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
g++-7 : Depends: libstdc++-7-dev (= 7.1.0-10ubuntu1~16.04.york0) but it is not going to be installed
Depends: libisl15 (>= 0.15) but it is not installable
gcc-7 : Depends: cpp-7 (= 7.1.0-10ubuntu1~16.04.york0) but it is not going to be installed
Depends: binutils (>= 2.26.1) but 2.24-5ubuntu14.2 is to be installed
Depends: libisl15 (>= 0.15) but it is not installable
Recommends: libc6-dev (>= 2.13-0ubuntu6) but it is not going to be installed
E: Unable to correct problems, you have held broken packages
UPDATE 2
Sadly none of the suggested ways helped and I ended up nuking the WSL. Apparently, something more severe was broken.
Why compiling? You should be able to install the package:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install g++-7 -y
Verify using:
gcc-7 --version
See How to install gcc-7 or clang 4.0?
run the following
sudo apt install aptitude
sudo aptitude install gcc-7 g++-7
or
sudo apt install aptitude && sudo aptitude install golang gcc-7 g++-7
crt1.o is generally provided as part of the libdevc dependency (or something similar). I would suggest running sudo apt search libc or some similar variant with lib6c, libdev, libc-dev etc. Installing those fixed a similar issue I had recently.
Failing that, run find / -iname ctri.o and add the folder it appears in to your PATH with export PATH="[folder]:$PATH", and see if that helps.
As you can see here, g++ is just a package in the default ubuntu package repository (for ubuntu 18.04, 20.04 and 22.04 and others).
So it's actually enough to just run this.
sudo apt update
sudo apt install g++
Afterwards you can check with:
g++ --version
which resulted in version 9.4.0 at the time of writing.
However, you can also pick a specific version (e.g. apt install g++-12). However then the binary will also have a specific name (e.g. g++-12) and you may need to add a symlink if you need it to be g++. (e.g. ln -s /usr/bin/g++-12 /usr/bin/g++).

Autoconf has trouble recognizing m4

I am on macOS Sierra and I want to install the GNU autotools. So I previously installed m4 and made it available in my PATH.which m4 return /Users/adrien/dev/m4/bin/m4 (I install all the GNU tools in the folder $HOME/dev) and when I ran the configuration script of autoconf it find m4 in the right directory but it says me :
checking for GNU M4 that supports accurate traces... /Users/adrien/dev/m4
checking whether /Users/adrien/dev/m4 accepts --gnu... no
configure: WARNING: the version of M4 that was found does not support -g
configure: WARNING: using it with POSIXLY_CORRECT set may cause problems
but m4 --version return m4 (GNU M4) 1.4.17 and man m4 return
-g, --gnu
override -G to re-enable GNU extensions
Everything looks good m4 supports -g and --gnu, so I dont understand why the configuration script doesn't recognized it well.
The reason I worried about it is because I previously tried to install autoconf and make installcheck returned an error and, once autoconf is installed, automake doesn't recognized autoconf even if it is available in my path

Autoconf installed but doesn't work (ubuntu)

I'm trying to install GNU automake. When running ./configure I get the following error message in the terminal:
checking whether autoconf is installed... yes
checking whether autoconf works... no
configure: error: The installed version of autoconf does not work.
Please check config.log for error messages before this one
Looking at the config.log I can't figure out where the problem is. My guess it that it's with tex but I'm not sure what program that is even referring to. I installed TexStudio and that didn't resolve it.
The log file is pasted below:
configure:2784: checking for tex
configure:2814: result: no
configure:2822: --version </dev/null
./configure: line 2823: --version: command not found
configure:2825: $? = 127
configure:2843: checking for yacc
configure:2859: found /usr/local/bin/yacc
configure:2870: result: yacc
configure:2886: checking for lex
configure:2916: result: no
configure:2886: checking for flex
configure:2902: found /usr/local/bin/flex
configure:2913: result: flex
configure:2934: checking whether autoconf is installed
configure:2939: autoconf --version
Autoconf version 2.10
configure:2942: $? = 0
configure:2950: result: yes
configure:2957: checking whether autoconf works
configure:2964: cd conftest && autoconf -o /dev/null conftest.ac
Usage: autoconf [-h] [--help] [-m dir] [--macrodir=dir]
[-l dir] [--localdir=dir] [--version] [template-file]
configure:2967: $? = 1
configure:2976: result: no
configure:2979: error: The installed version of autoconf does not work.
Please check config.log for error messages before this one.
As Diego said, if you install autoconf from the repositories it will install the version 2.68. For some reason, you might have the version 2.13 installed.
If it is the case remove the old version and install the default version:
sudo apt-get remove autoconf2.13 && sudo apt-get install autoconf
Autoconf 2.1 is very old and has significantly different semantics from the current version (2.69, called the "2.5 series".)
Ubuntu appears to have separate packages for autoconf 2.1 and 2.6x but I'm not sure how they select across the two.

installing new version of libtool for -- libwebsocket warmcat

I am installing libwebsocket it is giving me error :---
http://git.warmcat.com/cgi-bin/cgit/libwebsockets/snapshot/libwebsockets-1.0-chrome25-firefox17.tar.gz
/pi/libwebsockets-1.0-chrome25-firefox17$ ./autogen.sh
Preparing the libwebsockets build system...please wait
Found GNU Autoconf version 2.69
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:",
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:",
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Found GNU Automake version 1.13
Found GNU Libtool version 1.5.26
Automatically preparing build ... Warning: autoreconf failed
Attempting to run the preparation steps individually
Preparing build ... ERROR: aclocal failed
At present when i run libtool --version:---
/home/pi$ libtool --version
ltmain.sh (GNU libtool) 1.5.26 (1.1220.2.492 2008/01/30 06:40:56)
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If i run whereis command, i get following output :----
/pi/libtool-2.4.2$ whereis libtool
libtool:
I have to install libtool version 2.4.2, to get rid of above error.
Now i have installed 2.4.2 version for libtool :---
ftp://ftp.gnu.org/gnu/libtool/libtool-2.4.2.tar.gz
After installing 2.4.2 version of libtool, If i run whereis command, i get following output :----
/pi/libtool-2.4.2$ whereis libtool
libtool: /usr/local/bin/libtool
But if i run libtool --version:---
/home/pi$ libtool --version
ltmain.sh (GNU libtool) 1.5.26 (1.1220.2.492 2008/01/30 06:40:56)
Why libtool --version command is not showing the latest installed version of libtool 2.4.2?
Also i am getting same error for libwebsocket when i run ./autogen.sh .
Have you tried the latest version (1.22) using CMake? It's straight forward to build.
$ git clone git://git.libwebsockets.org/libwebsockets
$ cd libwebsockets/
Read README.build. Don't know the old version of libwebsockets, but I guess it's
now more towards using CMake rather than autotools.
$ mkdir build && cd build
$ cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/usr/local
The last line is similar to:
$ ./configure --prefix=/usr/local
The whole thing built pretty quick and without any issue.

Cannot find jpeg.h while compiling Abiword 2.8.6 source code

I am trying to compile the code for Abiword 2.8.6. I run the configure command as follows:
./configure --enable-static -disable-shared
This command ends with the following error
checking jpeglib.h usability... no
checking jpeglib.h presence... no
checking for jpeglib.h... no
configure: error: jpeg.h not found
I have no idea where to find jpeg.h. I am doing this on Ubuntu on a x86_64 hardware. I tried installing libjpeg using the following command:
sudo apt-get install libjpeg-progs
That did not help. libjpeg-progs package did install, but it did not solve my problem.
Is libjpeg-dev (or -devel depending on your system) installed? You need the development headers - including the libjpeg ones - to compile from source.
On a Debian-based system you'd do the following (as root):
apt-get install libjpeg-dev
RPM based systems will have a similar command.

Resources