# Port Version Conflict Question



## Fatman (Jul 16, 2011)

Quick questions for anyone out there.

I ran into a problem when trying to install git. It seems that when I use *pkg_add -r git*, a messages shows a conflict in perl versions and doesn't install. However, I was able to install it via its port without the same problem. Is pkg_add not the same as using the port tree?

Thanks in advance.


----------



## kpedersen (Jul 16, 2011)

When you install from ports, it is effectively building the software from source.

Because of this it causes it to link and match against the versions of software you already have installed.

Binary packages as you have found out require 100% matching versions of software as their dependencies because often their dependent library names are hardcoded into the binaries etc...

Because of this, mixing ports and packages can often cause problems if the ports tree is newer (or older) than the packages location you are installing from.

You can mix and match ports and packages by simply creating packages from your ports tree snapshot, and then the resulting packages are guarenteed to work perfectly with each other and other installed ports.


----------



## ikreos (Jul 16, 2011)

Check out this thread for more info as to why that could happen. http://forums.freebsd.org/showthread.php?t=22388


----------



## Fatman (Jul 16, 2011)

Thank you for responding so quickly. I have some more questions if you don't mind but please don't feel obligated to respond to them.

I understood this part: 





> When you install from ports, it is effectively building the software from source.
> 
> Because of this it causes it to link and match against the versions of software you already have installed.
> 
> Binary packages as you have found out require 100% matching versions of software as their dependencies because often their dependent library names are hardcoded into the binaries etc...



However the next section scares me a little as I have recently mixed and match. 



> Because of this, mixing ports and packages can often cause problems if the ports tree is newer (or older) than the packages location you are installing from.



For example, I'm following a recent wiki post for installing freeswitch. It describes in a section to install autoconf262 using pkg_add -r. When I attempted this, it could not obtain the url. I then went on to using the port for the install but ended up with autoconf28x. I then continued following the wiki and install gcc34 using pkg_add. Should I have installed all the dependencies from the port tree and install freeswitch via source since the port is for testing only?

You lost me a little on this one...





> You can mix and match ports and packages by simply creating packages from your ports tree snapshot, and then the resulting packages are guarenteed to work perfectly with each other and other installed ports.



I found what seems to be a good article that describes how easy it is but I still don't see how this prevents dependency issues. 

http://www.rhyous.com/2010/11/12/making-a-package-from-a-port-on-freebsd/

Thanks again for your time.

Fatman


----------



## Fatman (Jul 16, 2011)

Thanks Ikreos!

I had to re-read the thread a couple of times before I understood. So if I read it right, the packages on the ISOs are never updated and the binary versions used by pkg_add are update approximately once a month.


----------



## ikreos (Jul 16, 2011)

Fatman said:
			
		

> Thanks Ikreos!
> 
> I had to re-read the thread a couple of times before I understood. So if I read it right, the packages on the ISOs are never updated and the binary versions used by pkg_add are update approximately once a month.



From what they said on the other thread. Packages for a RELEASE (i.e. the ISOs) are never updated period. Packages for the STABLE branch are updated periodically. So if you are using a RELEASE then you will most likely want to install from ports.

As long as you have the minimum required version of a library or program needed by a port it is okay to mix ports and packages. Lets say you want to compile a port that requires some library vX.Y. That library hasn't been updated in a long time because it's stable and feature complete. It is perfectly fine to install the package for that library, then compile the port that relies on it. However it is much more difficult if not impossible to do the opposite.

In my opinion either use ports or packages, try not to mix them.


----------



## wblock@ (Jul 16, 2011)

ikreos said:
			
		

> From what they said on the other thread. Packages for a RELEASE (i.e. the ISOs) are never updated period.



Yes.  A -RELEASE ISO is cast in stone.  The idea is that the packages are known to work with that version of the OS.



> Packages for the STABLE branch are updated periodically. So if you are using a RELEASE then you will most likely want to install from ports.



You can set PACKAGESITE to fetch the latest packages, regardless of whether you run 8.2-RELEASE or 8-STABLE.  These are updated often, maybe not daily but close.

For those who want to use packages but stay updated, ports-mgmt/portmaster and ports-mgmt/portupgrade-devel can both be set to prefer packages to ports when updating.  There's also pkg_upgrade(1) from sysutils/bsdadminscripts.

I'm not recommending these package tools, just pointing them out.  IME, ports are far less hassle.  Unless maybe you have a really slow system.


----------



## ikreos (Jul 16, 2011)

wblock said:
			
		

> You can set PACKAGESITE to fetch the latest packages, regardless of whether you run 8.2-RELEASE or 8-STABLE.  These are updated often, maybe not daily but close.



I contemplated on mentioning that but I wasn't 100% sure.

(Blast! I'm so used to vi I keep wanting to enter commands when I type in a forum)


----------



## Fatman (Jul 17, 2011)

Thanks again guys.  I thought I'd add to the thread the link to the ports/packages page from the handbook.
http://www.freebsd.org/doc/handbook/ports-overview.html

I had to read this a couple of times before I understood the differences between a port and package as well as how both operate. If there are any other newbs like me reading this, I suggest you check out chapter 4.

Brief Summary From the handbook:


> However, FreeBSD provides two technologies which can save you a lot of effort: packages and ports.
> 
> For any given application, the FreeBSD package for that application is a single file which you must download. The package contains pre-compiled copies of all the commands for the application, as well as any configuration files or documentation. A downloaded package file can be manipulated with FreeBSD package management commands, such as pkg_add(1), pkg_delete(1), pkg_info(1), and so on. Installing a new application can be carried out with a single command.
> 
> ...



So after all this reading and helpful advice, i will always try sticking to ports. I quite enjoy using portaudit, portsnap and portmaster to keep my ports updated and secure. If I see a howto with pkg_add, I will instead run a make search or whereis to find the matching port.

Thanks again everyone for all the wonderful advice.

Fatman


----------

