Bug #55921 Build fails if build with cmake after build without cmake
Submitted: 11 Aug 2010 17:44 Modified: 16 Jan 2014 12:23
Reporter: Sveta Smirnova Email Updates:
Status: Won't fix Impact on me:
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.6.99 OS:Any
Assigned to: CPU Architecture:Any

[11 Aug 2010 17:44] Sveta Smirnova
If one built server without cmake it is not possible to build with cmake without re-clone.

How to repeat:
export HAVE_CMAKE=yes
./BUILD/compile-pentium64-debug-max --prefix=/users/ssmirnova/blade12/build/mysql-next-mr
<build succeed>
export HAVE_CMAKE=no
./BUILD/compile-pentium64-debug-max --prefix=/users/ssmirnova/blade12/build/mysql-next-mr
<build succeed>
export HAVE_CMAKE=yes
./BUILD/compile-pentium64-debug-max --prefix=/users/ssmirnova/blade12/build/mysql-next-mr
<build fail>
[ 14%] Building C object mysys/CMakeFiles/mysys.dir/mf_path.c.o
In file included from /users/ssmirnova/blade12/src/mysql-next-mr/mysys/mf_keycache.c:115:
/users/ssmirnova/blade12/src/mysql-next-mr/include/probes_mysql.h:10:35: error: probes_mysql_nodtrace.h: No such file or directory
/users/ssmirnova/blade12/src/mysql-next-mr/mysys/mf_keycache.c: In function ‘key_cache_read’:
/users/ssmirnova/blade12/src/mysql-next-mr/mysys/mf_keycache.c:2560: warning: implicit declaration of function ‘MYSQL_KEYCACHE_READ_START_ENABLED’
/users/ssmirnova/blade12/src/mysql-next-mr/mysys/mf_keycache.c:2562: warning: implicit declaration of function ‘MYSQL_KEYCACHE_READ_START’
/users/ssmirnova/blade12/src/mysql-next-mr/mysys/mf_keycache.c:2621: warning: implicit declaration of function ‘MYSQL_KEYCACHE_READ_BLOCK’
/users/ssmirnova/blade12/src/mysql-next-mr/mysys/mf_keycache.c:2642: warning: implicit declaration of function ‘MYSQL_KEYCACHE_READ_MISS’
/users/ssmirnova/blade12/src/mysql-next-mr/mysys/mf_keycache.c:2669: warning: implicit declaration of function ‘MYSQL_KEYCACHE_READ_HIT’
/users/ssmirnova/blade12/src/mysql-next-mr/mysys/mf_keycache.c:2737: warning: implicit declaration of function ‘MYSQL_KEYCACHE_READ_DONE_ENABLED’
/users/ssmirnova/blade12/src/mysql-next-mr/mysys/mf_keycache.c:2739: warning: implicit declaration of function ‘MYSQL_KEYCACHE_READ_DONE’
/users/ssmirnova/blade12/src/mysql-next-mr/mysys/mf_keycache.c: In function ‘key_cache_write’:
/users/ssmirnova/blade12/src/mysql-next-mr/mysys/mf_keycache.c:3079: warning: implicit declaration of function ‘MYSQL_KEYCACHE_WRITE_START_ENABLED’
/users/ssmirnova/blade12/src/mysql-next-mr/mysys/mf_keycache.c:3081: warning: implicit declaration of function ‘MYSQL_KEYCACHE_WRITE_START’
[11 Aug 2010 17:55] Vladislav Vaintroub
I would even try that.. This is a feature that cannot work.A build system cannot cleanup reliably after another build system. 

bzr clean-tree --unknown --ignored --force
will help.

According to rumors, "make distclean" in autotools build could do the same, but I would not trust it. "bzr clean-tree" works always.
[11 Aug 2010 18:02] Sveta Smirnova

thank you for the workaround!

As our BUILD scripts calls some clean up functions this still can be issue of one of them.
[11 Aug 2010 18:17] Vladislav Vaintroub
Those scripts are atavisms of autoconf era, and they would not work exactly the same with CMake . Though many things will work, making BUILD/ work the exactly same was never a priority, rather a nice side-effect of dual-mode ./configure script.

Specifically, there is no functional "make distclean" and not functional "make maintainer-clean" . CMake way to handle this things is either clean with VCS means (bzr clean-tree), or better : do not build in source directory, instead  build out-of-source.

It looks like:

mkdir xxx
cd xxx
cmake ..

and, when you finished with build and test you just remove the build directory.

rm -rf *

More info about how to use CMake without BUILD/ and without ./configure is
here http://forge.mysql.com/wiki/CMake
[18 Aug 2010 18:58] Sveta Smirnova
What diff between cleaned and just checked repo says:

$cat ../bugs/bug55921.diff 
Common subdirectories: mysql-next-mr/BUILD and mysql-next-mr-bug55921/BUILD
Common subdirectories: mysql-next-mr/.bzr and mysql-next-mr-bug55921/.bzr
Common subdirectories: mysql-next-mr/.bzr-mysql and mysql-next-mr-bug55921/.bzr-mysql
Common subdirectories: mysql-next-mr/client and mysql-next-mr-bug55921/client
Common subdirectories: mysql-next-mr/cmake and mysql-next-mr-bug55921/cmake
Common subdirectories: mysql-next-mr/cmd-line-utils and mysql-next-mr-bug55921/cmd-line-utils
Common subdirectories: mysql-next-mr/config and mysql-next-mr-bug55921/config
Common subdirectories: mysql-next-mr/dbug and mysql-next-mr-bug55921/dbug
Common subdirectories: mysql-next-mr/Docs and mysql-next-mr-bug55921/Docs
Common subdirectories: mysql-next-mr/extra and mysql-next-mr-bug55921/extra
Common subdirectories: mysql-next-mr/include and mysql-next-mr-bug55921/include
Common subdirectories: mysql-next-mr/libmysql and mysql-next-mr-bug55921/libmysql
Common subdirectories: mysql-next-mr/libmysqld and mysql-next-mr-bug55921/libmysqld
Common subdirectories: mysql-next-mr/libmysql_r and mysql-next-mr-bug55921/libmysql_r
Common subdirectories: mysql-next-mr/libservices and mysql-next-mr-bug55921/libservices
Common subdirectories: mysql-next-mr/man and mysql-next-mr-bug55921/man
Common subdirectories: mysql-next-mr/mysql-test and mysql-next-mr-bug55921/mysql-test
Common subdirectories: mysql-next-mr/mysys and mysql-next-mr-bug55921/mysys
Common subdirectories: mysql-next-mr/packaging and mysql-next-mr-bug55921/packaging
Common subdirectories: mysql-next-mr/plugin and mysql-next-mr-bug55921/plugin
Common subdirectories: mysql-next-mr/pstack and mysql-next-mr-bug55921/pstack
diff -u mysql-next-mr/README mysql-next-mr-bug55921/README
--- mysql-next-mr/README        2010-08-11 19:04:33.000000000 +0200
+++ mysql-next-mr-bug55921/README       2010-08-18 20:45:10.000000000 +0200
@@ -1,4 +1,4 @@
-This is a release of MySQL, a dual-license SQL database server.
+This is a release of MySQL, a dual-license SQL DBMS.
 MySQL is brought to you by the MySQL team at Oracle Corporation.
Common subdirectories: mysql-next-mr/regex and mysql-next-mr-bug55921/regex
Common subdirectories: mysql-next-mr/scripts and mysql-next-mr-bug55921/scripts
Common subdirectories: mysql-next-mr/sql and mysql-next-mr-bug55921/sql
Common subdirectories: mysql-next-mr/sql-bench and mysql-next-mr-bug55921/sql-bench
Common subdirectories: mysql-next-mr/sql-common and mysql-next-mr-bug55921/sql-common
Common subdirectories: mysql-next-mr/storage and mysql-next-mr-bug55921/storage
Common subdirectories: mysql-next-mr/strings and mysql-next-mr-bug55921/strings
Common subdirectories: mysql-next-mr/support-files and mysql-next-mr-bug55921/support-files
Common subdirectories: mysql-next-mr/tests and mysql-next-mr-bug55921/tests
Common subdirectories: mysql-next-mr/unittest and mysql-next-mr-bug55921/unittest
Common subdirectories: mysql-next-mr/vio and mysql-next-mr-bug55921/vio
Common subdirectories: mysql-next-mr/win and mysql-next-mr-bug55921/win
Common subdirectories: mysql-next-mr/zlib and mysql-next-mr-bug55921/zlib

Maybe problem is I am using bzr co rather than bzr pull?
[18 Aug 2010 19:06] Vladislav Vaintroub
only this difference would not cause build to fail..

bzr clean-tree removes files (objects, exes, generated headers and sources) , but does not revert the changes, if you did some editing in existing ones. So it is fine.

What is --prefix=/users/ssmirnova/blade12/build/mysql-next-mr  supposed to do in your command line?
[18 Aug 2010 19:15] Sveta Smirnova
Install binaries in directory named /users/ssmirnova/blade12/build/mysql-next-mr
[18 Aug 2010 19:20] Sveta Smirnova
Found the problem.

bzr diff shows:

$bzr diff
=== removed file 'include/probes_mysql_nodtrace.h'
--- include/probes_mysql_nodtrace.h     2010-03-01 00:06:27 +0000
+++ include/probes_mysql_nodtrace.h     1970-01-01 00:00:00 +0000
@@ -1,129 +0,0 @@
- * Generated by dheadgen(1).
- */
-#ifndef        _PROBES_MYSQL_D
-#define        _PROBES_MYSQL_D

As I did not manually remove this file it looks like one of previous builds did it.
[18 Aug 2010 20:20] Vladislav Vaintroub
Yes, autotools "make distclean" screwed this, I'm not sure how to fix.
the file must be present as we do not generate it on Windows (and we use it on Windows, it gets included)
[19 Aug 2010 10:10] Sveta Smirnova
Maybe just don't remove it while building?
[19 Aug 2010 11:25] Vladislav Vaintroub
maybe, but since autotools is not my speciality, I have no idea whwere to look for. Some autotools guru will definitely find that out.
[26 Aug 2010 22:09] Peter Gulutzan
I confirm that the suggested workaround
bzr clean-tree --unknown --ignored --force
does not work.
So is there no good workaround?
[26 Aug 2010 22:31] Vladislav Vaintroub
"bzr revert" after "bzr clean" might be a good workaround. This will restore a header file that is stored in bzr repository and that is  mistakenly removed by autotools.

Better workaround is not to mix builds from different build systems in the same directory.  Even better workaround is not to use autotools :)
[16 Jan 2014 12:23] Ståle Deraas
Posted by developer:
Autotools not supported from 5.5.