Compiling Node.js with OpenSSL support - node.js

Hi guys trying to do a remote install of Node.js, following this set of instructions here
wget http://nodejs.org/dist/node-v0.4.10.tar.gz
tar -zxvf node-v0.4.10.tar.gz
cd node-v0.x.x
./configure --prefix=~/node
make
make test
make install
this should set me up with a nodejs install under ~/node however, during the ./configure --prefix=~/node I encounter the this in the dependency requirement:
node-v0.4.10]$ ./configure --prefix=~/node
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for program gcc or cc : /usr/bin/gcc
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for gcc : ok
Checking for library dl : yes
Checking for openssl : not found
Checking for function SSL_library_init : not found
Checking for header openssl/crypto.h : not found
/opt/server/node-v0.4.10/wscript:341: error: Could not autodetect OpenSSL support. Make sure OpenSSL development packages are installed. Use configure --without-ssl to disable this message.
[tomcat#test.dev node-v0.4.10]$ make
Project not configured (run 'waf configure' first)
make: *** [program] Error 1
I have checked that open ssl is on the box:
node-v0.4.10]$ openssl version
OpenSSL 1.0.1e-fips 11 Feb 2013
~]$ gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
Not sure what other dependencies their are, been looking for a config file

Node.js is already packaged for the most popular distributions.
If my guess is right, and you're using CentOS 6 or similar, the following command should work fine:
sudo yum install nodejs npm --enablerepo=epel

Related

Can't install Node.JS on linux machine

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

Compilation error for RISCV gcc when try to include -lcrypto

I am running openssl benchmarks on Ubuntu Linux. Initially, there was some problem with the missing library. Later I fixed it by installing the library with the installation command sudo apt-get install libssl-dev. When I compiled using gcc command gcc sha256t.c -o sha -lcrypto, it generates binary but when compiled using RISCV gcc command riscv64-unknown-elf-gcc sha256.S -o sha.riscv -lcrypto, it throws the following link error.
/home/user_name/fpga-zynq/rocket-chip/riscv-tools/riscv/lib/gcc/riscv64-unknown-elf/6.1.0/../../../../riscv64-unknown-elf/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status.
How to link the -lcrypto in this case.
You need a libcrypto compiled for the riscv64 architecture.
What you installed with sudo apt-get install libssl-dev is a libcrypto compiled for your host architecture (likely x86_64), it cannot be used for cross-compiling.
If you can't find a pre-built libcrypto for riscv64, you might have to compile it yourself, with that same riscv64 cross-compiler you're using.
Automating this is what yocto or buildroot is all about.

Why can't clang++ on Ubuntu 14.04 find <iostream>

I am compiling this program:
#include <iostream>
int main()
{
}
This command
g++ -c hello_world.cpp
works.
This command
clang++ -c hello_world.cpp
gives this error:
hello_world.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
^
1 error generated.
Doing:
clang++ -c hello_world.cpp -v
gives:
Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4)
Target: x86_64-pc-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/4.8.4
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/4.9.1
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.1
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8.4
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.1
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
"/usr/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name hello_world.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 2.24 -v -coverage-file /home/user/code/cpp/StackOverflow_questions/hello_world.o -resource-dir /usr/bin/../lib/clang/3.4 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++ -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/x86_64-linux-gnu -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/backward -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/clang/3.4/include -internal-externc-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/user/code/cpp/StackOverflow_questions -ferror-limit 19 -fmessage-length 202 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -vectorize-slp -o hello_world.o -x c++ hello_world.cpp
clang -cc1 version 3.4 based upon LLVM 3.4 default target x86_64-pc-linux-gnu
ignoring nonexistent directory "/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/backward"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++
/usr/local/include
/usr/bin/../lib/clang/3.4/include
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
hello_world.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
^
1 error generated.
clang++ is talking about using gcc 4.9 stuff, but if I do:
g++ --version
it outputs:
g++ --version
g++ (Ubuntu 4.8.4-2ubuntu1~14.04) 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
This is where iostream is located on my machine:
/usr/share/doc/fp-docs/2.6.2/fcl/iostream
/usr/include/boost/tr1/tr1/iostream
/usr/include/c++/4.8/iostream
Seeing as how clang++ was keen on using g++ 4.9 files, I decided to install g++ 4.9
ubuntu does not have 4.9 as part of it's normal "sudo apt-get install g++". They are still on 4.8. (not sure what put the gcc 4.9 (but apparently not g++ 4.9) stuff on my system).
I found out that I could install g++ 4.9 by doing:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.9
After these commands were issued, clang++ was able to find <iostream>.
Try to install these packages,
sudo yum groupinstall "Development Tools"
sudo yum install libstdc++-static.x86_64 compat-libstdc++-33.x86_64
I have had this problem and it was solved installing these packages.

install g++ without update glibc

I need to compile a c++ project with glibc 2.13 version. I found out that Ubuntu 11.10 has the verison of the glibc that i'm searching.
So i installed it in my virtual machine, and then i installed g++ compiler with:
sudo apt-get install g++
The problem is that g++ package updates also glib to the lastest version of glibc 2.19.
I tried also to compile the source of glibc2.13 but i get different errors in compiling, because for sure i need to use the same version of compiler used when it was been created.
I think that the fastest way is to use glibc 2.13, already installed on Ubuntu 11.10. So i need to find out a solution to install g++ without update glibc.
Simply, fetch a recent GCC 4.9 source tarball (and all the dependencies, perhaps using aptitude build-dep gcc or the contrib/download_prerequisites script inside GCC source tree) and compile it and install it from its source code (using your installed glibc-2.13...). You need to configure it (perhaps passing something like --program-suffix=-4.9-mine and possibly some --prefix) and build it outside of its source tree then install it. (then use g++-4.9-mine as your C++ compiler). Read and follow carefully the installation instructions
Running gcc -v will show you how your system GCC was configured.
BTW I am not sure that the version of glibc always matter that much (it really depends of a lot of factors). Did you try to compile your project (on whatever Linux system you have) and run it on a machine (perhaps a virtual one) with glibc 2.13? It might work (but I am not sure at all)!
You can obtain special version from Ubuntu toolchain ppa repo:
#cat /etc/apt/sources.list.d/ubuntu-toolchain-r-test-precise.list
deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu precise main
deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu precise main
Gcc 4.9
Pre build steps:
apt-get build-dep -y gcc-4.9-multilib
apt-get source -y gcc-4.9-multilib
dpkg-source -x gcc-4.9_4.9.2-0ubuntu1~12.04.dsc
cd gcc-4.9-4.9.2
customized parameters:
mkdir -p src && tar -xf gcc-*.tar.xz -C src
cd src && ./contrib/download_prerequisites && cd ..
mkdir -p /opt/dev-tools-4.9
../src/configure --prefix=//opt/dev-tools-4.9 \
-v --with-pkgversion='Ubuntu/Linaro 4.9.2-0ubuntu1~12.04' \
--program-suffix=-4.9 --enable-shared --enable-linker-build-id --with-system-zlib \
--libexecdir=//opt/dev-tools-4.9/lib --without-included-gettext \
--enable-threads=posix --with-gxx-include-dir=//opt/dev-tools-4.9/include/c++/4.9 \
--libdir=//opt/dev-tools-4.9/lib --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes \
--enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror \
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64 --with-tune=generic \
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-sysroot=/ --enable-nls
make -j $(grep -c ^processor /proc/cpuinfo ) && make install
Also you should rebuild the binutils:
binutils 2.22
apt-get build-dep -y binutils-dev
apt-get source -y binutils-dev
dpkg-source -x binutils_2.22-6ubuntu1.3.dsc
mkdir objdir&& cd objdir
../binutils-2.22/configure --prefix=/opt/rdwr_tools/radware-dev-tools-4.9 \
--exec-prefix=/opt/rdwr_tools/radware-dev-tools-4.9 \
--with-sysroot=/ --enable-multilib \
--with-lib-path=/opt/rdwr_tools/radware-dev-tools-4.9/lib \
--disable-werror --enable-shared \
--enable-targets=x86_64-linux-gnu,i686-linux-gnu,x86_64-pc-mingw32,i686-pc-mingw32
make -j 8 && make install

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