Bug #42730 build failure after "./configure --with-debug"
Submitted: 10 Feb 2009 13:43 Modified: 18 Mar 2009 8:49
Reporter: Guilhem Bichot Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:6.0-bzr OS:Linux (32-bit)
Assigned to:
Triage: Triaged: D2 (Serious)

[10 Feb 2009 13:43] Guilhem Bichot
Description:
I'm using 6.0:
 2692 Sergey Petrunia   2009-02-05 [merge]
      revision-id:sergefp@mysql.com-20090205082222-ph8f7zi9cst1lvnk
      Merge mysql-6.0 -> mysql-6.0-opt

I do "./configure --debug" and it fails here:
ake[2]: Entering directory `/home/mysql_src/bzrrepos/mysql-6.0/client'
if g++ -DUNDEF_THREADS_HACK -DDEFAULT_MYSQL_HOME="\"/usr/local\"" -DDATADIR="\"/usr/local/var\"" -I. -I. -I../include -I../include -I../include -I../regex     -g -O -DSAFE_MUTEX    -fno-implicit-templates -fno-exceptions -fno-rtti  -MT mysql.o -MD -MP -MF ".deps/mysql.Tpo" -c -o mysql.o mysql.cc; \
        then mv -f ".deps/mysql.Tpo" ".deps/mysql.Po"; else rm -f ".deps/mysql.Tpo"; exit 1; fi
mysql.cc:1043: error: expected constructor, destructor, or type conversion before ‘*’ token
mysql.cc: In function ‘int not_in_history(const char*)’:
mysql.cc:2378: error: ‘HIST_ENTRY’ was not declared in this scope
mysql.cc:2378: error: ‘oldhist’ was not declared in this scope
mysql.cc:2378: error: ‘history_get’ was not declared in this scope
mysql.cc: In function ‘void initialize_readline(char*)’:
mysql.cc:2400: error: invalid conversion from ‘char** (*)()’ to ‘char** (*)(const char*, int, int)’
mysql.cc: In function ‘char** new_mysql_completion(const char*, int, int)’:
mysql.cc:2423: error: ‘completion_matches’ was not declared in this scope
make[2]: *** [mysql.o] Error 1

I noticed this while trying to reproduce the different problem described by a user here:
http://lists.mysql.com/internals/36236

How to repeat:
Get 6.0-main from bzr
./configure --debug
make
it fails in mysql.cc
[10 Feb 2009 13:44] Guilhem Bichot
What the user got is:

mysql.o: In function `build_completion_hash':
/usr/local/mysql-6.0-build/client/mysql.cc:2516: undefined reference to `_db_enter_'
[17 Mar 2009 16:34] Daniel Fischer
Can you please confirm that this happens even when you run "make clean" first?
[18 Mar 2009 8:49] Guilhem Bichot
I took a fresh checkout of mysql-6.0:
revision-id:alik@sun.com-20090313103922-a0lmerckkone8c97
and did:
./BUILD/autorun.sh
./configure --with-debug
make
and it compiled client/* without problem.
[18 Mar 2009 9:02] Daniel Fischer
Okay, thanks for confirming. For the record, the cause of the original issue is that dbug.o, like many other object files, is not rebuilt automatically after running configure again. In the case of dbug.o, the file contains disjunct sets of symbols depending on whether debugging is turned on or off at the time dbug.o is built from dbug.c, and other parts of the source make assumptions about the symbols contained in dbug.o based on whether debugging is turned on or off at the time they are compiled.

We could run make clean as a step in configure, but arguably, this is not always desired. Also, it will not always prevent these issues, e.g. when files are renamed after bzr pull, a make clean step in configure will not be able to remove the old files, thus giving a false sense of security.