# Why are development dependencies pulled in when installing a package?



## 20-100-2fe (Apr 14, 2020)

The most emblematic case is LibreOffice's, that pulls in perl5, mysql-client-5.7 and even openldap-client!
But other packages install gcc, automake, etc.

1. Most people will never use LibreOffice to access a database or an LDAP directory, so these should NOT be required.

2. If you're a developer, you'll likely want to use a much more recent version of MySQL, or even MariaDB. But if you try and do so, it will uninstall LibreOffice.

3. If you're not a developer, you should not be bothered with such things as perl5 or automake - you just want to use the package, not build it.

I also don't understand why so many packages bring in other p5-... packages, even though not developed in perl themselves. These dependencies look like API to use the main package in perl programs, but they are only useful to those who intend to develop such an application, not for the 99.999% other users.

I'm very surprised that such issues still exist in 2020, so I guess there is a reason for this - technical or human.

So here are my questions:

- Is there any indispensable reason for such dependencies to be required at run-time?

- If not, would any effort to clean up that mess be welcome?

I mean, I'm willing to make that effort for packages I have an issue with, but I'd like to be sure these efforts will not be > /dev/null.


----------



## SirDice (Apr 14, 2020)

2) build from ports and set DEFAULT_VERSIONS  correctly. See /usr/ports/Mk/bsd.default-versions.mk

Can't comment on the Perl or OpenLDAP requirements (not for LibreOffice at least).


----------



## PMc (Apr 14, 2020)

20-100-2fe said:


> But other packages install gcc



I once had a look into that one, because I wanted to get rid of the bloat (postgres is concerned, as are many others).
It seems there is a runtime part of gcc (the thing that happens to call main() ), and you need that when compiling with gcc. I would still prefer to only have some small "gcc-runtime" port to install, I don't remember what is the problem with that, but it probably was already discussed on some list.


----------



## shkhln (Apr 14, 2020)

```
% pkg info -d libreoffice | grep mysql
    mysql57-client-5.7.29_1
```

This is likely for Base. Afaik, pkg doesn't have any concept of alternative dependencies (a dependency which can be satisfied by one of the multiple suitable packages), which is admittedly a problem here.

Instead we have shared library tracking bullshit borrowed from RPM; no idea if that is used in dependency resolution. I'm less, less and less satisfied with pkg, to be honest.


----------



## shkhln (Apr 14, 2020)

PMc said:


> It seems there is a runtime part of gcc



Yes, /usr/local/lib/gcc<version>/libstdc++.so & friends.


----------



## shkhln (Apr 14, 2020)

shkhln said:


> pkg doesn't have any concept of alternative dependencies



Oh, looks like that was supposed to be handled by _dep_formula_ stuff, 5 years in development and counting…


----------



## unitrunker (Apr 14, 2020)

Side note: why do OpenOffice and LibreOffice pull in samba? I get frequent vulnerabilities in 'pkg audit' from this.


----------



## jmos (Apr 14, 2020)

SirDice said:


> 2) build from ports and set DEFAULT_VERSIONS  correctly. See /usr/ports/Mk/bsd.default-versions.mk



I cannot see any setting regarding the use of MySQL or MariaDB in that file. Here‘s my way to get MariaDB & LibreOffice: Compile and install databases/akonadi first, and choose SQLite here. Then a self compiled LibreOffice doesn‘t need MySQL anymore:


```
jo@freya ~>  pkg info -d libreoffice | grep mysql
jo@freya ~>  pkg info -d libreoffice | grep mariadb
        mariadb104-client-10.4.12
```

The problem with the database dependency is know by the package maintainer. Solutions an helping hands are welcome


----------



## SirDice (Apr 14, 2020)

jmos said:


> I cannot see any setting regarding the use of MySQL or MariaDB in that file.


Line  68-69: https://svnweb.freebsd.org/ports/head/Mk/bsd.default-versions.mk?revision=531508&view=markup

For MariaDB 10.2 for example:

```
DEFAULT_VERSIONS= mysql=10.2m
```
For  MySQL 8.0:

```
DEFAULT_VERSIONS=  mysql=8.0
```

The _m_ versions are MariaDB, the _p_ versions are Percona, not sure what the _w_ is. The numbers (without m, p or w) are MySQL.


----------



## 20-100-2fe (Apr 14, 2020)

When I was saying 'developer', I didn't mean 'FreeBSD developer'...

I do Java development as part of my job and I also test training material before giving my trainings, so I frequently have to install MySQL/MariaDB or PostgreSQL, depending on the application or training.

In short, if I install a recent version of MySQL or MariaDB, I no longer can work on my handouts... :/
It's sad to have to build a monster like LibreOffice from ports just because of wrong run-time dependencies.


----------



## SirDice (Apr 14, 2020)

20-100-2fe said:


> so I frequently have to install MySQL/MariaDB or PostgreSQL, depending on the application or training.


Use a jail for this. You can easily manage a few of them. One for  MySQL, one for MariaDB, etc. Start the jail you need at that time.


----------



## Alain De Vos (Apr 14, 2020)

I just did "pkg remove samba" &  "pkg remove python27". 
It's weird how many packages depend on it.


----------



## 20-100-2fe (Apr 15, 2020)

SirDice said:


> Use a jail for this.



I think I have the answer to my questions. 
Thanks!


----------



## SirDice (Apr 15, 2020)

Simplest and cleanest solution in your case I believe. You can get fancy too with ZFS. Snapshot a clean jail with a configured MySQL for example. You can start it when you do your training. Then when you're finished stop the jail and revert the snapshot. And you're all neat and clean for the next training.


----------

