[MDEV-10293] 'setupterm' was not declared in this scope Created: 2016-06-27  Updated: 2016-12-05  Resolved: 2016-12-05

Status: Closed
Project: MariaDB Server
Component/s: Compiling
Affects Version/s: 10.1.14
Fix Version/s: 5.5.54, 10.0.29, 10.1.20

Type: Bug Priority: Major
Reporter: eli bird Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None
Environment:

Linux Mint 18 BETA
gcc 5.3.1-14ubuntu2.1
libncurses5



 Description   

During compile, make gives:

/opt/mariadb-10.1.14/client/mysql.cc:4911:51: error: 'setupterm' was not declared in this scope
       have_curses= setupterm((char *)0, 1, &errret) != ERR;



 Comments   
Comment by eli bird [ 2016-06-28 ]

Just finished compiling 10.1.9 and this error is not present in that version.

Comment by Daniel Black [ 2016-06-28 ]

Does this occur with libncurses5-dev installed? If so which version of this library is in MINT?

Comment by eli bird [ 2016-06-29 ]

running: "locate libncurses" shows that I have

/lib/x86_64-linux-gnu/libncurses.so.5.9

and also

/usr/lib/x86_64-linux-gnu/libncurses.so

I think the answer you're looking for is 5.9

Comment by Andrew Hutchings (Inactive) [ 2016-09-22 ]

I'm occasionally hitting this on my laptop, re-running cmake and make fixes it so I guess it is a build order issue?

Comment by Piotr Wajda [ 2016-10-13 ]

I'm having the same problem. Re-running cmake and make doesn't help.
On Mint 18 libncurses5-dev are in 6.0 version even if 'locate libncurses' says different:
ja@rio ~/dev/mariadbserver $ dpkg -l | grep libncurses5-dev
ii libncurses5-dev:amd64 6.0+20160213-1ubuntu1 amd64
ja@rio ~/dev/mariadbserver $ locate libncurses.so
/lib/i386-linux-gnu/libncurses.so.5
/lib/i386-linux-gnu/libncurses.so.5.9
/lib/x86_64-linux-gnu/libncurses.so.5
/lib/x86_64-linux-gnu/libncurses.so.5.9

Comment by Andrii Nikitin (Inactive) [ 2016-11-10 ]

I had the same on my fresh xenial and re-cmake / re-make didn't help.
It looks the error occurs when HAVE_TERM_H is not defined, but HAVE_SETUPTERM is defined.
For me it is gone for me after I changed following lines in mysql.cc :

#if defined(HAVE_CURSES_H) && defined(HAVE_TERM_H)
#include <curses.h>
#include <term.h>

to:
#if defined(HAVE_CURSES_H)
#include <curses.h>
#include <term.h>

(The correct fix may be different)

Comment by Sergei Golubchik [ 2016-12-04 ]

Thanks anikitin, that helped to pin it down.

It is a user mistake, strictly speaking. To repeat this error one need to start without libncurses5-dev installed. Run cmake. It will fail with the message

Curses library not found. Please install appropriate package, remove CMakeCache.txt and rerun cmake.
On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.

Now, install the appropriate package, ignore the help text and DO NOT remove CMakeCache.txt, and re-run cmake. This way you will end up with part of the configuration being done without curses and the other part — with curses. CMakeCache.txt will be inconsistent and the compilation will fail.

Remember that CMake works incrementally, it does not re-run checks that were already run and stored in the CMakeCache.txt.


Having said that, I seem to have fixed this particular issue. Still, in the future, if you change you system configuration, it's always safer to remove CMakeCache.txt file before re-running cmake.

Generated at Thu Feb 08 07:41:07 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.