Bug #39571 abi_check: Does not create all prerequisites

Submitted: 21 Sep 2008 18:32 Modified: 28 Jan 2009 21:45
Reporter: Paul DuBois Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.1, 6.0 BZR OS:Any
Assigned to: V Venkateswaran CPU Architecture:Any

[21 Sep 2008 18:32] Paul DuBois
Description:
Early on in the build process, the top-level Makefile builds the "do_abi_check" target. This target requires include/mysql_version.h, which is created by the autotools commands that precede a "make". But if you run "make clean", mysql_version.h is removed and a subsequent "make" fails.

The reason for the failure is that mysql.h includes mysql_com.h, which depends on mysql_version.h here:

#if MYSQL_VERSION_ID >= 50000
  KILL_QUERY= 254,
#endif

If mysql_version.h is not available, no KILL_QUERY line appears in the output that results when gcc processes mysql.h, and a diff failure occurs:

make abi_headers="include/mysql/plugin.h include/mysql.h" do_abi_check
make[2]: Entering directory `/src/extern/MySQL/bzr-mysql/mysql-6.0'
set -ex; \
        for file in include/mysql/plugin.h include/mysql.h; do \
                 gcc -E -nostdinc -dI \
                          -I./include \
                          -I./include/mysql \
                          -I./sql \
                          -I./include \
                          -I./include/mysql \
                          -I./sql \
                                         $file 2>/dev/null | \
                          /bin/sed -e '/^# /d' \
                                    -e '/^[     ]*$/d' \
                                    -e '/^#pragma GCC set_debug_pwd/d' \
                                    -e '/^#ident/d' > \
                                               ./abi_check.out; \
                          /usr/bin/diff -w $file.pp ./abi_check.out; \
                          /bin/rm ./abi_check.out; \
        done
+ for file in include/mysql/plugin.h include/mysql.h
+ gcc -E -nostdinc -dI -I./include -I./include/mysql -I./sql -I./include -I./include/mysql -I./sql include/mysql/plugin.h
+ /bin/sed -e '/^# /d' -e '/^[  ]*$/d' -e '/^#pragma GCC set_debug_pwd/d' -e '/^#ident/d'
+ /usr/bin/diff -w include/mysql/plugin.h.pp ./abi_check.out
+ /bin/rm ./abi_check.out
+ for file in include/mysql/plugin.h include/mysql.h
+ gcc -E -nostdinc -dI -I./include -I./include/mysql -I./sql -I./include -I./include/mysql -I./sql include/mysql.h
+ /bin/sed -e '/^# /d' -e '/^[  ]*$/d' -e '/^#pragma GCC set_debug_pwd/d' -e '/^#ident/d'
+ /usr/bin/diff -w include/mysql.h.pp ./abi_check.out
71d70
<   KILL_QUERY= 254,
make[2]: *** [do_abi_check] Error 1

How to repeat:
BUILD/compile-pentium  # this succeeds
make clean
make                   # this fails

Suggested fix:
mysql_version.h has to be created prior to do_abi_check.
[21 Sep 2008 19:12] Paul DuBois
The following patch fixes the problem, but it's probably best classed as a crude hack rather than the correct fix:

--- Makefile.am 2008-09-04 11:53:16 +0000
+++ Makefile.am 2008-09-21 18:58:56 +0000
@@ -291,6 +291,7 @@ abi_check_all:      $(TEST_PREPROCESSOR_HEADE
        $(MAKE) abi_headers="$^" do_abi_check
 
 do_abi_check:
+       (cd $(top_srcdir)/include && make mysql_version.h)
        set -ex; \
        for file in $(abi_headers); do \
                 @CC@ -E -nostdinc -dI \
[22 Sep 2008 6:52] Sveta Smirnova
Thank you for the report.

Verified as described.
[28 Sep 2008 5:55] V Venkateswaran
include/mysql_version.h is generated from ./include/mysql_version.h.in 
during the configure stage. Since configure built this header it should
ideally be cleaned up during the distclean phase, as mentioned here 

http://www.gnu.org/software/automake/manual/html_node/Clean.html#Clean. 

In our case doing a make clean cleans up this header.

The following patch seemed to fix this problem.

=== modified file 'include/Makefile.am'
--- include/Makefile.am	2008-07-24 11:55:49 +0000
+++ include/Makefile.am	2008-09-27 17:55:43 +0000
@@ -15,7 +15,7 @@
 # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 # MA 02111-1307, USA
 
-BUILT_SOURCES =		$(HEADERS_GEN) link_sources
+BUILT_SOURCES =		link_sources
 HEADERS_GEN =		mysql_version.h my_config.h
 HEADERS_ABI =		mysql.h mysql_com.h mysql_time.h \
 			my_list.h my_alloc.h typelib.h mysql/plugin.h \
@@ -47,7 +47,7 @@
 
 
 # Some include files that may be moved and patched by configure
-DISTCLEANFILES =	sched.h $(CLEANFILES)
+DISTCLEANFILES =	$(HEADERS_GEN) sched.h $(CLEANFILES)
 
 link_sources:
 	-$(RM) -f readline openssl
[8 Oct 2008 14:01] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/55775

2677 V Narayanan	2008-10-08
      Bug#39571 abi_check Does not create all prerequisites
      
      The abi_check target instroduced as part of WL#4380 verifies
      changes to mysql.h. mysql.h in turn includes mysql_version.h.
      mysql_version.h is a file that is generated during the configure
      phase. We must ensure that mysql_version.h is cleaned only during
      distclean and not during clean.
[27 Oct 2008 7:23] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/57082

2683 V Narayanan	2008-10-27
      Bug#39571 abi_check Does not create all prerequisites
      
      The abi_check target instroduced as part of WL#4380 verifies
      changes to mysql.h. mysql.h in turn includes mysql_version.h.
      mysql_version.h is a file that is generated during the configure
      phase. We must ensure that mysql_version.h is cleaned only during
      distclean and not during clean.
[10 Nov 2008 10:54] Bugs System
Pushed into 6.0.8-alpha  (revid:v.narayanan@sun.com-20081027072328-tfofixg7zkltakzp) (version source revid:v.narayanan@sun.com-20081027083125-q2830x3v1dyqu935) (pib:5)
[10 Nov 2008 11:37] Bugs System
Pushed into 5.1.30  (revid:v.narayanan@sun.com-20081027072328-tfofixg7zkltakzp) (version source revid:v.narayanan@sun.com-20081027072328-tfofixg7zkltakzp) (pib:5)
[5 Dec 2008 16:27] pippo pipponi
I am still having this problem in trying to compile mysql 5.1.30 on a Kubuntu Amd64 box. Is there a more recent, patched version? If not, can anyone explain to a complete non-developer how to apply the patch mentioned in the thread?

Stefano
[7 Dec 2008 14:35] Hervé Poussin
Hello All,

Still having the bug on a Solaris 10 compil (with gcc 3.4.3) and sources 5.1.30
When I try to apply the patch, it seems allready applied !
Any infos ?

thanks
[8 Dec 2008 10:34] Jon Stephens
Fix will appear in 5.1.31 and 6.0.9 per discussion with VN.
[8 Dec 2008 14:54] Sergei Golubchik
To users who cannot compile 5.1.30 (as the fix will first appear in 5.1.31) -
the most simple workaround is to run 

  make -C include

That is, if your top-level 'make' fails, run the command as above, and repeat the top-level 'make'.
[19 Jan 2009 11:23] Bugs System
Pushed into 5.1.31-ndb-6.2.17 (revid:tomas.ulin@sun.com-20090119095303-uwwvxiibtr38djii) (version source revid:tomas.ulin@sun.com-20090108105244-8opp3i85jw0uj5ib) (merge vers: 5.1.31-ndb-6.2.17) (pib:6)
[19 Jan 2009 13:01] Bugs System
Pushed into 5.1.31-ndb-6.3.21 (revid:tomas.ulin@sun.com-20090119104956-guxz190n2kh31fxl) (version source revid:tomas.ulin@sun.com-20090119104956-guxz190n2kh31fxl) (merge vers: 5.1.31-ndb-6.3.21) (pib:6)
[19 Jan 2009 16:07] Bugs System
Pushed into 5.1.31-ndb-6.4.1 (revid:tomas.ulin@sun.com-20090119144033-4aylstx5czzz88i5) (version source revid:tomas.ulin@sun.com-20090119144033-4aylstx5czzz88i5) (merge vers: 5.1.31-ndb-6.4.1) (pib:6)
[28 Jan 2009 21:45] Paul DuBois
Noted in 5.1.31, 6.0.9 changelogs.

The do_abi_check program run during the build process depends on
mysql_version.h but that file was not created first, resulting in
build failure.
[15 Jul 2009 21:25] Richard Head
I'm seeing this problem on GNU/Linux with 5.1.31, 5.1.36, and 5.4.1. 

Using:

./BUILD/autorun.sh
./configure
make

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.077 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.