Bug 1478739 - Conflicting headers - regression causing other packages to no longer compile
Summary: Conflicting headers - regression causing other packages to no longer compile
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mariadb
Version: 27
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: ---
Assignee: Michal Schorm
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-08-06 18:03 UTC by Mattias Ellert
Modified: 2017-10-10 19:29 UTC (History)
9 users (show)

Fixed In Version: mariadb-10.2.9-3.fc27
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-10-10 19:29:52 UTC
Type: Bug
Embargoed:


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

Description Mattias Ellert 2017-08-06 18:03:00 UTC
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 11:20:58 UTC
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 12:47:08 UTC
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 06:50:32 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.

Comment 4 Michal Schorm 2017-10-04 16:55:28 UTC
I waited for an upstream fix.
With the latest update in rawhide, the reproducer output seems to be:

# gcc -I /usr/include/mysql -o test.o -c test.c

In file included from test.c:2:0:
/usr/include/mysql/my_global.h:3:2: warning: #warning This file should not be included by clients, include only <mysql.h> [-Wcpp]
 #warning This file should not be included by clients, include only <mysql.h>
  ^~~~~~~

---

It looks, like the issue was solved by upstream.
Can you please confirm this in rawhide, before I move this update to the f27?

Comment 5 Mattias Ellert 2017-10-05 11:49:37 UTC
Yes, it is fixed.

Comment 6 Michal Schorm 2017-10-05 12:03:57 UTC
Great, thanks!

I started preparations to push (some) rawhide changes into F27 and deliver a build.

Comment 7 Fedora Update System 2017-10-06 08:03:19 UTC
mariadb-10.2.9-3.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-dff1218bfa

Comment 8 Fedora Update System 2017-10-06 22:26:18 UTC
mariadb-10.2.9-3.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-dff1218bfa

Comment 9 Fedora Update System 2017-10-10 19:29:52 UTC
mariadb-10.2.9-3.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.


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