How to install older gcc package using APT from a repository? - linux

I have GCC v9. But I'm trying to install a GCC 4.8.1 version to test a library compilation on that very old version of GCC.
The version is not available in the official Ubuntu repos,it is deprecated, but I've found it in other mirrors as told by the official GCC website. This one seems like popular one:
https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
I have very little knowledge of linux package systems except for the basic. I want to keep both versions. So I should do this:
sudo apt -y install gcc-4.8.1 gcc-9
The reason why I want to use this command and not install it from the file, apart from the difficulty of doing that for me, is that I'm following a guide in order to have several GCCs on my system:
https://www.fosslinux.com/39386/how-to-install-multiple-versions-of-gcc-and-g-on-ubuntu-20-04.htm
When I add the url to the sources.list file seems like it is working.
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update -q
But when I try to call the install with gcc-4.8.1 or gcc-4.8 , or even gcc-4 the package doesn't exist.
Package gcc-4.8 is not available, but is referred to by another
package. This may mean that the package is missing, has been
obsoleted, or is only available from another source E: Package
'gcc-4.8' has no installation candidate
Also, I don't know if websites like these can be added to the repos list in order to find the package using APT:
http://www.netgull.com/gcc/releases/gcc-4.8.1/
[EDIT]
I downloaded the package from the website I linked. I have no idea how to install this by hand. If only I could find a repository that could help me with this... I have no idea how to make APT help me with the installation.

But I'm trying to install a GCC 4.8.1 version to test a library compilation on that very old version of GCC.
Developers have tools up their sleeve so they don't have to install dependencies and bloating their systems for every library (and every configuration of that library!) they want to try out and test.
Use docker. You could write for example a testing script, assuming your project uses make:
# test_my_lib_in_gcc-4.8.sh
#!/bin/sh
docker run -ti --rm -v $PWD:/project -w /project gcc:4.8 -u $UID:$GID sh <<EOF
make && make test
EOF
that will compile and test your application in using 4.8 gcc. Consider how easy it is to change gcc version - just change the number. You could test your library in gcc, in different versions, and using other compilers and on different distributions to make sure it works for others. If you're a developer of the library, write an automatized CI pipeline that would automatically test your application each commit in specific docker environment, using ex. https://docs.gitlab.com/ee/ci/README.html or https://travis-ci.org/ .

Related

How can I update zlib to a custom version in Debian

I've a special/very slim version of debian. I want to install a custom version av zlib and I only want one zlib version on my system. Let's say I update zlib, then I also need to recompile and update (for example) openssh since it has zlib as one of its dependencies. Do I need to list those dependencies manually or is there a tool that will recompile all packages with reverse dependencies (something like bitbake does for yocto). How does upstream debian developer handle those cases?
If you install it as a .deb file via dpkg, I'd expect you'll be fine since those other packages are linked to the zlib package ... unless there are items you're removing that other packages will fail upon not getting. If that's the case, you probably want Alpine Linux or some other minimalist distro.
I'm a bit rusty, but I believe the process is something like this:
$ apt source zlib
$ cd zlib*/debian
[ make your changes in new diffs in the `patches` subdirectory]
$ dpkg-buildpackage -rfakeroot
This creates a .deb file and IIRC also installs it. If it doesn't also install it, then you can do that with a command like dpkg -i zlib*.deb
See also Debian's Building the Package documentation.
If all you need is a newer version of a particular package, you can add it from Debian Testing or Unstable in three steps:
1. Edit /etc/apt/sources.list or something in /etc/apt/sources.list.d/ to include
deb http://deb.debian.org/debian/ testing main non-free contrib
2. Edit /etc/apt/preferences or something in /etc/apt/preferences.d/ to include
Explanation: Don't use testing by default
Package: *
Pin: release a=testing
Pin-Priority: 1
3a. Install it manually:
$ sudo apt install -t testing zlib1g
3b. Alternatively, ensure it always installs from testing with another preferences stanza:
Explanation: Use zlib from testing
Package: zlib1g
Pin: release a=testing
Pin-Priority: 500

Linux Installation libX11-devel

I am trying to build QT4 (porting from Redhat 5 to 7 with an upgraded gcc compiler) in RedHat 7 and I was getting an error saying X11/Xlib.h can't be found. Anyways, after doing some research most people said to install libX11-devel to get those x11 libraries. Since I am using an offline machine I can't do "apt-get" type commands and have to manually install RPMs. So, I went to my RH-7 installation DVD and got "libX11-devel-1.6.3-3.el7.x86-64" (I have 64 bit OS) and tried to install using "yum install libX11-devel-1.6.3-3.el7.x86_64" and I am getting dependencies errors. It's saying
...Requires: pkgconfig(kbproto)
...Required: pkgconfig(xcb)
...Requires: pkgconfig(xproto)
...Requires: pkgconfig(xcb) >= 1.1.92
So, here are my questions.
1) when it says "pkgconfig(kbproto)", is it saying find the "kbproto....RPM" and do a "yum install". In my dvd I only have "xorg-x11-proto-devel-7.7.13.el7.noarch.rpm". Do I have to somehow find "xorg-x11-proto......x86_64.rpm" since it's a 64 bit machine?
2) Is there a difference between "yum install" and pkgconfig "install"? Are there any other installation variants in Linux?
3)For an offline machine, Is there anyway I can get all the dependencies and install everything at once ?
4) Why is it saying "xcb" requires twice. If I just get a xcb...rpm version above 1.1.92 can I just install it once?
Before actually answering the questions, I am going to suggest to see if you can get the latest version of the packages. The packages on the installation DVD may be really out of date and contain known vulernabilities, and other bugs. Can you use yumdownloader - in an online environment - to download the latest version onto a separate DVD and use that as the installation source? See https://access.redhat.com/solutions/10154 for more information.
To answer the questions themselves:
Requires: foo can refer to a package foo or a "feature" foo. pkgconfig(kbproto) is a "feature" (or virtual requires). You can use yum/rpm to see what provides this. On my Fedora box, for example, rpm -q --provides xorg-x11-proto-devel shows that this package indeed provides pkgconfig(kbproto).
As for x86_64 vs noarch, it doesn't matter. noarch packages work everywhere. Other packages are restricted to the platform. So x86_64 only works on intel/amd x86 64-bit machines. Installing noarch should be fine in your case. If you only had a i686 package, though, that wouldn't be sufficient. You would have to find a x86_64 or noarch package.
Yes, there's a big difference between yum and pkg-config. They do completely different things. One is a system tool for installing RPM packages. The other is a tool for developers for using the right headers and compiler flags. If your concern is finding/installing RPMs, do not use pkg-config directly.
Do you have access to an online machine that can access the RHEL 7 yum repositories? On that machine, do something like this:
mkdir rhel7-packages
cd rhel7-packages
yum provides '*/X11/Xlib.h' # make a note of the package that provides this file. it's libX11-devel on Fedora here
yumdownloader --resolve libX11-devel # download libX11-devel and all dependencies not installed on the system
Then copy/install the RPMs on the machine without internet access.
It's probably printing out xcb twice because it's two different requirements. The unversioned requirement will be satisfied if you install any verison of xcb. The versioned requirement will only be satisfied if you install 1.1.92. If you install 1.1.92, it will satisified both the requirements.
1.
You have to resolve the dependency on the system where you are building your package. This means you need to have those dependencies installed, inclusing libX11-devel. To do that, download the RPMs manually from EL7 repos to local disk and run this:
$ mkdir -p /tmp/libX11_dep_rpms && cd /tmp/libX11_dep_rpms
# Download all dependencies from here. All your packages should be available here:
# http://mirror.centos.org/centos-7/7/os/x86_64/Packages/
# Then install
$ yum localinstall *.rpm
# After this you should be able to build your qt4 package, provided all dependencies are resolved. Otherwise, repeat the procedure for all dependencies
# If you can't download packages, then you need to create a FULL DVD ISO that will contain all packages.
2.
pkgconfig ensures that a requirement is coming from a particular build that provides a particular version of the library. Here are some detail.
3.
Get the Everything ISO from EL7.
4.
This has to do with the pkgconfig and library versions.

Compiling Cairo-dock errors on GTK dependency

I've Redhat 7.2 running Cinnamon, and hate the docks provided, how come I can't resize the area a widgit is allocated? All apps are jammed into half the dock.
Drives me to compile cairo-dock from source as it isn't an ibm redhat blessed package.
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
...
-- checking for module 'wayland-client>=1.0.0'
-- package 'wayland-client>=1.0.0' not found
-- checking for module 'gtk+-3.0>=3.4.0'
-- package 'gtk+-3.0>=3.4.0' not found
so I find gtk version is 3.14.13-16.el7 using yum list installed "gtk*"
I downloaded gtk 3.4.4 and compiled it and follow the INSTALL provided, sudo make install, which completes with no errors
rerunning cmake gives me the same error, so I'm wondering if I had to remove 3.14? I'm not really sure how best to proceed and thought it best to get some advice. I'm not really in the mood to break things. Thanks for your time and consideration.
Calvin, I'm also IBMer and installed RHEL7.2 from IBM's image.
I could successfully download the sources and install Cairo Docker and respective plugins.
I followed the instructions in this page here:
Glx-Dock - Generic:Compilation
First, install all dependencies below from official IBM repository.
I used the same package names for the Fedora dependencies and some may NOT exist for RHEL. Therefore, some plugins won't be available by fetching dependencies from official repository only - but the Cairo Docker will work.
sudo yum install cmake make pkgconfig gcc gcc-c++ gettext glib2-devel\
cairo-devel librsvg2-devel dbus-glib-devel libxml2-devel libXrender-devel\
mesa-libGL-devel mesa-libGLU-devel pango-devel libXxf86vm-devel\
libXtst-devel libXrandr-devel libX11-devel libcurl-devel gtk3-devel\
vte3-devel lm_sensors-devel libxklavier-devel libexif-devel\
libetpan-devel gnome-menus-devel alsa-lib-devel libical-devel\
upower-devel libzeitgeist-devel
Untar the packages and build with the commands described there except that you need to force the lib64 in both main and plugin builds with:
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DFORCE_LIB64=yes

Fedora - Reinstalling GMP with C++ support

I'm trying to install a library that uses gmp and am running the ./configure on it.
So far, I've gotten past several snags, such as requiring gcc, g++, and m4 by using:
yum install gcc
yum install gcc-g++
yum install m4
Now I'm getting this error:
checking for the GMP library version 4.1.3 or above... no
configure: error: Cannot find GMP version 4.1.3 or higher.
GMP is the GNU Multi-Precision library:
see http://www.swox.com/gmp/ for more information.
When compiling the GMP library, do not forget to enable the C++ interface:
add --enable-cxx to the configuration options.
As such, I tried both installing and updating gmp using yum:
yum install gmp
yum update gmp
Install tells me it's already installed and is v. 5.1.2
Updating says there's nothing to update.
I went to the gmp site and it is currently v. 6.0.0
I downloaded it and ran configure (using --enable-cxx), make, and make install.
Yet, nothing has changed. It still says I have v. 5.1.2 and the configure for the library still says it can't find 4.1.3 and above / try enabling c++.
The gmp files (such as gmp.h) are being placed in /usr/local/lib and /include
I've been at this for hours without any progress. I'm rather new to linux so I imagine there's something I just don't know about.
Am I not installing 6.0.0 correctly to overwrite the already installed one?
Or is there a way to reinstall the original with the c++ option?
Any help would be appreciated. Thanks.
dnf install gmp-devel resolved this for me on rhel
When you manually install something, as you have, it doesn't get installed in the normal /usr/lib directory and therefore it doesn't overwrite it. This is a good thing. In general, you shouldn't mess with files installed by the package manager. (Except in the case that they are config files that are meant to be edited.)
When you install manually, it is installed to /usr/local/lib. Fortunately, GCC and other compilers don't care which directory something is installed in, they will find it (when it's in standard places like /usr/* or /usr/local/*).
Just include the C++ header and add the correct -l library flag.
I figured it out.
Under the --help section of the ./configure for the library I was trying to install, there was actually a feature just for this:
--with-gmp-include=DIR
--with-gmp-lib=DIR
Using these, I was able to get it to install.
Thanks for the help.
I think I was too focused on trying to update the system install of gmp.

Installing Qt on linux, cannot find -lGL

I'm having a hard time trying to install Qt on linux. I downloaded the .run file on the website and installed Qt. However, when I try to compile the default Hello World project using Qtcreator, I get the following :
error cannot find -lGL
I was able to solve the problem by issuing the command :
sudo apt-get install libqt4-dev
But, I'm not satisfied with the solution as I want to use Qt5 and the name of the lib I downloaded implies version 4. Can someone explain what is going on and tell me if my solution is correct? If not, what should I do to get a working Qt on Linux.
Additional question
The correct answer, as provided by LtWorf, was to install libgl-dev. For future problems of this sort, can someone tell me how I should have guessed that I had to download this particular library? And why are there some libs with -dev at the end? What do they provide?
Well it is trying to link with libgl and doesn't find it. You should install libgl-dev.
-l is a linker option, it tells the linker to use a certain library.
For example you can have -lmagic meaning that you want to use libmagic.
Normally all libraries are called libsomething, and on debian you will find 3 packages called:
libsomething
libsomething-dbg
libsomething-dev
The 1st one is the library, the second one is the library compiled with the debug symbols, so you can make sense of stacktraces more easily, and the final one is the development package, it contains the .h files so you can link to the library.
sudo apt-get install libgl-dev
On Fedora 17, I did:
sudo yum install mesa-libGL-devel
Do you have libgl-dev installed? If not install it and it should work.
Those other posters are correct, but on some systems, the lib to install is named differently. I just dealt with a 32bit Ubuntu 14.04.5 LTS system, and libgl-dev was not available.
Instead, I needed to install the libgl1-mesa-dev package via:
sudo apt-get install libgl1-mesa-dev

Resources