# Building a port with a conflicting package installed



## alphaniner (Jun 25, 2015)

I'm using FreeBSD 10 to build a customized NAS4Free 10. I don't have the hardware for a dedicated build machine or even a VM. One of the ports I need to build is samba, which is installed on the build machine via pkg. This causes a conflict, and I can't fathom how this could be an issue when simply building a port. Is there a way to disable the check?


----------



## sossego (Jun 26, 2015)

1. What hardware do you have?
2. The porters handbook:: https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/
3. Mailing list.
4. Sometimes packages/ports are updated.

Build the system entirely from source so that you have complete control over all of the flags.


----------



## alphaniner (Jun 26, 2015)

Thanks for your input, but what I want to do should be either dead simple or simply impossible. Maybe I didn't properly get the point across. I have samba36 or such (can't site exact versions ATM) installed via pkg. I need to build samba4 or such from ports. I see no reason why it should be impossible to build the latter with the former installed. Well, ok, I do see one reason. If it's not, as seemingly indicated, strictly a conflict with samba but instead a conflict between the install deps of the former and the build deps of the latter, that I could understand. But the wording of the error suggested to me it's simply a matter of "if samba is installed then refuse to build samba". Also, the fact that the same situation occurred trying to build PHP5 which IIRC only differed from the installed pkg by the patch version seems to rule out a dep conflict.

Maybe it really is impossible, but if so it would be nice to have some idea of why it's impossible, however vague.


----------



## wblock@ (Jun 26, 2015)

Use a jail to build the ports you want.  Or Poudriere, which does that for you.  Because the new ports are isolated from the main system, the conflicts will not be a problem.


----------



## alphaniner (Jun 26, 2015)

Shortly after encountering the issue I looked into jails and eventually found my way to Poudriere, which I will get around to installing shortly. But if only for the sake of curiosity, I'm still interested to know the rationale behind the refusal to build if anyone has any ideas.


----------



## kpa (Jun 26, 2015)

What is the exact error? You don't really need a dedicated build machine to make use


alphaniner said:


> Shortly after encountering the issue I looked into jails and eventually found my way to Poudriere, which I will get around to installing shortly. But if only for the sake of curiosity, I'm still interested to know the rationale behind the refusal to build if anyone has any ideas.



It's quite simple really. Many of the ports are different versions/variants of another port that offer similar functionality but are split into different ports for good reasons. Usually it's not possible to have multiple versions of the same software installed at the same time because they install same files or are known to cause problems building other versions of the software. These problems usually come from the upstream or the original author of the software who didn't do a good enough job in designing the software so that it could co-exist with other versions of the same software. FreeBSD ports has to mark these problematic ports somehow so that they don't blow into your face in many unexpected and hard to diagnose ways when you try to build them with conflicting ports installed.


----------



## alphaniner (Jun 26, 2015)

kpa said:


> What is the exact error?




```
>>> Building Port: samba41
--------------------------------------------------------------

===>  samba41-4.1.19 conflicts with installed package(s):
  samba36-3.6.25

  They install files into the same place.
```

So it actually does explicitly state it's refusing to build because of conflicts that won't occur until it's installed...



kpa said:


> Usually it's not possible to have multiple versions of the same software installed at the same time...



Absolutely. But I have no intention of installing these ports on the build machine, and I fail to see the justification for refusing to _build_ a port if a conflict will only arise when it's _installed_.


----------



## ANOKNUSA (Jun 26, 2015)

alphaniner said:


> But I have no intention of installing these ports on the build machine, and I fail to see the justification for refusing to _build_ a port if a conflict will only arise when it's _installed_.



The two ports have conflicting build- and run-time dependencies. net/samba36 depends on installed versions of ports to run, that conflict with ports that need to be installed for net/samba41 to build.

Personally, I second wblock@ on the ports-mgmt/poudriere recommendation. It eliminates a lot of hassle, and doesn't require a dedicated server. If your box has a good multi-core CPU it's probably faster, too, or at least more resource-efficient.


----------



## kpa (Jun 26, 2015)

alphaniner said:


> ```
> >>> Building Port: samba41
> --------------------------------------------------------------
> 
> ...



You can't build anything in FreeBSD ports unless the build-dependencies of a port are installed for real in /usr/local, there is no way out of this unfortunately. This means you can't build anything that would either conflict directly or have conflicting build-dependencies with the already installed ports. Using a jail for building, for example with ports-mgmt/poudriere, allows getting around this by starting every build from a clean state with no ports installed and ports that would otherwise conflict with each other can be built in the same batch.


----------



## alphaniner (Jun 26, 2015)

ANOKNUSA said:


> The two ports have conflicting build- and run-time dependencies. net/samba36 depends on installed versions of ports to run, that conflict with ports that need to be installed for net/samba41 to build.



I guess I've been spoiled by Arch tools, because that's definitely not imparted by the error "They install files into the same place."


----------



## kpa (Jun 26, 2015)

alphaniner said:


> I guess I've been spoiled by Arch tools, because that's definitely not imparted by the error "They install files into the same place."



Correct me if I'm wrong but I've been under impression that Arch uses a chroot(8) environment for builds? That is more or less equivalent of what Poudriere does.


----------



## alphaniner (Jun 26, 2015)

Fakeroot is used by default to allow anything to be built as a regular user, and there is a package called devtools for build chroot creation. But "by default" a chroot is not used for user-compiled packages from ABS/AUR.

Anyway, my meaning was that the Arch tools would have explicitly pointed me to the dependency conflict.


----------



## SirDice (Jun 26, 2015)

I'm guessing the CONFLICT was added to the Samba port itself instead of its dependencies to prevent it from breaking half-way through with the same conflict message on one of the dependencies. Better stop the build before it starts than having it croak half-way through.


----------

