How to install FGSL in Ubuntu 20.04? - fortran

How to install FGSL in Ubuntu 20.04?
I tried the following :
Add key
sudo apt install curl
curl http://lvserver.ugent.be/apt/xmi.packages.key | sudo apt-key add -
Add repo
deb [arch=amd64] http://lvserver.ugent.be/apt/ubuntu focal stable
deb-src http://lvserver.ugent.be/apt/ubuntu focal stable
to /etc/apt/sources.list file.
Update & install FGSL
sudo apt-get update
sudo apt-get install libfgsl0 libfgsl0-dev libfgsl0-doc
But, it says Unable to locate package.

(I'm not sure about whether I should write this as an answer to my own question or add this as an edit to the question. Yet, I'm chosing to write this as an answer because I feel it's little bit bigger to be added as an edit to the question.)
I found an easier way to install FGSL using Synaptic Package Manager.
Add the key.
Add the repo deb [arch=amd64] http://lvserver.ugent.be/apt/ubuntu focal stable.
(I also found an easier way to add new repo: Open Software & Updates application; select 'Other Softwares'; and then add the repo location.)
Open Ubuntu Software. Search for Synaptic Package Manager and install it.
Now, open Synaptic Package Manager and search 'libfgsl'. Mark the libfgsl packages for installation. (If you haven't installed GSL, then search 'libgsl' and mark the relevant gsl packages also for installation.) Then select 'Apply'.
That's it.
For using FGSL and compiling with gfortran, I found helpful instructions in this post. I used the example program (testintegral.f90, but I saved it as fgsl_test.f90) provided in that post. In my case, the fgsl.mod file was in the location: /usr/include/fgsl/ and I used this command to compile my program
gfortran -I/usr/include/fgsl fgsl_test.f90 -lfgsl
I'm not sure whether it is necessary to add -lgsl and -lgslcblas but it worked fine without them.

Related

How to install libpq-fe.h?

I cannot figure this out for the life of me.
When I pip install django-tenant-schemas it tries to install the dependency psycopg2 which requires the Python headers and gcc. I have all this installed and still keep getting this error!
./psycopg/psycopg.h:35:10: fatal error: libpq-fe.h: No such file or directory
So to install libpq-fe-h I need to sudo apt-get install libpq-dev..
..which returns..
libpq-dev is already the newest version (10.10-0ubuntu0.18.04.1).
Then when I sudo find / libpq-fe.h it doesn't seem to be in my OS.
I am lost at this point. If anyone can help I would highly appreciate it.
For some reason, the file is missing on the system.
As you're using apt-get, the system is dpkg based, presumably Debian or it's derivative. You can try the Ubuntu's package search to get which package contains a file with name ending in libpq-fe.h.
I found the package is libpq-dev and file's absolute path is /usr/include/postgresql/libpq-fe.h.
FWIW, on a dpkg based system, you can check which package gives a file if you know the file's absolute path:
% dpkg -S /usr/include/postgresql/libpq-fe.h
libpq-dev: /usr/include/postgresql/libpq-fe.h
Also, unlike find, locate keeps a cache of found files (mlocate.db) that is created everyday via cron; so if the file happens to be removed after the last run, you can run locate libfq-fe.h to get the absolute path to the file without needing to check the Ubuntu package search online.
So the package is libpq-dev. Now, reinstalling it will get everything to the default state i.e. all relevant files will be copied to the right places. As it is only a library package, no user/system level configurations will be overridden (and dpkg will prompt you for action for any package that does that).
To reinstall the package:
sudo apt-get install --reinstall libpq-dev
For me, I realized it was trying to use the deprecated setup.py so I installed wheel (pip install wheel) and that sorted it all out.
Well after installing these libraries
sudo dnf install python-virtualenv openssl-devel gcc libffi-devel libxslt-devel issue was not gone.
I used mlocate to find where libpq-fe.h file is located. On my system (Fedora 32) it was located at /usr/pgsql-10/include/libpq-fe.h
yum install mlocate
sudo updateb
locate libpq-fe.h
After all added this line to ~/.bash_profile
nano ~/.bash_profile
export PATH=/usr/pgsql-10/bin/:$PATH
Works fine, I can easily install psycopg2 without any trouble.
You need to create a LD_LIBRARY_PATH that indicates the path of your library /user/pgsql-11/lib
Source: The 3rd point of build prerequisites at https://www.psycopg.org/docs/install.html#build-prerequisites

Debian/Raspbian install QGIS 3.x

Re-posted from GIS stackexchange as this is becoming more of a software question.
I'm trying to install QGIS 3.x on Raspbian Stretch with Desktop.
I found this build-from-source guide using this forum post, but my linux-fu is weak.
I followed sections 3.5 and 3.6 of that guide, and then started on section 3.8.
At the dpkg-buildpackage -us -uc -b stage, I get an "unmet build dependencies" error. When trying to sudo apt-get install the missing packages I get several "Unable to locate package" errors (libqscintilla2-qt5-dev, qt3d-assimpsceneimport-plugin, qt3d-defaultgeometryloader-plugin, and qt3d-scene2d-plugin).
I've already added deb https://qgis.org/debian unstable main and deb-src https://qgis.org/debian unstable main to my sources.list file (as per QGIS install page...but now I'm stumped as to what to do.
Do I need to add another source (which one?) to that file, or is it something completely different?
Alternative to building from source.
Issue: with the QGIS install instructions (assuming I followed them correctly) - it was unable to find the python3-qgis package.
Solution: basically use a different mirror than what the install recommends.
Starting from a fresh Raspbian Stretch with Desktop install.
Run: sudo apt-get update
Run: sudo nano /etc/apt/sources.list
Uncomment the deb-src line (not sure this matters).
Add the following line: "deb http://ftp.debian.org/debian sid main" (alternative mirrors can be found here).
Run: sudo apt-get update
Run: sudo apt-get install qgis python3-qgis qgis-plugin-grass
This will install ~300 packages, and can take a while (~4min to download for me). After the download there is a changelog/notice that must be read (keep pressing return then q). Soon after starting the download there is a prompt...once you're past that you should be safe to step away while it installs.
Once done you can launch QGIS (3.4 Madeira LTR as of this writing) by simply typing qgis from the terminal.

How to add the Audio/Video Property tab to Caja?

By default Caja does not come with the Audio/Video Properties tab that is present in Nautilus since... a very long time.
How can this tab be added?
gnome-mplayer includes an extension for caja since version 1.0.9-2:
https://code.google.com/p/gnome-mplayer/source/checkout
However, the version of gnome-mplayer-1.0.9-2 that comes from the Ubuntu repositories does not include the caja extension:
/usr/lib/caja/extensions-2.0/libgnome-mplayer-caja-properties-page.so
OR (for amd64):
/usr/lib/x86_64-linux-gnu/caja/extensions-2.0/libgnome-mplayer-caja-properties-page.so
I suspect that the reason is that when the .DEB was compiled, caja was not installed and thus not detected.
Therefore the only solution is to compile from source or use a deb compiled by someone else:
https://www.dropbox.com/s/x340ym3xeyhuosu/gnome-mplayer_1.0.9.2-2_amd64.deb?dl=1
https://www.dropbox.com/s/qm6nkgkaebddtrj/gnome-mplayer_1.0.9-1_i386.deb?dl=1
STEPS to compile:
Install dependencies:
Run the following as root:
apt-get build-dep gnome-mplayer
apt-get install make automake
apt-get install svn
apt-get install libcaja-extension-dev
Download source code with svn:
svn checkout http://gnome-mplayer.googlecode.com/svn/trunk/ gnome-mplayer
Compile
The make might complain that it cannot find automake-1.13 when you have automake-1.14
In order to resolve this run the following in the source folder:
aclocal
automake
./configure
make
after this all you need to do is to run:
make install OR checkinstall
Finally you might need to also install mplayer if you don't already have it.
Restart caja by logout/login or killall caja
Now you should have the property tab.
If you don't, check if you can open a movie with gnome-mplayer.
Let me know if you encounter any issues!
UPDATE: referenced dropbox package now installs the dependencies

Install boost version 1.40

I am using a server running with Ubuntu 12.04
I want to install the boost libraries in it. I know
sudo apt-get install libboost-all-dev
will make the work done, but it installs the latest version version 1.52 or above.
But I need to install the particular version 1.40 as there is a problem in a simulator which I am using for my academic purpose. What is the particular command for that so that I can install the boost libraries along with the other requirements for it like the linking files
Thanks in advance
Quick answer: sudo apt-get install libboost-dev= 1.40.0.1
If it doesn't work, continue reading.
The apt-get does support installing a particular version of a package as long as it is in an archive that apt knows about. From the apt-get manpage:
A specific version of a package can be selected for installation by following the
package name with an equals and the version of the package to select. This will
cause that version to be located and selected for install. Alternatively a specific
distribution can be selected by following the package name with a slash and the version of
the distribution or the Archive name (stable, frozen, unstable).
For e.g. if you wanted to install apache 2.20 for Ubuntu, you would do something like:
sudo apt-get install apache2=2.2.20-1ubuntu1
Note that you may need to do some dependency resolution on your own in this case, but if there are any problems apt-get will tell you what is causing them. For e.g.(on 11.04)
sudo apt-get install apache2=2.2.20-1ubuntu1 \
apache2.2-common=2.2.20-1ubuntu1 \
apache2.2-bin=2.2.20-1ubuntu1 \
apache2-mpm-worker=2.2.20-1ubuntu1
Note: You must first check if build 1.40 is still available. For that use:
aptitude search libboost
If aptitude search command don't give you sufficient results, try sudo aptitude update and then run aptitude search again.
You might have to investigate whether debs from earlier Ubuntu versions can be installed. i.e. remove the current package, download the debs and try installing them. But there could be dependency on older versions of the standard library.If so, you can probably try downloading the source from launchpad.
As a last resort, download from boost.org and build it - painfully!
EDIT: I see you have asked the same question on ubuntu forums and it seems that you have 1.48 as the default. You might have to build the library itself. Can you try this apt-get
sudo apt-get install libboost1.40-all-dev=1.40.0-4ubuntu4
If this doesn't work, you will have to build it and install it yourself. You can download the source from
Download source (1.40.0): libboost 1.40.0 source files
After it's installed, run the following command to hold your installed version, preventing the package manager from automatically updating it in the future:
sudo echo "[packagename] hold" | sudo dpkg --set-selections
Source:How to Downgrade Packages on Ubuntu
Generally you download sources, build it (some parts are not just headers like filesystem on Windows). Then you can select which subset of libraries you want to install (you can make compact version with only what you need). Then by invoking bootstrap script you build it to another directory this subset of libraries you want and then you invoke install.
Here is a pretty good description how to do it: http://ubuntuforums.org/showthread.php?t=1180792

How do I install the OpenSSL libraries on Ubuntu?

I'm trying to build some code on Ubuntu 10.04 LTS that uses OpenSSL 1.0.0. When I run make, it invokes g++ with the "-lssl" option. The source includes:
#include <openssl/bio.h>
#include <openssl/buffer.h>
#include <openssl/des.h>
#include <openssl/evp.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
I ran:
$ sudo apt-get install openssl
Reading package lists... Done
Building dependency tree
Reading state information... Done
openssl is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
But I guess the openssl package doesn't include the library. I get these errors on make:
foo.cpp:21:25: error: openssl/bio.h: No such file or directory
foo.cpp:22:28: error: openssl/buffer.h: No such file or directory
foo.cpp:23:25: error: openssl/des.h: No such file or directory
foo.cpp:24:25: error: openssl/evp.h: No such file or directory
foo.cpp:25:25: error: openssl/pem.h: No such file or directory
foo.cpp:26:25: error: openssl/rsa.h: No such file or directory
How do I install the OpenSSL C++ library on Ubuntu 10.04 LTS?
I did a man g++ and (under "Options for Linking") for the -l option it states: " The linker searches a standard list of directories for the library..." and "The directories searched include several standard system directories..." What are those standard system directories?
You want to install the development package, which is libssl-dev:
sudo apt-get install libssl-dev
Run:
apt-get install libssl-dev
All of these answers are very outdated and from when the package was still being developed. You can now just use the "normal" command listed below:
sudo apt install openssl
Edit: OP's question is poorly worded... after all, OpenSSL is a library itself, so I read his question too quickly before answering. The command above installs "normal" OpenSSL.
Toward the bottom of his question he mentions that make fails, suggesting he is compiling the package manually. And yes, even if you download the TAR ball, it will include all of the openssl and libssl files, which you can then make from.
What OP is really asking for is the OpenSSL Development Library, in which case you can first install OpenSSL using the above command, and then run this afterwards:
sudo apt install libssl-dev
More info: https://linuxtect.com/how-to-install-openssl-libraries-on-ubuntu-debian-mint/
I found a detailed solution here: Install OpenSSL Manually On Linux
From the blog post...:
Steps to download, compile, and install are as follows (I'm installing version 1.0.1g below; please replace "1.0.1g" with your version number):
Step – 1 : Downloading OpenSSL:
Run the command as below :
$ wget http://www.openssl.org/source/openssl-1.0.1g.tar.gz
Also, download the MD5 hash to verify the integrity of the downloaded file for just varifacation purpose. In the same folder where you have downloaded the OpenSSL file from the website :
$ wget http://www.openssl.org/source/openssl-1.0.1g.tar.gz.md5
$ md5sum openssl-1.0.1g.tar.gz
$ cat openssl-1.0.1g.tar.gz.md5
Step – 2 : Extract files from the downloaded package:
$ tar -xvzf openssl-1.0.1g.tar.gz
Now, enter the directory where the package is extracted like here is openssl-1.0.1g
$ cd openssl-1.0.1g
Step – 3 : Configuration OpenSSL
Run below command with optional condition to set prefix and directory where you want to copy files and folder.
$ ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
You can replace “/usr/local/openssl” with the directory path where you want to copy the files and folders. But make sure while doing this steps check for any error message on terminal.
Step – 4 : Compiling OpenSSL
To compile openssl you will need to run 2 command : make, make install as below :
$ make
Note: check for any error message for verification purpose.
Step -5 : Installing OpenSSL:
$ sudo make install
Or without sudo,
$ make install
That’s it. OpenSSL has been successfully installed. You can run the version command to see if it worked or not as below :
$ /usr/local/openssl/bin/openssl version
OpenSSL 1.0.1g 7 Apr 2014
How could I have figured that out for
myself (other than asking this
question here)? Can I somehow tell
apt-get to list all packages, and grep
for ssl? Or do I need to know the
"lib*-dev" naming convention?
If you're linking with -lfoo then the library is likely libfoo.so. The library itself is probably part of the libfoo package, and the headers are in the libfoo-dev package as you've discovered.
Some people use the GUI "synaptic" app (sudo synaptic) to (locate and) install packages, but I prefer to use the command line. One thing that makes it easier to find the right package from the command line is the fact that apt-get supports bash completion.
Try typing sudo apt-get install libssl and then hit tab to see a list of matching package names (which can help when you need to select the correct version of a package that has multiple versions or other variations available).
Bash completion is actually very useful... for example, you can also get a list of commands that apt-get supports by typing sudo apt-get and then hitting tab.
Another way to install openssl library from source code on Ubuntu, follows steps below, here WORKDIR is your working directory:
sudo apt-get install pkg-config
cd WORKDIR
git clone https://github.com/openssl/openssl.git
cd openssl
./config
make
sudo make install
# Open file /etc/ld.so.conf, add a new line: "/usr/local/lib" at EOF
sudo ldconfig
You want the openssl-devel package.
At least I think it's -devel on Ubuntu. Might be -dev. It's one of the two.
As a general rule, when on Debian or Ubuntu and you're missing a development file (or any other file for that matter), use apt-file to figure out which package provides that file:
~ apt-file search openssl/bio.h
android-libboringssl-dev: /usr/include/android/openssl/bio.h
libssl-dev: /usr/include/openssl/bio.h
libwolfssl-dev: /usr/include/cyassl/openssl/bio.h
libwolfssl-dev: /usr/include/wolfssl/openssl/bio.h
A quick glance at each of the packages that are returned by the command, using apt show will tell you which among the packages is the one you're looking for:
~ apt show libssl-dev
Package: libssl-dev
Version: 1.1.1d-2
Priority: optional
Section: libdevel
Source: openssl
Maintainer: Debian OpenSSL Team <pkg-openssl-devel#lists.alioth.debian.org>
Installed-Size: 8,095 kB
Depends: libssl1.1 (= 1.1.1d-2)
Suggests: libssl-doc
Conflicts: libssl1.0-dev
Homepage: https://www.openssl.org/
Tag: devel::lang:c, devel::library, implemented-in::TODO, implemented-in::c,
protocol::ssl, role::devel-lib, security::cryptography
Download-Size: 1,797 kB
APT-Sources: http://ftp.fr.debian.org/debian unstable/main amd64 Packages
Description: Secure Sockets Layer toolkit - development files
This package is part of the OpenSSL project's implementation of the SSL
and TLS cryptographic protocols for secure communication over the
Internet.
.
It contains development libraries, header files, and manpages for libssl
and libcrypto.
N: There is 1 additional record. Please use the '-a' switch to see it
Go to the official website and download the source code for the version you need
Then unzip the update package and execute the following command
./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl -Wl,-rpath,/usr/local/ssl/lib shared
Because the default is to generate only static libraries, if you want dynamic libraries, add the "shared" option
make && make install
sudo apt-get install libcurl4-openssl-dev