Bug #85483 Installed header files include non-installed header iles
Submitted: 16 Mar 2017 12:49 Modified: 24 Apr 2017 17:15
Reporter: Paul DuBois Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S2 (Serious)
Version:8.0.2 OS:Any
Assigned to: CPU Architecture:Any

[16 Mar 2017 12:49] Paul DuBois
Description:
Some installed header (.h) files contain #include lines for non-installed header files. The result is that compiling a MySQL program that uses the installed header files fails because not all required header files are available.

How to repeat:
The C program I was trying to compile had other stuff, but these lines are sufficient to illustrate:

missing-header.c:

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

Compiling (make missing-header.o) results in this error:

gcc -c -I/var/mysql/80002/include missing-header.c
In file included from missing-header.c:1:
In file included from /var/mysql/80002/include/my_sys.h:25:
/var/mysql/80002/include/m_ctype.h:34:10: fatal error: 'str_uca_type.h' file not
      found
#include "str_uca_type.h"
         ^
1 error generated.
make: *** [missing-header.o] Error 1

This occurs because m_ctype.h is installed in my installation directory
(/var/mysql/80002/include) but str_uca_type.h is not.

If I copy str_uca_type.h manually to the installation directory, I find other similar problems:

/var/mysql/80002/include/m_string.h:29:10: fatal error: 'lex_string.h' file not
      found

After copying lex_string.h:

/var/mysql/80002/include/my_sys.h:27:10: fatal error: 'my_alloc.h' file not
      found

After copying my_alloc.h:

/var/mysql/80002/include/sslopt-vars.h:28:10: fatal error: 'typelib.h' file not
      found

After copying typelib.h compilation succeeds ... for *my* program. Possibly other inclusion-failure issues remain that I did not encounter.

Suggested fix:
Please arrange to install the non-installed files named earlier so that third-party programs compiled using installed header files can be built. Thank you.
[24 Apr 2017 17:15] Paul DuBois
Posted by developer:
 
Noted in 8.0.2 changelog.

These changes were made with respect to client program development:

* Client programs should only need to #include the <mysql.h> header
  file. In particular, <my_config.h> should not be needed, and is no
  longer installed.

* The my_init() function is no longer included in the list of symbols
  exported from libmysqlclient. It need not be called explicitly by
  client programs because it is called implicitly by other C API
  initialization functions.