Installing gcc manually redhat - c

I am working on a system on which I am a non-root user.
While trying to install gcc 5.1 in a custom directory as the present shared version of gcc isn't working for postgresql installation, I started out by
wget gcc 5.1.
After unzipping the folder, ran the commands below:
cd /seq/genome_portal/lib
mkdir bld
mkdir gcc
cd bld
/seq/genome_portal/lib/gcc-5.1/configure --prefix=/seq/genome_portal/lib/gcc
However config.log still shows this error:
/../../redhat_6_x86_64/pkgs/gcc_4.9.0/libexec/gcc/x86_64-redhat-linux/4.9.0/cc1: error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directory
The prerequisites that come after
./contrib/download_prerequisites
are gmp,mpfr and mpc. I started with gmp and ended up in the same error as above. I somehow need to tell these programs that I do not want to use the existing gcc.
But I get the same error as mentioned before. Any advice as to how I can proceed to install it?

Building a compiler is much more complicated that building a straightforward utility; just running configure is not enough.
Primarily, you need to read the instructions; they are provided in the GCC source directory in the INSTALL subdirectory. They are in HTML so point your browser at it.
I know you didn't do this yet because the step on configuration makes very clear you should be using an out-of-source configuration; e.g., something like:
mkdir ../bld
cd ../bld
../gcc-5.1/configure ...
rather than running ./configure.
Regarding the missing dependencies, there's a "prerequisites" section in the docs. To get MPFR and other helpful things you can run:
cd gcc-5.1
./contrib/download_prerequisites
ETA: This should work:
rm -rf newgcc
mkdir newgcc
cd newgcc
tar xzf gcc-5.1.tar.gz
cd gcc-5.1
./contrib/download_prerequisites
mkdir ../bld
cd ../bld
../gcc-5.1/configure <configopts>
make -j8
make install
(or whatever -j you prefer).

Related

Eigen3 fails to install with cmake : RegexUtils not found

I try to install eigen3.3.7 with cmake on ubuntu 16 but cmake fails.
I follow the INSTALL file hints :
1) I extract the tar archive
2) Make a "build" dir named buildDir
3) Go to build dir : cd buildDir
4) Start cmake : cmake ../Eigen
Then the cmake process ends up with the error :
CMake Error at CMakeLists.txt:1 (include):
include could not find load file:
RegexUtils
CMake Error at CMakeLists.txt:2 (test_escape_string_as_regex):
Unknown CMake command "test_escape_string_as_regex".
May I ask you some hints please ?
Regards
Sylvain
I followed the advices of chtz, but it still fails, see below the console output :
syl#spica:~/tmp/eigen/eigen-eigen-323c052e1731$ cat INSTALL
Installation instructions for Eigen
***********************************
Method 2. Installing using CMake
********************************
Let's call this directory 'source_dir' (where this INSTALL file is).
Before starting, create another directory which we will call 'build_dir'.
Do:
cd build_dir
cmake source_dir
make install
syl#spica:~/tmp/eigen/eigen-eigen-323c052e1731$ mkdir build && cd build
syl#spica:~/tmp/eigen/eigen-eigen-323c052e1731/build$ cmake ../
CMake Error at CMakeLists.txt:1 (include):
include could not find load file:
RegexUtils
CMake Error at CMakeLists.txt:2 (test_escape_string_as_regex):
Unknown CMake command "test_escape_string_as_regex".
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 3.5)
should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring incomplete, errors occurred!
See also "/home/syl/tmp/eigen/eigen-eigen-323c052e1731/CMakeFiles/CMakeOutput.log".
syl#spica:~/tmp/eigen/eigen-eigen-323c052e1731/build$ vim ../CMakeFiles/CMakeOutput.log
Thanks for helping.
This sequence of commands seems to work properly after downloading (in my case the currently latest version eigen-3.3.7):
bunzip2 eigen-3.3.7.tar.bz2
tar -xvf eigen-3.3.7.tar
cd eigen-3.3.7/
mkdir build
cd build
cmake ../.
sudo make install

Building libjepeg-turbo from source doesn't build the library libturbojpeg.so*

I'm trying to build libjpeg-turbo from source to include 12 bit support. I downloaded the source code from here (2.0.1) then followed instruction given in Building.md
cd libjpeg-turbo-2.0.1
mkdir build && cd build
cmake -G"Unix Makefiles" -D WITH_12BIT=1 -D WITH_TURBOJPEG=1 ..
make -j8
sudo make install
The compilation is successful and generates only libjpeg.so, libjpeg.so.62 and libjpeg.so.62.3.0 along with bunch of other binary files. But its not building the lib files libturbojpeg.so.0.2.0, libturbojpeg.a and libturbojpeg.so which i need. I'm not sure where I am going wrong. i have also tried without the -D WITH_TURBOJPEG flag.
I'm trying this on Ubuntu 16.04 on Nvidia Tx2.
Any help is greatly appreciated.
Thanks
Line 201 of CMakeLists.txt turns WITH_TURBOJPEG off when building with WITH_12BIT enabled.
Don't enable WITH_12BIT and then WITH_TURBOJPEG will be default enabled and should build those libraries.

error when compiling testfiles from installed c-algorithms library

I'm trying to install and test c library c-algorithms from Github.
https://github.com/fragglet/c-algorithms/blob/master/test/test-queue.c
When I try to test the installation from the generated test folder with:
gcc -o test-arraylist `pkg-config --cflags --libs libcalg-1.0` test-arraylist.c
I get the following error massage:
test-arraylist.c:30:23: fatal error: arraylist.h: No such file or directory
compilation terminated.
I use a Vagrant box: ubuntu/xenial32 with Ubuntu 14.04.5 LTS
Prior to installation of c-algorithms:
sudo apt-get install autoconf
sudo apt-get install libtool
sudo apt-get install pkg-config
To install the library I have done following:
sudo ./autogen.sh
sudo ./configure
sudo make
sudo make install
Any help would be highly apriciated
The test-arraylist.c has line #include "arraylist.h" but it is under the libcalg subdirectory not directly in the include path.
libcalg subdir should be added to the include path or you have to modify the include like #include "libcalg/arraylist.h"
If you want only run the tests, then run the
sudo make check from the build root (in your case it is the source root)
This is probably going to be stomped on by process-fetishizers.
But.
When you build in a Unix/Linux operating system (and derivatives like RTEMS), you are building off other people's libraries - so you need those libraries and their header files ( just like c-alg... ) installed in locations that your compiler can find.
To find a file that is associated with a package, use dpkg as explained here:
https://askubuntu.com/questions/481/how-do-i-find-the-package-that-provides-a-file
But you have another problem you might not be aware of. You are trying to compile a test program using a gcc command when the software uses GNU autoconf automake and probably libtool to function PROPERLY.
Perhaps you don't understand you need to make sure autoconf, automake, and then libtool find the right configuration from one directory system to another. Fedora puts files in differing spots from Ubuntu distros.
Instead run:
autoreconf -fvi
first in the top level directory and see if this finds your header file.
THEN you run
./configure
and then
make test/check
(whichever it uses, some use recipe "all-tests", etc.)
make all
This would make all if your system is ready to handle them.

Issue Statically Compiling Thrift 0.9.0 on Centos 6.5

I'm working to compile the Thrift 0.9.0 binary statically in a CentOS VM. I get the issue that the libthrift.a binary is not being created. I am using a vagrant box to run centos:
https://github.com/2creatives/vagrant-centos/releases/download/v6.5.1/centos65-x86_64-20131205.box
Once I ssh to the vagrant box I run the following commands:
wget https://archive.apache.org/dist/thrift/0.9.0/thrift-0.9.0.tar.gz
tar -zxvf thrift-0.9.0.tar.gz
cd thrift-0.9.0
./configure --enable-static
make
This will run but I ran a find command (sudo find / -name "*.a") on the system to see if there was any ".a" files made and the only file that was made was "libparse.a" which doesn't seem right. From my understanding it should be "libthrift.a".
Searching through the config.log file it says that it does want to build the static libraries:
configure:11944: checking whether to build static libraries
configure:11948: result: yes
Looking at more locations in the log file that has the keyword "static" reveals potential places that may be errors.
configure:9028: checking if gcc static flag -static works
configure:9056: result: no
configure:13915: checking if g++ static flag -static works
configure:13943: result: no
lt_cv_prog_compiler_static_works=no
lt_cv_prog_compiler_static_works_CXX=no
The full log file is here: http://www.filehosting.org/file/details/449460/staticThriftErrorLog.rtf
Any help is appreciated
I was able to generate the libthrift.a file. After running the command for the extra dependancies mentioned in my comment I forgot to run the make command. So after doing the make command I found the libthrift.a file in "thrift-0.9.0/lib/cpp/.libs/". Interestingly enough, even after fixing the dependencies, config.log still had the same potential problem areas regarding the gcc/g++ static flag and static compiler.
Specifically the dependency command is as follows:
sudo yum install automake libtool flex bison pkgconfig gcc-c++ boost-devel libevent-devel zlib-devel python-devel ruby-devel openssl-devel.x86_64
Edit: After getting advice on the Jira ticket, it turns out the specific vagrant box I was using was causing the errors. Using the VM he linked I was able to successfully build Thrift using the provided instructions. (Jira ticket https://issues.apache.org/jira/browse/THRIFT-2559)

cmake command line option

I am new to VS development and Cmake.
I have used CMake-GUI to generate a visual studio solution and am able to build it successfully.
However, our code has now reached a stage where we can finally build & link into a binary. With multiple people checking in code, we want to do a nightly build and so I was thinking of writing a batch file for this.
However, I am trying to invoke cmake from command line and am running into issues.
In cmake-gui, in order to configure, I provide two values
Path of my source code
Path where binaries will be generated
However, when I try to run the same over command line (using the following command)
cmake -G "NMake Makefiles" -D CMAKE_SOURCE_DIR="D:\source_code" -D CMAKE_BINARY_DIR="D:\source_code\build\gen\host"
CMake throws up an eror : The source directory "D:\" is a file not a directory.
I tried the following variations too without any luck
cmake -G "NMake Makefiles" -D PROJECT_SOURCE_DIR="D:\source_code" -D PROJECT_BINARY_DIR="D:\source_code\build\gen
Can someone please guide me to the correct syntax.
Thanks in advance
You shouldn't try and set any of these variables on the command line. They're automatically set by CMake the first time it reads the CMakeLists.txt.
Instead, you should run the CMake command from within the binary dir, and pass the path to the directory containing the top-level CMakeLists.txt. So something like:
cd D:\source_code\build\gen\host
cmake -G"NMake Makefiles" D:\source_code
By the way, CMake's command line parsing isn't great (e.g. see this answer). I'd recommend avoiding leaving spaces after -D arguments.
Try this
Remove space between -D and parameter
cmake -G "NMake Makefiles" -DCMAKE_SOURCE_DIR="D:\source_code" -DCMAKE_BINARY_DIR="D:\source_code\build\gen\host"
In my project, We used a CMake-GUI. But I created a shell script file to avoid repeatedly fill up the entries.
Sample gist is as follows.
cd <DIRECTORY_TO_BUILD> && <CMAKE-INSTALLATION-PATH>/bin/cmake.exe --build= "<BUILDSOURCE-PATH> -DQt5Widgets_DIR:PATH=C:/Qt/5.12.0/msvc2017/lib/cmake/Qt5Widgets
I have started with cd else the script will create the build folder from where the script is run.

Resources