FGSL configuration with local install of GSL - compilation

I would like to use library fgsl, that depends on gsl. I have problem indicating where gsl is installed while configuring fgsl. I want to use the static version of these libraries. I can not use gsl library from Linux packages, these versions are not recent enough.
First I download, configure, compile and install gsl locally, i.e. using the --prefix option. (Instructions are presented below)
Then I download fgsl, configure it. This last operation fails because I do not succeed indicating where is gsl. I have tried to use gsl_LIBS unsuccessfully.
wget http://ftp.igh.cnrs.fr/pub/gnu/gsl/gsl-2.3.tar.gz -O gsl.tar.gz
mkdir -p gsl_build && cd gsl_build
tar -xzf ../gsl.tar.gz --strip 1
autoreconf -fi
./configure CFLAGS="-Wall" --prefix `pwd`/../gsl
make
make install
cd ..
rm -rf gsl_build
Here are the commands I run to install fgsl
wget https://github.com/reinh-bader/fgsl/archive/v1.2.0.tar.gz -O fgsl.tar.gz
mkdir -p fgsl_build
cd fgsl_build
tar -xzf ../fgsl.tar.gz --strip 1
autoreconf -fi
export gsl_LIBS=`pwd`/../gsl/lib
./configure CFLAGS="-Wall" FCFLAGS="-Wall" --prefix `pwd`/../fgsl --libdir=`pwd`/../gsl/lib --includedir=`pwd`/../gsl/include
make
make check
make install
cd ..
rm -rf fgsl_build
I try to do this for the open source project AcousticBEM. Here is the log presenting the problem.

Well, here are my updated scripts to install gsl and fgsl locally. I have used PKG_CONFIG_PATH to tell fgsl where gsl is installed. I end up with a directory named gsl containing gsl libraries and fgsl libraries.
First a shell script to install gsl
export gsl_INSTALL_DIR=`pwd`/gsl
[ -f ./gsl.tar.gz ] && echo "No need to download gsl" || wget http://ftp.igh.cnrs.fr/pub/gnu/gsl/gsl-2.3.tar.gz -O gsl.tar.gz
mkdir -p gsl_build
cd gsl_build
tar -xzf ../gsl.tar.gz --strip 1
autoreconf -fi
./configure CFLAGS="-Wall" --prefix=${gsl_INSTALL_DIR}
make
make install
cd ..
rm -rf gsl_build
Second, a script to install fgsl locally using the newly install gsl
export PKG_CONFIG_PATH=`pwd`/gsl/lib/pkgconfig
export gsl_LIBS=`pwd`/gsl
[ -f ./fgsl.tar.gz ] && echo "No need to download fgsl" || wget https://github.com/reinh-bader/fgsl/archive/v1.2.0.tar.gz -O fgsl.tar.gz
mkdir -p fgsl_build
cd fgsl_build
tar -xzf ../fgsl.tar.gz --strip 1
autoreconf -fi
./configure CFLAGS="-Wall" FCFLAGS="-Wall" --prefix=${gsl_LIBS}
make
make check
make install
cd ..
rm -rf fgsl_build

Related

How to build a gcc cross compiler for arm64

On X86, I need to build a gcc cross compiler for arm64 with things as below:
binutils-2.26.1.tar.gz gcc-5.4.0.tar.gz glibc-2.23.tar.gz gmp-6.1.2.tar.bz2 mpc-1.1.0.tar.gz mpfr-4.0.1.tar.gz
I've put all of them into a directory named download.
After reading this link: http://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/, I wrote a bash script as below to build the gcc cross compiler:
#!/bin/bash
sudo rm -rf build sources /opt/aarch64-linux-gnu-5.4.0
mkdir build
cp -r download sources
cd sources
for f in *.tar*; do tar xf $f; done
cd gcc-5.4.0/
ln -s ../mpfr-4.0.1 mpfr
ln -s ../mpc-1.1.0 mpc
ln -s ../gmp-6.1.2 gmp
cd ../..
export PREFIX=/opt/aarch64-linux-gnu-5.4.0
#export PATH=$PREFIX/bin:$PATH
export SYSROOT=$PREFIX/sysroot
export TARGET=aarch64-linux-gnu
cd build
mkdir binutils && cd binutils
../../sources/binutils-2.26.1/configure --prefix=/$PREFIX --target=$TARGET
make -j32
make install
cd ..
cd /home/me/projet/kernel/linux-4.1
make ARCH=arm64 INSTALL_HDR_PATH=$PREFIX/aarch64-linux-gnu/include headers_install
cd -
mkdir gcc && cd gcc
../../sources/gcc-5.4.0/configure --prefix=$PREFIX --target=$TARGET --enable-languages=c,c++ --without-headers
make -j32 all-gcc
make install-gcc
cd ..
mkdir -p glibc && cd glibc
../../sources/glibc-2.23/configure --prefix= --build=$MACHTYPE --host=$TARGET --target=$TARGET --with-headers=$PREFIX/aarch64-linux-gnu/include libc_cv_forced_unwind=yes
make prefix=$PREFIX/aarch64-linux-gnu install-bootstrap-headers=yes install-headers
make -j32 csu/subdir_lib
install csu/crt1.o csu/crti.o csu/crtn.o $PREFIX/aarch64-linux-gnu/lib
/opt/aarch64-linux-gnu-5.4.0/bin/aarch64-linux-gnu-gcc -nostdlib -nostartfiles -shared -x c /dev/null -o $PREFIX/aarch64-linux-gnu/lib/libc.so
touch $PREFIX/aarch64-linux-gnu/include/gnu/stubs.h
cd ..
cd gcc
make -j32 all-target-libgcc
make install-target-libgcc
cd ..
cd glibc
make -j32
make prefix=$PREFIX/aarch64-linux-gnu install
cd ..
cd gcc
make -j32
make install
cd ..
However, when I executed this bash script, I got two errors:
cc1: error: no include path in which to search for stdc-predef.h
In file included from ../../../../sources/gcc-5.4.0/libgcc/gthr.h:148:0,
from ../../../../sources/gcc-5.4.0/libgcc/libgcov-interface.c:27:
./gthr-default.h:35:21: fatal error: pthread.h: No such file or directory

build static sox with lame and flac support for AWS lambda

I'm trying to use sox in a AWS lambda function for conversion of FLAC file to MP3, but I cannot seem to build a version of sox with FLAC support.
I have found this great solution that I have been using but it doesn't support FLAC.
I've searched the net for alternatives but nothing seems to work. I've also read that at some stage FLAC support went missing but should have been fixed.
I'm still looking for answers, but any help is appreciated.
You need to add the libvorbis and flac libraries to your static build and flag the sox build to include them. I have made changes to the script from your example questions to show you how this done.
sudo yum update
sudo yum install gcc44 gcc-c++ libgcc44 cmake –y
# now grab sox and its dependencies
mkdir -p deps
mkdir -p deps/unpacked
mkdir -p deps/built
mkdir -p deps/built/libmad
mkdir -p deps/built/sox
mkdir -p deps/built/lame
mkdir -p deps/built/libvorbis
mkdir -p deps/built/flac
wget -O deps/sox-14.4.2.tar.bz2 "http://downloads.sourceforge.net/project/sox/sox/14.4.2/sox-14.4.2.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fsox%2Ffiles%2Fsox%2F14.4.2%2F&ts=1416316415&use_mirror=heanet"
wget -O deps/libmad-0.15.1b.tar.gz "http://downloads.sourceforge.net/project/mad/libmad/0.15.1b/libmad-0.15.1b.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmad%2Ffiles%2Flibmad%2F0.15.1b%2F&ts=1416316482&use_mirror=heanet"
wget -O deps/lame-3.99.5.tar.gz "http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flame%2Ffiles%2Flame%2F3.99%2F&ts=1416316457&use_mirror=kent"
wget -O deps/libvorbis-1.3.5.tar.xz "http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.xz"
wget -O deps/flac-1.3.2.tar.xz "https://superb-dca2.dl.sourceforge.net/project/flac/flac-src/flac-1.3.2.tar.xz"
# unpack the dependencie
pushd deps/unpacked
tar xvfp ../sox-14.4.2.tar.bz2
tar xvfp ../libmad-0.15.1b.tar.gz
tar xvfp ../lame-3.99.5.tar.gz
tar xvfp ../libvorbis-1.3.5.tar.xz
tar xvfp ../flac-1.3.2.tar.xz
popd
# build libmad, statically
pushd deps/unpacked/libmad-0.15.1b
./configure --disable-shared --enable-static --prefix=$(realpath ../../built/libmad)
# Patch makefile to remove -fforce-mem
sed s/-fforce-mem//g < Makefile > Makefile.patched
cp Makefile.patched Makefile
make
make install
popd
# build lame, statically
pushd deps/unpacked/lame-3.99.5
./configure --disable-shared --enable-static --prefix=$(realpath ../../built/lame)
make
make install
popd
# build libvorbis, statically
pushd deps/unpacked/libvorbis-1.3.5
./configure --disable-shared --enable-static --prefix=$(realpath ../../built/libvorbis)
make
make install
popd
# build flac, statically
pushd deps/unpacked/flac-1.3.2
./configure --disable-shared --enable-static --prefix=$(realpath ../../built/flac)
make
make install
popd
# build sox, statically
pushd deps/unpacked/sox-14.4.2
./configure --disable-shared --enable-static --prefix=$(realpath ../../built/sox) \
LDFLAGS="-L$(realpath ../../built/libmad/lib) -L$(realpath ../../built/lame/lib) -L$(realpath ../../built/libvorbis/lib) -L$(realpath ../../built/flac/lib)" \
CPPFLAGS="-I$(realpath ../../built/libmad/include) -I$(realpath ../../built/lame/include) -I$(realpath ../../built/libvorbis/include) -I$(realpath ../../built/flac/include)" \
--with-mad --with-lame --with-libvorbis --with-flac --without-oggvorbis --without-oss --without-sndfile --without-gomp
make -s
make install
popd
cp deps/built/sox/bin/sox .
rm -rf deps/built
rm -rf deps/unpacked

gmp, mpc + mpfr: is not symbolic link

I build gcc 4.6.1 and when I run ldconfig it comes back with this result:
ldconfig: /usr/local/mpc/lib/libmpc.so.2 is not a symbolic link
ldconfig: /usr/local/gmp/lib/libgmp.so.3 is not a symbolic link
ldconfig: /usr/local/mpfr/lib/libmpfr.so.1 is not a symbolic link
Here is how I built gcc using the libraries:
tar jxf gmp-4.3.2.tar.bz2
cd gmp-4.3.2/
./configure --prefix=/usr/local/gmp
make
make install
cd ..
tar jxf mpfr-2.4.2.tar.bz2
cd mpfr-2.4.2/
./configure --prefix=/usr/local/mpfr --with-gmp=/usr/local/gmp
make
make install
cd ..
tar xzf mpc-0.8.1.tar.gz
cd mpc-0.8.1
./configure --prefix=/usr/local/mpc --with-mpfr=/usr/local/mpfr --with-gmp=/usr/local/gmp
make
make install
cd ..
tar jxf gcc-4.6.1.tar.bz2
cd gcc-4.6.1
./configure --prefix=/usr/local/gcc --enable-threads=posix --disable-checking -disable-multilib --enable-languages=c,c++ --with-gmp=/usr/local/gmp --with-mpfr=/usr/local/mpfr/ --with-mpc=/usr/local/mpc/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mpc/lib:/usr/local/gmp/lib:/usr/local/mpfr/lib/
make
make install
cp gcc.4.6.1.conf /etc/ld.so.conf.d/gcc.4.6.1.conf
ldconfig
mv /usr/bin/gcc /usr/bin/gcc_old
mv /usr/bin/g++ /usr/bin/g++_old
ln -s -f /usr/local/gcc/bin/gcc /usr/bin/gcc
ln -s -f /usr/local/gcc/bin/g++ /usr/bin/g++
cp /usr/local/gcc/lib64/libstdc++.so.6.0.16 /usr/lib64/.
mv /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6.bak
ln -s -f /usr/lib64/libstdc++.so.6.0.16 /usr/lib64/libstdc++.so.6
Please say I don't need to rebuild gcc! Is this symbolic link problem something that can really affect a program? Or will it not make any difference, it does pop up every now and again, for instance when I was yum install certain things as well. Thanks in advance.
I fixed this problem by installing gmp, mpc, and mpfr with the ./contrib/download_prerequisites command, which downloads the required files and sets up symbolic links during the install process.
My whole build was:
tar -xzvf gcc-4.6.2.tar.gz
cd gcc-4.6.2
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-4.6.2/configure --prefix=/opt/gcc-4.6.2
make
make install
ldconfig
mv /usr/bin/gcc /usr/bin/gcc_old
mv /usr/bin/g++ /usr/bin/g++_old
ln -s -f /usr/local/gcc/bin/gcc /usr/bin/gcc
ln -s -f /usr/local/gcc/bin/g++ /usr/bin/g++
cp /usr/local/gcc/lib64/libstdc++.so.6.0.16 /usr/lib64/.
mv /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6.bak
ln -s -f /usr/lib64/libstdc++.so.6.0.16 /usr/lib64/libstdc++.so.6
export CC=gcc
export CXX=g++
I don't know how to fully link the CC and CXX variables to the new gcc and g++, but it works!

Issue linking gcc-4.7 Mac OSX 10.6

So I downloaded gcc using homebrew so that I could update gcc and g++ to 4.7.
So then I:
$ mkdir ~/bin
created ~/.bashrc with contents:
'export PATH=$HOME/bin:$PATH'
created ~/.bash_profile with contents:
'. $HOME/.bashrc'
and then:
$ ln -s /usr/local/bin/g++-4.7 ~/bin/g++
so now I run g++ -v and it's 4.7, YAY!
Now I go to update gcc and do:
$ ln -s /usr/local/bin/gcc-4.7 ~/bin/gcc
I get no errors but then when I run gcc -v i get:
gcc-4.7: error trying to exec '/usr/local/bin/i686-apple-darwin10-gcc-4.2.1': execvp: No such file or directory
So it seems to be looking for 4.2 for some reason? If I cd to ~/bin/gcc and do ./gcc -v it works fine. Also echo $PATH has the correct ~/bin path. I'm not sure why g++ worked and gcc didnt.
I had the same problem.
This is because bash has hashed the gcc in other folder.
run: hash gcc
Then everything should go smooth.

SQLite FTS3 installation, unable to create virtual table after installation

I a bit new to sqllite lite and linux commands so any help would be greatly appreciated! Is there something I am missing?
After the sqlite-3.7.3 installation, for some reason I am still still not seeing the new version (sqlite-3.7.3) when checking with
macbook-pro:sqlite-3.7.3 scott$ which sqlite3
/usr/bin/sqlite3
macbook-pro:sqlite-3.7.3 scott$ sqlite3 test.db
SQLite version 3.6.12
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create virtual table vt using fts3();
SQL error: no such module: fts3
sqlite installation dump:
macbook-pro:sqlite-3.7.3 scott$ sudo make install
test -z "/usr/local/lib" || /Users/scott/sqlite-3.7.3/install-sh -d "/usr/local/lib"
/bin/sh ./libtool --mode=install /usr/bin/install -c 'libsqlite3.la' '/usr/local/lib/libsqlite3.la'
/usr/bin/install -c .libs/libsqlite3.0.8.6.dylib /usr/local/lib/libsqlite3.0.8.6.dylib
(cd /usr/local/lib && { ln -s -f libsqlite3.0.8.6.dylib libsqlite3.0.dylib || { rm -f libsqlite3.0.dylib && ln -s libsqlite3.0.8.6.dylib libsqlite3.0.dylib; }; })
(cd /usr/local/lib && { ln -s -f libsqlite3.0.8.6.dylib libsqlite3.dylib || { rm -f libsqlite3.dylib && ln -s libsqlite3.0.8.6.dylib libsqlite3.dylib; }; })
/usr/bin/install -c .libs/libsqlite3.lai /usr/local/lib/libsqlite3.la
/usr/bin/install -c .libs/libsqlite3.a /usr/local/lib/libsqlite3.a
chmod 644 /usr/local/lib/libsqlite3.a
ranlib /usr/local/lib/libsqlite3.a
Libraries have been installed in:
/usr/local/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the -LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to theDYLD_LIBRARY_PATH' environment variable
during execution
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
test -z "/usr/local/bin" || /Users/scott/sqlite-3.7.3/install-sh -d "/usr/local/bin"
/bin/sh ./libtool --mode=install /usr/bin/install -c 'sqlite3' '/usr/local/bin/sqlite3'
/usr/bin/install -c .libs/sqlite3 /usr/local/bin/sqlite3
test -z "/usr/local/include" || /Users/scott/sqlite-3.7.3/install-sh -d "/usr/local/include"
/usr/bin/install -c -m 644 'sqlite3.h' '/usr/local/include/sqlite3.h'
/usr/bin/install -c -m 644 'sqlite3ext.h' '/usr/local/include/sqlite3ext.h'
test -z "/usr/local/share/man/man1" || /Users/scott/sqlite-3.7.3/install-sh -d "/usr/local/share/man/man1"
/usr/bin/install -c -m 644 './sqlite3.1' '/usr/local/share/man/man1/sqlite3.1'
test -z "/usr/local/lib/pkgconfig" || /Users/scott/sqlite-3.7.3/install-sh -d "/usr/local/lib/pkgconfig"
/usr/bin/install -c -m 644 'sqlite3.pc' '/usr/local/lib/pkgconfig/sqlite3.pc'scott
Where did you install the sqlite3 command and what is your path? Type
echo $PATH
and check whether the dir where the command is located precedes /usr/bin, where SQLite 3.6 is installed. If it doesn't, change your path in .bashrc.

Resources