# Building 2, or more, ports simultaneously?



## spanglefox (Jan 17, 2013)

A real quick one as I could not quite see a relevant topic after a search.....

Can you build more than one port at a time? Say building Xorg & LXDE in two different terminals. I can see issues if both were building same dependencies, such as Python or Perl.

Crucially, if at all feasible, is it more efficient? Particularly with multi-processors?


----------



## xtaz (Jan 17, 2013)

I think it works to a certain degree. But you have to be very careful. I usually run "make install clean". The problem with doing that twice is when the first port finishes building it will clean all the working directories of all its dependencies. This might include ones that are being built by the second port. I think as long as you don't do any cleaning then it should work.

You might get a weird situation though if you install two ports that then try and install the same dependency. The slower one will detect that it's not installed and try and compile it itself, whilst the faster one is already doing it. In theory though all that will happen is it just rebuilds the same object files and when it tries to install it at the end it gets a package already registered error and bombs out.


----------



## spanglefox (Jan 17, 2013)

Yes, that is what I thought.

Currently building lots of ports at the moment, as per the idea in the Handbook, for we have about 17 FreeBSD desktops running OLD hardware (Athlon XP 2000s c. 2003-5) and having to compile security updates on each one would be "fun". 

Currently building on a triple core 4GB Ubuntu machine and wondered what was most efficient. Build in one virtual machine or spilt up into three separate virtual machines. Particularly as there appears to be a lot of "checking if build environment is sane" which I guess is more I/O limited than CPU limited.

Anyway thanks and I think it will be a case of me learning a little more patience hehe.


----------



## Uniballer (Jan 17, 2013)

Building most ports is pretty much CPU bound.  You can try using ports-mgmt/portbuilder to build ports in parallel.  I reported some problems to the author a while ago and there have been fixes since then, but I haven't played with it lately.  This may become a great tool in the future if the development continues.


----------



## xtaz (Jan 17, 2013)

If you are rolling out port updates to 17 odd machines, I would look into having a build machine where you compile the source port into a binary package on that machine, then you can mount that machine over a network using NFS to all the other machines and install the binary package instead.

You'll get exactly the same end result, but only have to compile it once.


----------



## spanglefox (Jan 17, 2013)

The portbuilder looks very interesting. Will certainly be looking at as it is possible I will end up compiling for x86 and amd64. So double the work!
I do have access to an octocore behemoth, but only outside of office hours. Would be nice to tee up build "x", "y" and "z" overnight.

As for the build machine I do "have" one already, as I complied the source on one client machine and that experience was enough! Although instead of NFS I am using ftp as a) wanted to teach myself FTP setup and b) I also have clients in other offices which a simple internet transfer is useful.

Next nice feature would be the clients saying to my server, "Any new ports?", download and install etc. Bit like WSUS, if you have ever played with that. I think that is off in the future, however.

Thanks for the info guys!


----------



## wszczep (Jan 17, 2013)

spanglefox said:
			
		

> The portbuilder looks very interesting. [...]



You could also check
ports-mgmt/poudriere


----------

