# Multiple versions of same port



## jbo (Jan 13, 2022)

I truly hope that this thread doesn't end up in a torch & pitchfork situation - I'd really just like to get a deeper understanding of FreeBSD (from both a technical and a philosophical point of view).

My question is simple: What technical limitation or design choices prevents us from having multiple versions of the same port installed? I can think of several reasons but I'd like to intentionally keep this question open without adding too much detail from my side.

A (maybe invalid?) example: cad/freecad depends on cad/opencascade. Currently, the cad/freecad is marked as broken as it doesn't currently build with the latest version of cad/opencascade. Naively I would tend to think that we could have the ability to install multiple versions of cad/opencascade so we can have a version of it with which cad/freecad would still be able to build.


----------



## SirDice (Jan 13, 2022)

jbodenmann said:


> What technical limitation or design choices prevents us from having multiple versions of the same port installed?


Paths are usually the problem. Both ports will create a /usr/local/bin/myapp for example and would then overwrite the other's executables. Same thing could happen with library paths but you can sometimes fix those by storing them in separate directories, /usr/local/lib/someapp1/mylib.so and /usr/local/lib/someapp2/mylib.so for example.


----------



## zirias@ (Jan 13, 2022)

1. Package name conflicts. Solving this isn't all that simple without breaking the typical/wanted behavior of upgrading, but should be possible somehow.

2. Package content conflicts. This one is really problematic. For any but the most trivial packages, it's really a PITA to rename all files, lib dirs, shared dirs and so on and make sure the result still works as expected, and I'm pretty sure there is software around that will _never_ work correctly when you attempt that.

So, I think keep it as it is. For a few packages, it makes sense, and for those, separate ports exist.


----------



## astyle (Jan 13, 2022)

This is why I like ports rather than packages. With ports, I can hunt down broken deps, and either turn them off, or fix them.  In OP's case: Beyond the need to build cad/freecad, is there a reason to keep *multiple* versions of cad/openscade around? My thinking goes, a slightly older version for a dependency is OK, no real need to have the latest of everything. In the kitchen, having fresh ingredients for everything is a nice idea to follow, but for a computer - very fresh stuff does come with the risk of not playing well with the rest of the system.


----------



## kpedersen (Jan 13, 2022)

Other than path conflicts and maintainer time, there isn't really any reason to not have multiple versions. You will see for things like Wine, Java and things, we do have a couple of versions. Obviously with massive things like desktop environments, Blender, LibreOffice, etc, this is difficult.

I did look through the build failure on FreeCAD. It indeed looks like OpenScade is doing something with cyclic includes. I don't think it will be too difficult to bodge this to maybe get it to work. I would give it a shot but I don't have enough time to commit to anything potentially large at the moment.

Was there ever a working version of FreeCAD/OpenScade? My recommendation would be to setup a Jail, build the last working version of the port (and absolutely every other dependency using that same ports tree) but setting LOCALBASE to i.e /opt/freecad. You will then end up with a fairly big directory (including many duplicates such as libX11, python, etc) but the important thing is that these versions will be tailored to that snapshot in time when FreeCAD was working.

Then just copy /opt/freecad out of the jail and into /opt/freecad on the host (path must be the same because for some reason relocatable libraries and executables aren't popular in the UNIX world) and try running it. It *should* work because Xorg and FreeBSD ABIs are stable.

I do this for old versions of Gimp, OpenOffice and Blender (because I feel they have regressed since) and it does work. It is quite a faff though admittedly so make sure you script as much of it as you can.


----------



## Erichans (Jan 13, 2022)

With multiple versions of the same port/software, you are basically asking for a differentiation mechanism, such as a namespace or prefix.
There is such a mechanism in FreeBSD:  _jails  _


----------



## ShelLuser (Jan 13, 2022)

Actually, there isn't any technical limitation here, in the end it all depends on the maintainer and how they set up the package.

Normal approach is to maintain the same structure for all future versions in order to make sure that other optional software which relies on your software doesn't have to get rebuild during each and every upgrade. Think about libraries which are installed in a specific place, minor version changes usually don't require a full rebuild.  This setup obviously doesn't allow multiple versions to be installed.

But that doesn't imply that there are technical limitations:


```
$ pkg info -x llvm
llvm10-10.0.1_8
llvm11-11.0.1_4
```
See what I mean?

Ergo, this is not a limitation of the PKG system at all, but more so a choice made by the maintainers.


----------



## Jose (Jan 13, 2022)

Gentoo does this with "slots":





						Slotting – Gentoo Development Guide
					

The Gentoo Devmanual is a technical manual which covers topics such as writing ebuilds and eclasses, and policies that developers should be abiding by.




					devmanual.gentoo.org
				








						Sub-slots and Slot-Operators - Gentoo Wiki
					






					wiki.gentoo.org
				




It gets complicated real quick, as you can see from those docs. I think the Freebsd way to do this is to have different versions installed in separate jails, as kpedersen and Erichans suggest.


----------



## grahamperrin@ (Jan 14, 2022)

Not a direct answer to your question, but it's possible to have Firefox and Firefox ESR on the same FreeBSD system without a jail. 

It's not as simple as installing both packages, but when I last checked: it does work. 









						conflict between : firefox-esr and with firefox
					

Hi,  I am currently using Firefox in FreeBSD-11.1, installed from package. I would like to install also package "firefox-esr" but I get the following error:  pkg: firefox-58.0.2,1 conflicts with firefox-esr-52.6.0_2,1 (installs files into the same place).  Problematic file...




					forums.freebsd.org


----------

