Bug #92870 Include header in a wrong way
Submitted: 20 Oct 2018 13:30 Modified: 8 May 2020 15:10
Reporter: Fang Tony Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S3 (Non-critical)
Version:8.0 community server OS:SUSE (15.0)
Assigned to: CPU Architecture:x86 (AMD 1600x)
Tags: df_registration_types.h, mysql_com.h

[20 Oct 2018 13:30] Fang Tony
Description:
The GCC encountered bellow error when I compile the project 'Kbengine' which is an open source project on GitHub and relies on MySQL.
------------error area------------------
In file included from /usr/include/mysql/mysql.h:81:0,
                 from db_interface_mysql.h:14,
                 from db_exception.cpp:4:
/usr/include/mysql/mysql_com.h:1011:10: fatal error: mysql/udf_registration_types.h: No such file or directory
 #include <mysql/udf_registration_types.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
--------------error area-----------------

How to repeat:
Every time I compile the project with MySQL Server 8.0 or 5.x.

Suggested fix:
I only found the header 'udf_registration_types.h' under folder '/usr/include/mysql/mysql', so I changed the code '#include <mysql/udf_registration_types.h>' in the file '/usr/include/mysql/mysql_com.h':1011:10 to '#include "mysql/udf_registration_types.h"'and it works for me.

I'm not sure if it is a buggy of MySQL community server.
[21 Oct 2018 10:06] Terje Røsten
You should use mysql_config to find correct build flags.

/usr/bin/mysql_config --cflags

will output something like:

 -I/usr/include/mysql

If you add that option to gcc when building Kbengine, it should.
[21 Oct 2018 10:09] Terje Røsten
Fixing status.
[22 Nov 2018 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[2 May 2020 0:40] Reio Remma
Same problem on CentOS 8 with official libraries:

mysql-community-common.x86_64   8.0.20-1.el8   @mysql80-community
mysql-community-devel.x86_64    8.0.20-1.el8   @mysql80-community
mysql-community-libs.x86_64     8.0.20-1.el8   @mysql80-community

gcc (GCC) 8.3.1 20190507 (Red Hat 8.3.1-4)

In file included from /usr/include/mysql/mysql.h:80,
                 from table_mysql.c:30:
/usr/include/mysql/mysql_com.h:1034:10: fatal error: mysql/udf_registration_types.h: No such file or directory
#include <mysql/udf_registration_types.h>

To fix I also had to change /usr/include/mysql/mysql_com.h to:

#include "mysql/udf_registration_types.h"

There was no such problem when using the 8.0.17 libraries provided by CentOS 8.
[8 May 2020 11:27] Terje Røsten
Thanks for your report!
[8 May 2020 15:10] Paul DuBois
Posted by developer:
 
Fixed in 8.0.21.

Code cleanup. No changelog entry required.