Can I have two versions of GCC on Debian/Linux? - linux

In Debian Jessie/8 there is GCC 4.9.2.
I need the latest version, GCC 6.x.
Is it possible to install it through Synaptic from the testing repository (i.e. the binary, not the source), in parallel with the old version?
Is there a risk of conflicts among libraries/headers/... Are they going to be stored in separate directories like gcc-4.9/ gcc-6.0/ ...?
So far, I have only been able to install a second compiler building it from source, in its own directory.

Yes sure.
If two packages conflict (e.g. because they contain the same file), then he package manager (apt, aptitude, synaptics, ...) will refuse to install both at the same time.
So you can install any packages in parallel, as long as the package manager allows you to.
E.g. on my system, I have installed both gcc-5 and gcc-6.
Technically, the Conflict is expressed explicitely by the maintainer of a package.
Obviously they cannot track all possible packages in the world, but instead really concentrate on the target release (e.g. packages from jessie properly conflict with other packages from jessie, but not necessarily with packages from woody (aka Debian GNU/Linux 3.0)).
Since upgrading between consecutive releases (e.g. jessie -> stretch) is considered crucial, you can also rely on proper Conflicts when installing testing (aka next-to-be-stable) packages on stable systems.
OTOH, there might of course be bugs in the packaging, where the Conflicts are not properly expressed (if you find one, don't hesitate to report it).
If this happens to happen, the installation will fail, and you can revert the change.
So it's pretty safe to try to install whatever packages are available in Debian.
(However, I wouldn't put that much trust into 3rd party repositories)

Related

Basic set of libraries in chroot (fedora linux)

I'm running an old version of my linux distro (fedora, but this is not very relevant) and for reasons which are completely irrelevant I'm not in a position to update it. However I do need a newer version of gcc and some other libraries than those supplied by my old distro.
I could compile a newer gcc and all the other libraries of course but I thought the simplest way would be to install a minimal set of packages from the latest distro version to a directory and then just chroot there. This way I'd take advantage of the binary packages present in the newest distro and all the infrastructure around it (like dependency installation, etc.) and I wouldn't need to compile everything from source.
My question is this: if I only would like to be able to compile with the most recent gcc and run those programs, what is the minimal set of packages I need? Since we are talking about fedora, what is the minimal set of rpms (beyond glibc and gcc)? Note that I don't need any X environment, networking, or anything like that, only the most basic terminal tools.
The minimal set varies depending on your user needs and what you're linking with. What I do when making a chroot environment is have a look at the distro I want to chroot and see if they have a base rpm/deb package that kickstarts everything. Then I install that in the chroot. From there I add libraries and applications as needed.
For an example where I create a chroot for RHEL on Arch see http://www.zenskg.net/wordpress/?p=267

Fink and Homebrew - can they live together on mac osx?

I was trying to get octave to work, and figured it needed gnuplot which needed gnuplot-nox which needed to be installed via Fink. I have usually stuck to using homebrew for my package installs.
Are there any problems with having homebrew as your primary package manager while using Fink for installing certain specific packages? Do they ever conflict? Does it make the system unstable?
Homebrew and Fink can coexist, but you need to be careful about not making a mess. In particular, since Homebrew usually builds from source, it could be a problem if you accidentally link Homebrew formulas^Wformulae against Fink-installed software, because the next upgrade might break the dependency. (That problem is probably much less likely now with Homebrew's superenv.) Basically, you need to do the job of the package manager yourself.
That said, Homebrew has an octave formula in the homebrew/science tap, so maybe you could just use that.

Port a debian package to YUM for CentOS

I have a project that runs on Debian and uses many packages provided from the Debian repositories.
Because of demand, I've looked into porting the project to CentOS, but found that many of the packages I require are completely missing - at least 10 dependencies would have to be compiled manually at install time on the users machine.
My question is, what is the best way to create an installer for the user's machine? Should I use automake tools (with the standard ./configure, make, make install), to compile the required libraries, or is this a non-standard approach. Note that my app doesn't actually need to be compiled since it is written in Python, so is it weird to do a "make", when you're not compiling your own app?
Should the configure script just warn the user that package X is missing, and let them handle the rest?
Should I roll my own dependency checker by runng pkg-config manually a few times for each library required, and exit if something is missing?
I'm quite new to this, so any tips to get me moving in the right direction are appreciated.
Edit: I am familiar with RPM and yum for red hat base distros, but CentOS is missing many multimedia packages that I require. An example of one of my package dependencies is "liquidsoap" which is a programmable audio engine: http://savonet.sourceforge.net/
This is available on Debian, but not Redhat/Centos
See this link on CentOS package management.
http://wiki.centos.org/PackageManagement/Yum
CentOS is redhat based and does not use .deb packages by default. However apt package management has been ported to tons of platforms, you may be able to use a port for centOS
If you use YUM whatever packages you need will be there for your application as redhat distros need all the same things that any other distro does.
EDIT: To get the details out of comments
Packages not available on the target platform either have to be built (possibly as a port) on the target platform and then shipped in the ported package (in this case YUM), or code needs to be modified and forked to use packages which already are available on the target platform. The choice depends on which is worse, or which is even possible given your constraints.

How to compile software into a re-installable form?

I am working through my 7th recompile of the same software. There are no pre-built packages available, and it's a long compile time. Is there a way to take what I compile and package it up so that I don't have to continually build it right from source?
EDIT: CentOS 6 for the OS if that matters.
You should have a look at CDE. From its website :
CDE (formerly known as CDEpack) automatically packages up the Code, Data, and Environment required to deploy and run your Linux programs on other machines without any installation or configuration. CDE is the easiest way to completely eliminate dependency hell.
So it will compile your program and include all the dependencies in the resulting package as well. The resulting package should be able to run on any modern x86 Linux distribution, so you won't have to continually build it right from source.
checkinstall, which is based on installwatch, is able to create various packages including .deb (Debian, Ubuntu, ...), .rpm (Red Hat, Fedora, SuSE, ...) and .tgz (Slackware) suitable for your distribution's package manager.

Running a C program compiled here causes a GLIBC library not found error on another server - is it my fault or theirs?

A C program compiled here runs fine on our Ubuntu servers. But when a somebody else tries to run it on their particular Linux server they get the following errors:
./myprog-install: /lib/tls/libc.so.6: version `GLIBC_2.4' not found (required by ./myprog-install)
./myprog-install: /lib/tls/libc.so.6: version `GLIBC_2.7' not found (required by ./myprog-install)
Do I need to upgrade our glibc libraries and recompile? Or are they missing something on their server?
If I run apt-cache show libc6 my Ubuntu tells me the version is:
Package: libc6
Priority: required
Section: libs
Installed-Size: 9368
Maintainer: Ubuntu Core developers <ubuntu-devel-discuss#lists.ubuntu.com>
Original-Maintainer: GNU Libc Maintainers <debian-glibc#lists.debian.org>
Architecture: i386
Source: eglibc
Version: 2.11.1-0ubuntu7.10
If I look at http://packages.ubuntu.com/hardy/libc6 the current version appears to be 2.7-10ubuntu8.1.
I'm confused by the numbers. On the one hand 2.11-1-0 is a higher number than 2.7-11. On the other hand 7.10 is a lower number than 8.1.
Is it just a matter of me upgrading the C library package and recompiling do you think? Or is the other person's server missing some needed library there for compatibility?
You have built on glibc-2.11 system. You are trying to run on a system with glibc-2.3 or older. That's not going to work.
Is it just a matter of me upgrading the C library package
No: upgrading your glibc will only make things worse.
You may want to try solutions listed here.
Is this something we can reasonably request the other party to upgrade their system to support, rather than downgrade our compiler?
Usually the client will strongly resist requests to upgrade their system: it's working fine for them as is, and any upgrade can break other existing applications.
If you are planning to distribute binaries on Linux (as opposed to building them on the target system), then you need to learn how to make binaries that will run everywhere, or you need to state your requirements (minimum kernel and libc versions, etc.) and turn clients who can't meet these requirements away.
Update:
Why did they get two errors. Why didn't they just get one for GLIBC_2.11.1 which is apparently what I built with?
Symbol versioning doesn't work that way.
When a new symbol is introduced, it is marked with the current libc version, e.g. readdir64##GLIBC_2.2, posix_spawn##GLIBC_2.15, etc.
When you link a program that uses both of the above symbols, and try to run it on e.g. glibc-2.1 system, you would get two errors.
But if you link a program that doesn't use any of the above symbols, e.g.
int main() { return 0; }
then your program will just run without any errors.
Update 2:
they don't have to add both GLIBC_2.4 and GLIBC2.7 to their Linux system, do they?
No, they don't. The GLIBC_2.11 will have all the previous symbols in it. In fact, they couldn't install both glibc-2.4 and 2.7 even if they wanted to: it is quite difficult to have multiple versions installed at the same time, and impossible to have multiple versions installed in default location.
You've built it against a version of glibc that is too new. Build it against an older version of glibc, preferably the one that they are using.
you need to build on a system that uses same versions of libraries as you do. This is where docker and VM's are very convenient. There is probably a pre-made docker image for whatever version the customer has.

Resources