Bug 1478739 - Conflicting headers - regression causing other packages to no longer compile
Conflicting headers - regression causing other packages to no longer compile
Status: ASSIGNED
Product: Fedora
Classification: Fedora
Component: mariadb (Show other bugs)
27
Unspecified Unspecified
urgent Severity urgent
: ---
: ---
Assigned To: Michal Schorm
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-08-06 14:03 EDT by Mattias Ellert
Modified: 2017-08-15 02:50 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
This patch will fix the problem (587 bytes, patch)
2017-08-14 08:47 EDT, Mattias Ellert
no flags Details | Diff

  None (edit)
Description Mattias Ellert 2017-08-06 14:03:00 EDT
Description of problem:

# cat test.c 
#include <mysql.h>
#include <my_global.h>

# gcc -I /usr/include/mysql -o test.o -c test.c 
In file included from /usr/include/mysql/service_thd_timezone.h:41:0,
                 from /usr/include/mysql/services.h:40,
                 from /usr/include/mysql/plugin.h:51,
                 from /usr/include/mysql/my_global.h:1022,
                 from test.c:2:
/usr/include/mysql/mysql_time.h:40:6: error: nested redefinition of ‘enum enum_mysql_timestamp_type’
 enum enum_mysql_timestamp_type
      ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/mysql/mysql_time.h:40:6: error: redeclaration of ‘enum enum_mysql_timestamp_type’
In file included from test.c:1:0:
/usr/include/mysql/mysql.h:382:6: note: originally defined here
 enum enum_mysql_timestamp_type
      ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/mysql/service_thd_timezone.h:41:0,
                 from /usr/include/mysql/services.h:40,
                 from /usr/include/mysql/plugin.h:51,
                 from /usr/include/mysql/my_global.h:1022,
                 from test.c:2:
/usr/include/mysql/mysql_time.h:42:3: error: redeclaration of enumerator ‘MYSQL_TIMESTAMP_NONE’
   MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
   ^~~~~~~~~~~~~~~~~~~~
In file included from test.c:1:0:
/usr/include/mysql/mysql.h:384:3: note: previous definition of ‘MYSQL_TIMESTAMP_NONE’ was here
   MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
   ^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/mysql/service_thd_timezone.h:41:0,
                 from /usr/include/mysql/services.h:40,
                 from /usr/include/mysql/plugin.h:51,
                 from /usr/include/mysql/my_global.h:1022,
                 from test.c:2:
/usr/include/mysql/mysql_time.h:42:29: error: redeclaration of enumerator ‘MYSQL_TIMESTAMP_ERROR’
   MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
                             ^~~~~~~~~~~~~~~~~~~~~
In file included from test.c:1:0:
/usr/include/mysql/mysql.h:384:29: note: previous definition of ‘MYSQL_TIMESTAMP_ERROR’ was here
   MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
                             ^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/mysql/service_thd_timezone.h:41:0,
                 from /usr/include/mysql/services.h:40,
                 from /usr/include/mysql/plugin.h:51,
                 from /usr/include/mysql/my_global.h:1022,
                 from test.c:2:
/usr/include/mysql/mysql_time.h:43:3: error: redeclaration of enumerator ‘MYSQL_TIMESTAMP_DATE’
   MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
   ^~~~~~~~~~~~~~~~~~~~
In file included from test.c:1:0:
/usr/include/mysql/mysql.h:385:3: note: previous definition of ‘MYSQL_TIMESTAMP_DATE’ was here
   MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
   ^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/mysql/service_thd_timezone.h:41:0,
                 from /usr/include/mysql/services.h:40,
                 from /usr/include/mysql/plugin.h:51,
                 from /usr/include/mysql/my_global.h:1022,
                 from test.c:2:
/usr/include/mysql/mysql_time.h:43:28: error: redeclaration of enumerator ‘MYSQL_TIMESTAMP_DATETIME’
   MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
                            ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from test.c:1:0:
/usr/include/mysql/mysql.h:385:28: note: previous definition of ‘MYSQL_TIMESTAMP_DATETIME’ was here
   MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
                            ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/mysql/service_thd_timezone.h:41:0,
                 from /usr/include/mysql/services.h:40,
                 from /usr/include/mysql/plugin.h:51,
                 from /usr/include/mysql/my_global.h:1022,
                 from test.c:2:
/usr/include/mysql/mysql_time.h:43:57: error: redeclaration of enumerator ‘MYSQL_TIMESTAMP_TIME’
   MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
                                                         ^~~~~~~~~~~~~~~~~~~~
In file included from test.c:1:0:
/usr/include/mysql/mysql.h:385:57: note: previous definition of ‘MYSQL_TIMESTAMP_TIME’ was here
   MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
                                                         ^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/mysql/service_thd_timezone.h:41:0,
                 from /usr/include/mysql/services.h:40,
                 from /usr/include/mysql/plugin.h:51,
                 from /usr/include/mysql/my_global.h:1022,
                 from test.c:2:
/usr/include/mysql/mysql_time.h:59:16: error: redefinition of ‘struct st_mysql_time’
 typedef struct st_mysql_time
                ^~~~~~~~~~~~~
In file included from test.c:1:0:
/usr/include/mysql/mysql.h:388:16: note: originally defined here
 typedef struct st_mysql_time
                ^~~~~~~~~~~~~
In file included from /usr/include/mysql/service_thd_timezone.h:41:0,
                 from /usr/include/mysql/services.h:40,
                 from /usr/include/mysql/plugin.h:51,
                 from /usr/include/mysql/my_global.h:1022,
                 from test.c:2:
/usr/include/mysql/mysql_time.h:65:3: error: conflicting types for ‘MYSQL_TIME’
 } MYSQL_TIME;
   ^~~~~~~~~~
In file included from test.c:1:0:
/usr/include/mysql/mysql.h:394:3: note: previous declaration of ‘MYSQL_TIME’ was here
 } MYSQL_TIME;
   ^~~~~~~~~~

Version-Release number of selected component (if applicable):

mariadb-devel-10.2.7-7.fc27.x86_64

How reproducible:

Always

Steps to Reproduce:
1. echo '#include <mysql.h>' > test.c
2. echo '#include <my_global.h>' >> test.c
3. gcc -I /usr/include/mysql -o test.o -c test.c

Actual results:

Compilation errors - conflicting declarations.

Expected results:

No errors

Additional info:

This is a regression in Fedora 27. Doing the same on Fedora 26 (and all previous versions) works as expected. This causes other packages to no longer compile.
Comment 1 Michal Schorm 2017-08-08 07:20:58 EDT
Hello.

With update to MariaDB 10.2, there are two "mysql.h" libraries.
 /usr/include/mysql.h
 /usr/include/mysql/mysql.h

They are not the same. One is used to build against client, and the other against server.


Can you please try to build with the second one?
Hope that will solve your issue.

There are several issues tracked in this bugzilla, I think you would be able to find simmilar one solved there:
https://bugzilla.redhat.com/show_bug.cgi?id=1467297
Comment 2 Mattias Ellert 2017-08-14 08:47 EDT
Created attachment 1313096 [details]
This patch will fix the problem

The problem is that in the new version, the headers /usr/include/mysql/mysql.h and /usr/include/mysql/mysql_time.h are not compatible with each other.

In the previous version /usr/include/mysql/mysql.h contained the line

#include "mysql_time.h"

- and that work just fine.

In the new version, this #include statement has been replaces with a

#ifndef _mysql_time_h_
...
#endif

block. The _mysql_time_h_ macro is the include guard used in /usr/include/mysql/mysql_time.h, so this is supposed to prevent getting duplicate declarations from including both files. But, the new block in mysql.h is missing the corresponding

#define _mysql_time_h_

so this protection only works one way.

The /usr/include/mysql/mysql_time.h header has a

typedef long my_time_t;

that is missing from the new block in mysql.h, so only adding the missing #define will result in complaints about my_time_t being undefined, so the attached patch addresses this to.

Lastly, /usr/include/mysql/mysql_time.h does not #define AUTO_SEC_PART_DIGITS, so the patch moves this statement to after the #ifndef block.
Comment 3 Jan Kurik 2017-08-15 02:50:32 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.

Note You need to log in before you can comment on or make changes to this bug.