Installing GCC from source on Alpine - linux

While trying to install GCC 6.4.0 on Alpine, I run into:
checking for the correct version of gmp.h... yes
checking for the correct version of mpfr.h... yes
checking for the correct version of mpc.h... yes
checking for the correct version of the gmp/mpfr/mpc libraries... no
But in /usr/lib, which seems to be the standard lookup directory, I have:
libgmp.a
libgmp.so
libgmp.so.10
libgmp.so.10.3.2
libmpc.so.3
libmpc.so.3.0.0
libmpfr.so.4
libmpfr.so.4.1.5
What could be wrong?

The quickest way to install GCC on Alpine Linux is by issuing the following command:
apk add build-base
source: https://wiki.alpinelinux.org/wiki/GCC

The best way to install all necessary libraries to compile gcc is using ./contrib/download_prerequisites script in the gcc source directory. That will download the support libraries and create symlinks, causing them to be built automatically as part of the gcc build process.
The steps to compile gcc version 6.4.0 on Alpine linux are:
apk add --no-cache make build-base
wget https://ftp.gnu.org/gnu/gcc/gcc-6.4.0/gcc-6.4.0.tar.gz
tar -xzvf gcc-6.4.0.tar.gz
cd gcc-6.4.0
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
./../gcc-6.4.0/configure --prefix=$HOME/GCC-6.4.0 --disable-multilib
make all-gcc
make all-target-libgcc
make install-gcc
make install-target-libgcc

It turns out that in this particular case one needs to install mpc1-dev, gmp-dev or mpfr-dev. I was missing out on mpc1-dev.
sudo apk add mpc1-dev

Related

I want to install G++ on my Linux Mint but not able to do so

I want to install g++ for using GROMACS on Linux mint. I typed the following command:
sudo apt-get install g++
It successfully installs the g++ but when I change the directory to Downloads to configure and make cmake and fftw, it (Downloads) is empty.
I have tried removing sudo apt-get remove g++ and re-installing g++ but it shows the same result. I don't know where it is downloading g++.
The command apt-get install g++ doesn't download any executables into your current directory or in the ~/Downloads/ directory.
Usually, it is installed in /usr/bin.
You can check for g++ with the command g++ --version.
Also, you can see where it is installed with whereis g++.
The build-essential package is a reference for all the packages needed
to compile a Debian package. It generally includes the GCC/g++
compilers and libraries and some other utilities
https://superuser.com/a/151558
For this purpose install them with command sudo apt install build-essential
and it will install all the things

How to install Petite Chez Scheme on Ubuntu?

How to install Petite Chez Scheme on Ubuntu?
I run Ubuntu 15.10 and try to install pcsv8.4-a6le.tar.gz (non-threaded, 64 bit) for Linux.
After having unpacked this tar in /usr/locale, I enter the commands
sudo ./configure
sudo make install
from within the custom directory.
However, instead of a clean install, I get the following errors (which I hope someone can help me out with):
nlykkei#nlykkei-Studio-XPS-1640:/usr/local/csv8.4/custom$ sudo make install
if [ yes = no ]; then if [ ! -f ./scheme ]; then /bin/rm -f ./scheme; ln -s ../bin/a6le/scheme ./scheme; fi; fi
if [ ! -f ./petite ]; then /bin/rm -f ./petite; ln -s ./scheme ./petite; fi
/bin/rm -f ./scheme
echo "const char *S_date_stamp = \"`date +%m%d%Y%H%M%S`\";" > datestamp.c
gcc -m64 -rdynamic -o ./scheme datestamp.c ../boot/a6le/kernel.o ../boot/a6le/custom.o -lm -ldl -lncurses -lrt
/usr/bin/ld: cannot find -lncurses
collect2: error: ld returned 1 exit status
Mf-a6le:22: recipe for target 'scheme' failed
make[2]: *** [scheme] Error 1
Makefile:47: recipe for target 'buildpetite' failed
make[1]: *** [buildpetite] Error 2
Mf-install:64: recipe for target 'install' failed
make: *** [install] Error 2
On recent versions of Ubuntu (and future versions of Debian e.g. "Buster", and other Debian based distros), you can install Chez Scheme directly from the repo(s) by:
sudo apt install chezscheme
Previously you had to install it by compiling from source. Chez Scheme has been open source, for a few years now, and can be compiled from source, if it is not directly installable from the distribution's repo(s). Just download the source code compile and install. This will install not just the "petite" runtime version but also the full compiler. You can compile and install the software with:
./configure
sudo make install
Full build and install instructions are available here.
Pre-requisites for building are:
GNU Make
GCC
Header files and libraries for ncurses
Header files and libraries for X windows
On Ubuntu, install the libncurses5-dev package to get libncurses.so. (You can discover this by visiting http://packages.debian.org/file:libncurses.so (sadly, this doesn't seem to work for http://packages.ubuntu.com/file:libncurses.so).)
You may find other linkage errors if Chez requires other libraries to have development packages installed too. Use the same technique as above.
Go directly building from their Github.
ChezScheme
And then just do
./configure
sudo make install
Prerequisites according to Building are:
GNU Make
gcc
Header files and libraries for ncurses
Header files and libraries for X windows
And yes in case On Ubuntu, install the libncurses5-dev as Chris stated. Did just that and have no errors shown in clean install.
Chez Scheme has been open sourced since this question was asked. Since Bionic (18.04LTS) the full chezscheme is available as a repository.
First do
sudo apt update
then install the package:
sudo apt install chezscheme
This provides both the petite interpreter and the full scheme compiler.
There is also a PPA for trusty and xenial here:
https://launchpad.net/~jonathonf/+archive/ubuntu/lisp?field.series_filter=
Download the RPM package instead and use alien from terminal to produce a deb file:
fakeroot alien PetiteChezScheme-8.4-1.x86_64.rpm
You may need to install fakeroot, alien for this to work:
apt-get install fakeroot alien
Then you'll have a deb file. If you are on a desktop you can just double click the file and it will open Software Center and you can click install and it will fix your dependency problems.

Automake demands "Autoconf 2.65 or better" and yet I already have Autoconf 2.69 installed

Right now I'm trying to build Automake on my Mac, and so far everything has been going swimmingly. I built Autoconf and m4 without any issues out of the packages (as opposed to git pulls). And then I get to Automake, and that's where things fall apart:
checking whether autoconf is installed... yes
checking whether autoconf works... yes
checking whether autoconf is recent enough... no
configure: error: Autoconf 2.65 or better is required.
The issue persists if I build and install autoconf 2.68. Is there some sort of trick I'm missing on this one?
The make file is detecting an older version of Autoconf in your $PATH. Take a look at this post in Sebastien's blog, especially the part that tells you to add your new Autoconf bin dir to the $PATH before building Automake. If you want to follow "standard" OSX folder structure convention, install Autoconf in /usr/local.
Allow me to shamelessly copy Daniel Farrelly version of Sebastien's script.
export build=~/devtools # or wherever you'd like to build
mkdir -p $build
##
# Autoconf
# http://ftpmirror.gnu.org/autoconf
cd $build
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz
tar xzf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure --prefix=/usr/local
make
sudo make install
export PATH=/usr/local/bin
##
# Automake
# http://ftpmirror.gnu.org/automake
cd $build
curl -OL http://ftpmirror.gnu.org/automake/automake-1.13.2.tar.gz
tar xzf automake-1.13.2.tar.gz
cd automake-1.13.2
./configure --prefix=/usr/local
make
sudo make install

How do I link expat into a project

I have project that depends on expat. My problem is that I cannot link to expat. I use Ubuntu (debian environment) and need to use cmake to build a makefile.
I´ve tried to download the source and link to it inside my CMakeLists.txt:
include_directories(
...
${CMAKE_SOURCE_DIR}/expat-2.1.0/lib
...
)
I have tried to move the .c-files and link to them individually:
add_executable(${PROJECT_NAME}
...
src/xmlrole.c
src/xmltok.c
src/xmltok_impl.c
src/xmltok_ns.c
src/xmlparse.c
...
)
Though this doesn´t work and get, when linking, error in xmlparse.c
Does somebody know how you properly link a library inside a CMakeLists.txt file? Is it necessary to download the source code and link to the file themselves (which I can´t get working)?
Is downloading the source necessary or is it possible to link to the ".so - file" that is created when running "sudo apt-get install expat"?
If you don't need the very latest expat version, you should be able to use sudo apt-get install expat.
If you want the most recent version, download the source and extract it. Then:
cd <expat root>
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr (default install path is /usr/local)
make
sudo make install
Once it's installed, you can find it using CMake's FindEXPAT module.
So for example,
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(MyTest)
include(FindEXPAT)
find_package(EXPAT REQUIRED)
include_directories(${EXPAT_INCLUDE_DIRS})
add_executable(${PROJECT_NAME} <list of your source files>)
target_link_libraries(${PROJECT_NAME} ${EXPAT_LIBRARIES})
As said you can use
sudo apt-get install expat.
and then in the makefile with
-lexpat
you can link to the library if exists in the $PATH.
If is installed to a different path you have to do
-L path_of_the_library -lexpat

libcurl with libssh2 - one or more libs available at link-time are not available run-time

I get the following error when trying to ./configure libcurl 7.22.0
one or more libs available at link-time are not available run-time. Libs used at link-time: -lssh2 -lssl -lcrypto -lrt -lz
When I ./configure with --without-libssh2 it works just fine.
Steps I have taken:
apt-get install libssl-dev
apt-get install libssh-dev
cd /var
wget http://www.libssh2.org/download/libssh2-1.3.0.tar.gz
tar -zxvf libssh2-1.3.0.tar.gz
cd libssh2-1.3.0
./configure
make
make install
SSL support works fine, by the way. I must have done something wrong with libssh
I have also tried:
./configure --with-libssh2
./configure --with-libssh2-path=/usr/local/lib
./configure --with-libssh2=/usr
./configure --with-libssh2=/usr/local/lib
But it didn't make a difference. I don't know what else to try.
The "libssh-dev" package is completely unrelated and unnecessary since it's a different library not used by libcurl nor libssh2.
The problem you face is probably that "make install" with libssh2 installs the library /usr/local/lib by default and you have not edited /etc/ld.so.conf to load libs from that directory. Edit the file and run ldconfig (both actions as root). Alternatively, install libssh2 into another directory that already is searched in by ld.so.
check while openssl installed successly?
openssl version
if not show version info, set openssl correctly
for example:
ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.1
ln -s /usr/local/lib64/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1
and continue install curl, it work for me

Resources