# pkg vs. ports



## daeron (Apr 10, 2014)

Can I use pkgng to install a port such as multimedia/mlt without wrecking the rest of my system?

I want to install some video editors but they all want multimedia/mlt which fails to build under CLANG / FreeBSD 10-stable

So I thought I might risk installing multimedia/mlt with pkg but it wants to reinstall about thirty of my existing ports...

I don't know what options have or have not been set in those thirty ports it wants to replace my ports with, is there any way of getting it to install mlt without an excessive lose of control of one's system?


----------



## Chris_H (Apr 11, 2014)

daeron said:
			
		

> Can I use pkgng to install a port such as multimedia/mlt without wrecking the rest of my system?
> 
> I want to install some video editors but they all want multimedia/mlt which fails to build under CLANG / FreeBSD 10-stable


You can often get over that error adding the following to /etc/make.conf and /etc/src.conf before attempting to make the / a port.
make.conf:

```
WITHOUT_CLANG=true
FAVORITE_COMPILER=gcc
```

src.conf:

```
WITHOUT_CLANG=true
```

If you want to stick with Clang. You will want to remove, or comment those lines after you have finished building / installing the offending port(s).

--Chris


----------



## wblock@ (Apr 11, 2014)

That will break the build on FreeBSD 10, where Clang is the default compiler.


----------



## Chris_H (Apr 11, 2014)

I'm not suggesting this as a default. But rather, as a _stop-gap_, until the port in question is working with Clang.
In other words. Only for, or in ports that fail to build, or install with Clang.

--Chris


----------



## wblock@ (Apr 11, 2014)

Easier to just change the port to use GCC from ports, if that's the problem.  But don't pull the rug out from under the operating system by removing the base compiler.


----------



## Chris_H (Apr 11, 2014)

Maybe I don't understand completely. But knowing Clang is the default. Can't _exceptions_ be made on a port-by-port basis. Meaning;
This port bombed with Clang, insert lines in make.conf(5), and src.conf(5), try again. Success. OK remove, or comment lines in /etc/make.conf, and /etc/src.conf. Now I'm biulding/installing with Clang again.

Am I still off / not getting it?

--Chris

EDIT: This works famously on releng_9. But I know you're (we're) talking 10. here.
EDIT2: I guess it goes without saying, that sending a pr(1) would be prudent.


----------



## wblock@ (Apr 11, 2014)

src.conf is about the base system.  Entering WITHOUT_CLANG=yes there will prevent Clang from being built during a buildworld (although it won't delete the old version).  Don't do that, buildworld will fail.  Ask me how I know.  :\

And that will not help with the port.  /etc/make.conf can be modified to check if it is in a port directory and use a specific compiler, but I've never bothered with that.  The port Makefile can be changed with

```
USES=gcc
```

But it might require a specific version of GCC.


----------



## Chris_H (Apr 12, 2014)

OK. Fair enough. It _was_ overkill.
Maybe simply make the port via

```
make -DWITHOUT_CLANG
```
would be a bit more "on target". 

--Chris


----------



## wblock@ (Apr 12, 2014)

WITHOUT_CLANG is not a ports setting.  The variable can be set, but ports don't look for it.


----------



## kpa (Apr 12, 2014)

The supported way to make a port to use GCC instead of the default CLANG as the C/C++ compiler is to use the USES=compiler setting in the Makefile of the port. From /usr/ports/Mk/Uses/compiler.mk:


```
# Feature:      compiler
# Usage:        USES=compiler or USES=compiler:ARGS
# Valid ARGS:   env (default, implicit) c++0x c++11-lib c++11-lang c11 openmp nestedfct features
#
# c++0x:        The port needs a compiler understanding C++0X
# c++11-lang:   The port needs a compiler understanding C++11
# gcc-c++11-lib:The port needs g++ compiler with a C++11 library
# c++11-lib:    The port needs a compiler understanding C++11 and with a C++11 ready standard library
# c11:          The port needs a compiler understanding C11
# openmp:       The port needs a compiler understanding openmp
# nestedfct:    The port needs a compiler understanding nested functions
# features:     The port will determine the features supported by the default compiler
```

Edit: You also have to set USE_GCC=yes in the Makefile it seems. The USES=compiler doesn't yet have a capability of forcing the use of GCC. This bit of the porter's handbook is still probably up to date, section 5.8.8 USE_*:

http://www.freebsd.org/doc/en/books/porters-handbook/makefile-depend.html


----------



## daeron (Apr 13, 2014)

Thanks all,   and the prize goes to @kpa who was 90% correct.

I'd been modifying make.conf too, and without success.  I patiently tried each suggestion using make.conf and they all produced the same result. Trying USE_GCC also failed.

Inserting USES=gcc {or in this case adding gcc to the list} in the Makefile worked.


----------



## wblock@ (Apr 13, 2014)

Wait, I mentioned USES=gcc a couple of days ago...


----------



## Chris_H (Apr 14, 2014)

Right you are. I call foul!
Would the previous recipient of the prize, kindly relinquish that prize to it's rightful owner; @wblock@.

--Chris


----------

