# Is it safe to build multiple ports at the same time



## tim-m89 (Mar 14, 2009)

When I am building ports I sometimes open up another terminal to build another port but if both have a dependency on the same package is there locks in place so the other instance can wait and recognize that a dependency is currently being built?


----------



## trev (Mar 14, 2009)

No.


----------



## randux (Mar 15, 2009)

Yes, it is safe but sometimes you waste a little time. At least it's empirically safe (been doing this for years with no problems except lockouts). Of course you if you run make clean or clean-depends you can shoot yourself in the foot if some other package is building. So don't do that.

Trev why do you say it isn't safe?


----------



## trev (Mar 16, 2009)

> Trev why do you say it isn't safe?



I generally use portupgrade - you can't run two of them at the same time if there are shared dependencies due to, for example, random make cleans occurring. "No" was maybe too succinct.

I would have thought that even running two make installs would be problematical, but perhaps only when doing a make deinstall where the port's already installed and is a dependency of the other port.

It's been a long time since I pushed these particular boundaries as it was always easier to setup a script to serially install new ports and use portupgrade to upgrade existing ports, than to deal with strange error messages caused by self-induced conflicts that didn't really exist.


----------



## phoenix (Mar 16, 2009)

You can build multiple ports in parallel *if and only if* they don't share any dependencies.  If they share dependencies, you have to build and install those *before* building the other ports.

Otherwise, you can end up with multiple concurrent make processes trying to build the same port and stepping on each other's files.

The safest method is to build 1 port at a time.


----------

