# Problems building cmake



## chrbr (Dec 2, 2017)

As reported in PR 224030 devel/cmake fails to build because some incarnation of /usr/local/bin/sphinx-build is expected. The file is available, but the name differs from the expectation. Changing the default python version or so does not help. The most simple temporary work around is to disable the man pages in the port options. Then devel/cmake builds with success. Happy building !


----------



## gessel (Jan 6, 2018)

I ran into a similar problem with a recent update to devel/cmake running my usual `portmaster -Rad`.  textproc/py-sphinx would error with a


```
py27-sphinx-1.4.8_2,1 is already installed
      You may wish to ``make deinstall'' and install this port again
      by ``make reinstall'' to upgrade it properly.
```
error. 

Doing a `cd /usr/ports/textproc/py-sphinx` and `make deinstall` then `portmaster -Rad` works fine, but just leaves the problem for the next update.  However, your suggestion, `cd /usr/ports/devel/cmake` followed by `make config` and deselecting the man page then `cd /usr/ports/textproc/py-sphinx`, `make deinstall`, `portmaster -Rad` works reliably.


----------



## gessel (Jan 6, 2018)

Same problem with devel/scons, but there's no maintainer.  :/


----------



## talsamon (Jan 6, 2018)

Same problem:

```
===>>> cmake-3.10.1_1 >> textproc/py-sphinx (1/1)

===>  Installing for py27-sphinx-1.4.8_2,1
===>   Registering installation for py27-sphinx-1.4.8_2,1 as automatic
*** Error code 70

Stop.

-----------------------

make: stopped in /usr/ports/textproc/py-sphinx

make: stopped in /usr/ports/devel/scons

===>>> Installation of scons-3.0.1 (devel/scons) failed
===>>> Aborting update


===>>> You can restart from the point of failure with this command line:
       portmaster <flags> devel/scons
```

Seems a bug.


----------



## talsamon (Jan 6, 2018)

But in the moment somethings wrong with ports-mgmt/portmaster (I have already mailed the maintainer):
Version should be 3.18_8. Makefile shows 3.18_7 and `portmaster --version` shows 3.18_6 (seems the last update has the wrong source on the server).


----------



## talsamon (Jan 6, 2018)

In the meantime fixed https://svnweb.freebsd.org/ports?view=revision&revision=458299.
Has nothing with your errors to do, was only wrong version number (was not a source problem, what I guessed).


----------



## talsamon (Jan 6, 2018)

Like posted in the PR: change in the devel/cmake Makefile solves it

```
MANPAGES_BUILD_DEPENDS= sphinx-build:textproc/py-sphinx@${PY_FLAVOR}
MANPAGES_USES =         python:build
```


----------



## gessel (Jan 7, 2018)

Thanks.  

My devel/cmake Makefile (synced yesterday) still shows 

```
MANPAGES_BUILD_DEPENDS= sphinx-build:textproc/py-sphinx
MANPAGES_CONFIGURE_ON=  --sphinx-man
```

The following is related to your solution, but perhaps should be a different thread:
The `(PY_FLAVOR)` reference above suggests that specifying a python flavor would be appropriate.  I haven't found any advice sufficiently clear for me to understand if this is possible yet with `portmaster`.  Somewhat naively, I'd assume that there is a mechanism for specifying flavors in /etc/make.conf, but clear guidance is short and the latest /usr/ports/UPGRADING entries have been a bit light on advice for "`portmaster` users."   I know it is out of favor, but it works well for me and I'm hoping to avoid major workflow changes before jumping to FreeBSD 11.x (I will before 10.3 is EOL!)

The following may be a completely different issue (though the build errors were the same, hence including it in this thread).  If it is, I'll move it to a new thread.  But for now:

The quick fix for devel/scons is to `cd /usr/ports/devel/scons` and `make deinstall` before starting with a ports rebuild.  

Is there a way to force this step in make.conf?  For example, something like (and this does not work):


```
.if ${.CURDIR:M*devel/scons*}
      make deinstall
.endif
```


----------



## talsamon (Jan 7, 2018)

I don't think it is a good idea to set flavors in /etc/make.conf. The Makefiles should fixed.


----------



## gessel (Jan 7, 2018)

Agree, I'll use the brute force way around for now: `cd /usr/ports/devel/scons && make deinstall && portmaster -Rafd`


----------



## talsamon (Jan 8, 2018)

Overlooked your question. Devel/scons should work if devel/cmake has the two lines in the Makefile.
But if you need something like this:

```
.if ${.CURDIR:M*/ports/devel/scons*}
pre-everything:
        ${PKG_BIN} delete -y scons
.endif
```

use a tab before ${PKG_BIN} no spaces.


----------



## talsamon (Jan 8, 2018)

The best idea to solve the devel/py-sphinx problem is to run`pkg autoremove`. Devel/py-sphinx is always a build-dependency and is set automatic.


----------



## gessel (Jan 8, 2018)

Another port with similar problems: textproc/xml2rfc.

It is maintained and I dropped the maintainer a note.


----------



## gessel (Jan 8, 2018)

I think the conditional removal needs another test to verify the pkg is available.  It barfs - would something like ${MAKE_BIN} deinstall  work?   Seems like robust error handling may be a bit much for a work around like this.


----------



## talsamon (Jan 8, 2018)

There is another way:
`portmaster --delete-build-only`.
In the case of devel/cmake, `portmaster` will remove devel/py-sphinx after finished build of devel/cmake.

If you tried textproc/xml2rfc as build dependency of databases/memcached it will also work.


----------



## talsamon (Jan 8, 2018)

textproc/xml2rfc is fixed in the meantime.


----------



## talsamon (Jan 9, 2018)

With the the new version of ports-mgmt/portmaster from today, these problems seems fixed.


----------

