# Upgrading emacs fails for tputs



## multix (Feb 26, 2013)

Hi,

while updating emacs, portupgrade tells me:

```
+ editors/emacs (emacs-24.2,2 -> emacs-24.2_1,3)
```

I get:

```
checking for library containing tputs... no
configure: error: The required function `tputs' was not found in any library.
These libraries were tried: libncurses, libterminfo, libtermcap, libcurses.
Please try installing whichever of these libraries is most appropriate
for your system, together with its header files.
For example, a libncurses-dev(el) or similar package.
===>  Script "configure" failed unexpectedly.
```
I have none of the 4 libraries installed as ports. Should I? Shouldn't they be pulled in in case?


----------



## cpm@ (Feb 26, 2013)

For editors/emacs builds fine, deinstall and reinstall devel/ncurses. See bug related http://lists.freebsd.org/pipermail/freebsd-questions/2011-October/234675.html.


----------



## multix (Feb 28, 2013)

I did not have ncurses. I installed ncurses from ports, upgrade emacs and get the error.



> ncurses-5.9_1       Library for terminal-independent, full-screen output



I then removed ncurses and I get the erroor again.

So with neither combination I can upgrade emacs!


----------



## cpm@ (Feb 28, 2013)

The way it's supposed to work is that emacs will depend on ncurses if it's installed when the emacs port is built, and to the base system if not. Check you have installed ncurses library which should provide tputs(3) routine. 
`# locate libncurses`

Note that before using locate(1) need run as root the following script /usr/libexec/locate.updatedb to generate /var/db/locate.database.


----------



## multix (Feb 28, 2013)

Hi,

yes, it should depend on one or the other. THough I gather from the thread you linked, that the system one is not enough or not working for emacs.


```
ls /usr/lib/libncurses*
/usr/lib/libncurses.a   /usr/lib/libncursesw.a
/usr/lib/libncurses.so  /usr/lib/libncursesw.so
```

These are from my base system.

Apparently the solution is to install ncurses-devel, not ncurses from ports.

Riccardo


----------



## multix (Feb 28, 2013)

No, it doesn't work. I'll analyze the logs next time.


----------



## cpm@ (Feb 28, 2013)

The key there is the LDFLAGS so that the configure script can find the ncurses library in your local build environment. In Makefile you can see the value of PREFIX will be set to LOCALBASE (defaulting to /usr/local).

```
CPPFLAGS+=      -I${LOCALBASE}/include
LDFLAGS+=       -L${LOCALBASE}/lib
```

But your base system ncurses library are located in /usr/lib and /usr/include. As above message recommends as workaround to move /usr/local/lib/libncurses.* and /usr/local/include/ncurses.h aside temporarily. Then install editors/emacs.

Please file a PR to the freebsd-ports-bugs mailing list.


----------



## multix (Mar 4, 2013)

No need to file a bug report. Having checked the logs, I found out the problem being caused by one of the dependencies not being recompiled after libICU upgrade. Together with linbcurses-devel, I was able to successfully upgrade emacs too.


----------

