# Using pkg and compiling from source



## rob34 (Feb 16, 2014)

Is it possible to compile and install programs from the ports tree and also use `pkg` to add/upgrade programs on the same system?  I know that compiling from the ports tree and using `pkg_add` on the same system was a bad idea.


----------



## scottro (Feb 16, 2014)

It hasn't really bitten me yet, which doesn't mean that it won't as time goes on.  Of course, I can't think of an example right now, but suppose I want to install package X with some configuration changes, meaning that I have to use ports.  However, I can first run `portmaster package_X` to see what else it may install.  I then first install those dependencies using pkg, then, once they're all installed, finish it off with the port that I want' to install with custom configurations.  

I don't know if it's considered safe to do this or not, and so far, have just been doing it on test machines (and one workstation which, if it breaks, won't bother anyone but me), and haven't been bitten yet.  
I also haven't seen (though I haven't looked carefully) any warnings, nor heard any horror stories about it.   It's early days of course, but so far, it's seemed safe to me.


----------



## SirDice (Feb 16, 2014)

It's going to get tricky if the port adds or removes dependencies when adding/removing options. You'll also run into trouble if you pick non-standard versions. Like Perl 5.18 instead of 5.16. Packages are always built using the default options and you may end up with one port depending on Perl 5.18 and another on 5.16.


----------



## rob34 (Feb 16, 2014)

Thanks scottro and SirDice.  For safety's sake, I think I'll stick with compiling my programs from source.


----------



## scottro (Feb 17, 2014)

And, of course, after I said it hadn't bitten me, it did.  Did a fresh install today, mixing in a few pkg installs and then, I went to pkg install something, I've already forgotten what, and got pkg X conflicts with pkg Y already installed. So, listen to @SirDice


----------



## Martillo1 (Feb 17, 2014)

I only do it to add specific options, like VDPAU in mplayer.


----------

