Bug #51925 5.5 installed header file layout is incorrect
Submitted: 10 Mar 2010 17:36 Modified: 28 Mar 2011 16:52
Reporter: Paul DuBois Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.5 OS:Any
Assigned to: Jonathan Perkin CPU Architecture:Any

[10 Mar 2010 17:36] Paul DuBois
Description:
The layout of installed MySQL header (*.h) files does not match
the layout of header files in the MySQL source tree. This causes
problems trying to build MySQL programs using the installed
headers.

I have a simple MySQL client that connects to the server. It
includes these three header files:

#include <my_global.h>
#include <my_sys.h>
#include <mysql.h>

If I use the headers from 4.1, 5.0, or 5.1, no problem. That is,
these commands work, where the path comes from mysql_config for
a given version of MySQL:

gcc -c -I/var/mysql/40126/include/mysql connect1.c
gcc -c -I/var/mysql/50090/include/mysql connect1.c
gcc -c -I/var/mysql/50146/include/mysql connect1.c

Proceeding to 5.5, compiling works with 5.0.2:

gcc -c -I/var/mysql/50502/include/mysql connect1.c

It fails with 5.0.3:

gcc -c -I/var/mysql/50503/include/mysql connect1.c
In file included from /var/mysql/50503/include/mysql/my_sys.h:31,
                from connect1.c:6:
/var/mysql/50503/include/mysql/my_pthread.h:731:36: error: mysql/psi/mysql_thread.h: No such file or directory
In file included from /var/mysql/50503/include/mysql/my_sys.h:31,
                from connect1.c:6:
/var/mysql/50503/include/mysql/my_pthread.h:738: error: expected specifier-qualifier-list before ‘mysql_cond_t’
In file included from connect1.c:6:
/var/mysql/50503/include/mysql/my_sys.h:367: error: expected specifier-qualifier-list before ‘mysql_mutex_t’
/var/mysql/50503/include/mysql/my_sys.h:383: error: expected specifier-qualifier-list before ‘mysql_mutex_t’
/var/mysql/50503/include/mysql/my_sys.h:446: error: expected specifier-qualifier-list before ‘mysql_mutex_t’
In file included from connect1.c:6:
/var/mysql/50503/include/mysql/my_sys.h:1027:27: error: mysql/psi/psi.h: No such file or directory
make: *** [connect1.o] Error 1

If I use a client that does typical MySQL-style option processing,
it includes these headers:

#include <my_global.h>
#include <my_sys.h>
#include <m_string.h>   /* for strdup() */ 
#include <mysql.h>
#include <my_getopt.h>

As before, compilation works for 4.1, 5.0, and 5.1:

gcc -c -I/var/mysql/40126/include/mysql exec_stmt.c
gcc -c -I/var/mysql/50090/include/mysql exec_stmt.c
gcc -c -I/var/mysql/50146/include/mysql exec_stmt.c

Proceeding to MySQL 5.5, it fails earlier in the series (5.0.0):

gcc -c -I/var/mysql/50500/include/mysql exec_stmt.c
In file included from exec_stmt.c:7:
/var/mysql/50500/include/mysql/m_string.h:256:26: error: mysql/plugin.h: No such file or directory
make: *** [exec_stmt.o] Error 1

I get the same error in 5.5.1 and 5.5.2. In 5.5.3,
the errors are like the first program:

gcc -c -I/var/mysql/50503/include/mysql exec_stmt.c
In file included from /var/mysql/50503/include/mysql/my_sys.h:31,
                from exec_stmt.c:6:
/var/mysql/50503/include/mysql/my_pthread.h:731:36: error: mysql/psi/mysql_thread.h: No such file or directory
In file included from /var/mysql/50503/include/mysql/my_sys.h:31,
                from exec_stmt.c:6:
/var/mysql/50503/include/mysql/my_pthread.h:738: error: expected specifier-qualifier-list before ‘mysql_cond_t’
In file included from exec_stmt.c:6:
/var/mysql/50503/include/mysql/my_sys.h:367: error: expected specifier-qualifier-list before ‘mysql_mutex_t’
/var/mysql/50503/include/mysql/my_sys.h:383: error: expected specifier-qualifier-list before ‘mysql_mutex_t’
/var/mysql/50503/include/mysql/my_sys.h:446: error: expected specifier-qualifier-list before ‘mysql_mutex_t’
In file included from exec_stmt.c:6:
/var/mysql/50503/include/mysql/my_sys.h:1027:27: error: mysql/psi/psi.h: No such file or directory
In file included from exec_stmt.c:7:
/var/mysql/50503/include/mysql/m_string.h:285:26: error: mysql/plugin.h: No such file or directory
make: *** [exec_stmt.o] Error 1

For both programs, I can build them if I point directly
into the source tree for the header files.  These commands
both work:

gcc -c -I/Users/paul/bzr-mysql/mysql-trunk/include connect1.c
gcc -c -I/Users/paul/bzr-mysql/mysql-trunk/include exec_stmt.c

I'm not seeing what is the point of installing the header files
using a layout different from how they are laid out in the
source tree. It appears to make them unusable.

How to repeat:
See above.

Suggested fix:
Use same layout for installed headers as is used in source tree.
[10 Mar 2010 23:54] MySQL Verification Team
Thank you for the bug report.
[19 Mar 2010 16:24] Paul DuBois
I had some typos in my original report.

This:

"Proceeding to 5.5, compiling works with 5.0.2:

gcc -c -I/var/mysql/50502/include/mysql connect1.c

It fails with 5.0.3:"

Should be this:

"Proceeding to 5.5, compiling works with 5.5.2:

gcc -c -I/var/mysql/50502/include/mysql connect1.c

It fails with 5.5.3:"

And this:

"Proceeding to MySQL 5.5, it fails earlier in the series (5.0.0):"

Should be this:

"Proceeding to MySQL 5.5, it fails earlier in the series (5.5.0):"
[19 Mar 2010 16:42] Omer Barnir
Clarifications from Paul on IRC:

"Basically, in a 5.5.x source tree, headers under include have a hierarchical arrangement. When they get installed, the hierarchy is "flattened" - all the files get installed in a single directory."
[17 Aug 2010 12:20] 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/115947

3078 Daniel Fischer	2010-08-17
      Bug#51925: Install all .h files in include/ in the exact same place as they are in bzr. This is an incompatible change from 5.1 and previous 5.5 releases that may affect the build process of software that uses MySQL libraries.
[17 Aug 2010 17:04] 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/115996

3078 Daniel Fischer	2010-08-17
      Bug#51925: Install all .h files in include/ in the exact same place as they are in bzr. This is an incompatible change from 5.1 and previous 5.5 releases that may affect the build process of software that uses MySQL libraries.
[27 Aug 2010 19:46] Sveta Smirnova
Bug #56325 was marked as duplicate of this one.
[1 Oct 2010 12:32] Alex Dupre
This may be fixed in cmake installation, but it's still broken (in a different way) in autoconf/Makefile installation.
In 5.5.5 all the headers were installed in includes/mysql, in 5.5.6 they are installed in includes/mysql and includes/mysql/psi, while the correct thing should be includes/mysql, includes/mysql/mysql and includes/mysql/mysql/psi.
[4 Nov 2010 11:51] MySQL Verification Team
and ./scripts/make_binary_distribution script makes a broken directory structure still...
[4 Nov 2010 13:15] Jonathan Perkin
In 5.5+, make_binary_distribution should probably be deprecated.  Instead

 $ cmake <srcdir> -DBUILD_CONFIG=mysql_release
 $ make package

will produce roughly the same result, and much closer to what Release Engineering provide (unlike make_binary_distribution in the past, due to pkglibdir hacks).
[17 Dec 2010 2:50] Paul DuBois
This bug is still not fixed? See Bug#58987.

I downloaded a Mac OS X 5.5.8 binary distribution and all the header files are still installed in a single directory. That is, the heirarchy of the header files in the source tree is not respected: All headers are "flattened" into a single install directory.
[17 Dec 2010 17:04] Sveta Smirnova
Bug #58987 was marked as duplicate of this one.
[17 Dec 2010 23:12] 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/127232

3213 Jonathan Perkin	2010-12-17
      bug#51925: 5.5 installed header file layout is incorrect
      
      The 'mysql' include sub-directory was copied directly into
      include/ rather than retaining its own directory.
      
      Fix this, and update mysql_config which needs additional
      logic to detect the correct prefix for includes.
[17 Dec 2010 23:14] Jonathan Perkin
I'll take it, and Kent approved on IRC.
[17 Dec 2010 23:15] 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/127233

3214 Jonathan Perkin	2010-12-17
      bug#51925: 5.5 installed header file layout is incorrect
      
      Additional space-in-directory-name protection.
[22 Dec 2010 21:31] Bugs System
Pushed into mysql-trunk 5.6.1 (revid:alexander.nozdrin@oracle.com-20101222212842-y0t3ibtd32wd9qaw) (version source revid:alexander.nozdrin@oracle.com-20101222212842-y0t3ibtd32wd9qaw) (merge vers: 5.6.1) (pib:24)
[29 Dec 2010 12:53] Bugs System
Pushed into mysql-5.5 5.5.9 (revid:alexander.nozdrin@oracle.com-20101229113652-km2v993aurv7h79j) (version source revid:alexander.nozdrin@oracle.com-20101229113132-uonlbcc2uopff8yb) (merge vers: 5.5.9) (pib:24)
[19 Jan 2011 1:20] Paul DuBois
Noted in 5.5.9 changelog.

After compilation from source, all header files were installed in the
same directory, even those that should be installed into 
subdirectories of the installation include directory.
[21 Jan 2011 6:42] Valeriy Kravchuk
Bug #59636 was marked as a duplicate of this one.
[19 Dec 2018 12:55] Terje Røsten
https://bugs.mysql.com/bug.php?id=45113 was marked as dup of this bug.