| Bug #27004 | mgmapi doesn't compile into C-code | ||
|---|---|---|---|
| Submitted: | 9 Mar 2007 15:28 | Modified: | 7 Jan 2009 16:41 |
| Reporter: | Jan Kneschke | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Cluster: NDB API | Severity: | S3 (Non-critical) |
| Version: | 5.1.16 | OS: | Linux (linux) |
| Assigned to: | Jonas Oreland | CPU Architecture: | Any |
[9 Mar 2007 15:29]
Jan Kneschke
patch for mgmapi.h to compile with C-apps
Attachment: mysql-5.1.16-mgmapi-c.diff (text/x-patch), 2.22 KiB.
[9 Mar 2007 18:05]
Stewart Smith
I'll take this one - have been talking to Jan and seem to be the mgm guy :)
[11 Mar 2008 19:27]
Monty Taylor
Patch looks good to me.
[11 Mar 2008 19:35]
Jonas Oreland
why isnt this just pushed?
[12 Mar 2008 0:20]
Stewart Smith
Jonas: a) doesn't apply to -telco (where we'd be looking to apply) b) i want my test C-only program to work with it before pushing (if i find where i put it...)
[28 Mar 2008 6:30]
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/44546 ChangeSet@1.2574, 2008-03-28 07:29:51+01:00, mtaylor@solace.(none) +2 -0 BUG#27004 mgmapi doesn't compile into C-code Merged Jan's patch into telco-6.2
[28 Mar 2008 7:05]
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/44550 ChangeSet@1.2574, 2008-03-28 08:04:53+01:00, mtaylor@solace.(none) +2 -0 BUG#27004 mgmapi doesn't compile into C-code Merged Jan's patch into telco-6.2
[28 Mar 2008 7:57]
Monty Taylor
Made Stewart a reviewer and added myself as the dev since I'm pushing the code. Stewart.
[28 Mar 2008 8:03]
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/44555 ChangeSet@1.2551, 2008-03-28 09:03:06+01:00, mtaylor@solace.(none) +2 -0 BUG#27004 mgmapi doesn't compile into C-code Merged Jan's patch into mysql-5.1-new-ndb
[30 Mar 2008 0:45]
Jon Stephens
Documented fix as follows in the 5.1.23-ndb-6.3.11 changelog:
mgmapi.h contained constructs which only worked
in C++, but not in C.
Left as Patch Pending, awaiting additional merges.
[4 Apr 2008 22:31]
Jon Stephens
Also noted in the 5.1.23-ndb-6.2.15 changelog. Status unchanged.
[8 Jul 2008 9:23]
Jon Stephens
Per discussion with Jan and Kent, fix apparently did not make it into 6.3.11 or 6.2.15 - commented out changelog entry, set status back to Open until we get this sorted.
[8 Jul 2008 10:08]
Jan Kneschke
testing with 6.2.15 I get:
$ cat bug-24007.c
#include <mgmapi/mgmapi.h>
int main() {
return 0;
}
$ gcc -Wall -O2 bug-24007.c \
-I /usr/local/mysql-cluster-gpl-6.2.15-linux-x86_64-glibc23/include/ \
-I /usr/local/mysql-cluster-gpl-6.2.15-linux-x86_64-glibc23/include/storage/ndb/
In file included from bug-24007.c:1:
.../include/storage/ndb/mgmapi/mgmapi.h:599: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ndb_mgm_match_event_category’
.../include/storage/ndb/mgmapi/mgmapi.h:810: warning: ‘struct ndb_mgm_severity’ declared inside parameter list
.../include/storage/ndb/mgmapi/mgmapi.h:810: warning: its scope is only this definition or declaration, which is probably not what you want
.../include/storage/ndb/mgmapi/mgmapi.h:862: warning: ‘struct ndb_mgm_loglevel’ declared inside parameter list
.../include/storage/ndb/mgmapi/mgmapi.h: In function ‘ndb_mgm_filter_clusterlog’:
.../include/storage/ndb/mgmapi/mgmapi.h:1154: error: ‘ndb_mgm_event_severity’ undeclared (first use in this function)
.../include/storage/ndb/mgmapi/mgmapi.h:1154: error: (Each undeclared identifier is reported only once
.../include/storage/ndb/mgmapi/mgmapi.h:1154: error: for each function it appears in.)
.../include/storage/ndb/mgmapi/mgmapi.h:1154: error: expected ‘)’ before ‘s’
.../include/storage/ndb/mgmapi/mgmapi.h:1155: error: too few arguments to function ‘ndb_mgm_set_clusterlog_severity_filter’
After adjusting the c-file a bit:
typedef enum ndb_mgm_event_category ndb_mgm_event_category;
typedef enum ndb_mgm_event_severity ndb_mgm_event_severity;
#include <mgmapi/mgmapi.h>
int main() {
return 0;
}
$ gcc -Wall -O2 bug-24007.c \
-I /usr/local/mysql-cluster-gpl-6.2.15-linux-x86_64-glibc23/include/ \
-I /usr/local/mysql-cluster-gpl-6.2.15-linux-x86_64-glibc23/include/storage/ndb/ \
-L /usr/local/mysql-cluster-gpl-6.2.15-linux-x86_64-glibc23/lib \
-l ndbclient -l mysqlclient -lstdc++ -lmysys -lmystrings
In file included from bug-24007.c:4:
.../include/storage/ndb/mgmapi/mgmapi.h:810: warning: ‘struct ndb_mgm_severity’ declared inside parameter list
.../include/storage/ndb/mgmapi/mgmapi.h:810: warning: its scope is only this definition or declaration, which is probably not what you want
.../include/storage/ndb/mgmapi/mgmapi.h:862: warning: ‘struct ndb_mgm_loglevel’ declared inside parameter list
but it links.
If a second file includes the mgmapi.h header we get a link failure:
$ cat bug-24007-2.c
typedef enum ndb_mgm_event_category ndb_mgm_event_category;
typedef enum ndb_mgm_event_severity ndb_mgm_event_severity;
#include <mgmapi/mgmapi.h>
int foo() {
return 0;
}
/tmp/ccTyTgVB.o: In function `ndb_mgm_get_loglevel_clusterlog':
bug-24007-2.c:(.text+0x10): multiple definition of `ndb_mgm_get_loglevel_clusterlog'
/tmp/ccBzeh4p.o:bug-24007.c:(.text+0x10): first defined here
/tmp/ccTyTgVB.o: In function `ndb_mgm_set_loglevel_clusterlog':
bug-24007-2.c:(.text+0x20): multiple definition of `ndb_mgm_set_loglevel_clusterlog'
/tmp/ccBzeh4p.o:bug-24007.c:(.text+0x20): first defined here
/tmp/ccTyTgVB.o: In function `ndb_mgm_get_logfilter':
bug-24007-2.c:(.text+0x30): multiple definition of `ndb_mgm_get_logfilter'
/tmp/ccBzeh4p.o:bug-24007.c:(.text+0x30): first defined here
/tmp/ccTyTgVB.o: In function `ndb_mgm_filter_clusterlog':
bug-24007-2.c:(.text+0x40): multiple definition of `ndb_mgm_filter_clusterlog'
/tmp/ccBzeh4p.o:bug-24007.c:(.text+0x40): first defined here
/tmp/ccTyTgVB.o:(.rodata+0x0): multiple definition of `ndb_mgm_error_msgs'
/tmp/ccBzeh4p.o:(.rodata+0x0): first defined here
/tmp/ccTyTgVB.o:(.rodata+0x110): multiple definition of `ndb_mgm_noOfErrorMsgs'
/tmp/ccBzeh4p.o:(.rodata+0x110): first defined here
collect2: ld returned 1 exit status
[8 Jul 2008 13:35]
Jess Balint
Testing against 6.3.15, the following symbols need to either be made static or moved into a separate compilation unit: include/mgmapi/mgmapi_error.h: const struct Ndb_Mgm_Error_Msg ndb_mgm_error_msgs[] const int ndb_mgm_noOfErrorMsgs include/mgmapi/mgmapi.h: int ndb_mgm_filter_clusterlog() const unsigned int * ndb_mgm_get_logfilter() int ndb_mgm_set_loglevel_clusterlog() const unsigned int * ndb_mgm_get_loglevel_clusterlog()
[12 Dec 2008 23:28]
Bugs System
Pushed into 6.0.6-alpha (revid:sp1r-mtaylor@solace.(none)-20080328080306-27663) (version source revid:sp1r-tomas@poseidon.ndb.mysql.com-20080516085603-30848) (pib:5)
[18 Dec 2008 9:14]
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/61940 2777 Jonas Oreland 2008-12-18 ndb - bug#27004 - mgmapi does not compile to pure c
[18 Dec 2008 9:16]
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/61941 2778 Jonas Oreland 2008-12-18 ndb - bug#27004 - mgmapi does not compile to pure c
[18 Dec 2008 9:43]
Jonas Oreland
fixed again... we should add some kind of test so we don't break it all the time...
[18 Dec 2008 9:43]
Bugs System
Pushed into 5.1.30-ndb-6.2.17 (revid:jonas@mysql.com-20081218091645-0fi1p9d7xws0j1fh) (version source revid:jonas@mysql.com-20081218091645-0fi1p9d7xws0j1fh) (merge vers: 5.1.30-ndb-6.2.17) (pib:6)
[18 Dec 2008 9:44]
Bugs System
Pushed into 5.1.30-ndb-6.3.21 (revid:jonas@mysql.com-20081218093444-bobq7nbtkrnyklux) (version source revid:jonas@mysql.com-20081218093444-bobq7nbtkrnyklux) (merge vers: 5.1.30-ndb-6.3.21) (pib:6)
[18 Dec 2008 9:45]
Bugs System
Pushed into 5.1.30-ndb-6.4.0 (revid:jonas@mysql.com-20081218094326-pzae6pk5el0ylii7) (version source revid:jonas@mysql.com-20081218094326-pzae6pk5el0ylii7) (merge vers: 5.1.30-ndb-6.4.0) (pib:6)
[7 Jan 2009 16:41]
Jon Stephens
Changelog entries moved to NDB-6.2.17 and NDB-6.3.21 changelogs. Closed.
[10 Feb 2009 20:13]
Bugs System
Pushed into 6.0.10-alpha (revid:alik@sun.com-20090210194937-s7xshv5l3m1v7wi9) (version source revid:tomas.ulin@sun.com-20090108115759-b4yhuwkm6w8tg7j3) (merge vers: 6.0.10-alpha) (pib:6)
[12 Feb 2009 10:06]
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/66011 2814 He Zhenxing 2009-02-12 [merge] Auto merge 6.0 -> 6.0-rpl

Description: the mgmapi.h contains a few constructs which only work in C++. 1. const struct Ndb_Mgm_Error_Msg ndb_mgm_error_msgs[] = { ... } this leads to multiple declarations if the mgmapi.h is included by two source-files and linked into a binary. 2. struct ndb_mgm_severity and struct ndb_mgm_loglevel get defined after they are used the first time 3. ndb_mgm_match_event_category() and the typecast in ndb_mgm_set_clusterlog_severity_filter() are missing the "enum". 4. the inline functions lead to duplicate symbols. How to repeat: $ cat f1.c #include <mgmapi/mgmapi.h> int main () { return 0; } $ cat f2.c #include <mgmapi/mgmapi.h> $ gcc -o f1 f1.c f2.c -I /usr/include/mysql/storage/ndb/ In file included from f1.c:1: /usr/include/mysql/storage/ndb/mgmapi/mgmapi.h:666: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ndb_mgm_match_event_category’ /usr/include/mysql/storage/ndb/mgmapi/mgmapi.h:877: warning: ‘struct ndb_mgm_severity’ declared inside parameter list /usr/include/mysql/storage/ndb/mgmapi/mgmapi.h:877: warning: its scope is only this definition or declaration, which is probably not what you want /usr/include/mysql/storage/ndb/mgmapi/mgmapi.h:929: warning: ‘struct ndb_mgm_loglevel’ declared inside parameter list /usr/include/mysql/storage/ndb/mgmapi/mgmapi.h: In function ‘ndb_mgm_filter_clusterlog’: /usr/include/mysql/storage/ndb/mgmapi/mgmapi.h:1221: error: ‘ndb_mgm_event_severity’ undeclared (first use in this function) /usr/include/mysql/storage/ndb/mgmapi/mgmapi.h:1221: error: (Each undeclared identifier is reported only once /usr/include/mysql/storage/ndb/mgmapi/mgmapi.h:1221: error: for each function it appears in.) /usr/include/mysql/storage/ndb/mgmapi/mgmapi.h:1221: error: expected ‘)’ before ‘s’ /usr/include/mysql/storage/ndb/mgmapi/mgmapi.h:1222: error: too few arguments to function ‘ndb_mgm_set_clusterlog_severity_filter’ In file included from f2.c:1: /usr/include/mysql/storage/ndb/mgmapi/mgmapi.h:666: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ndb_mgm_match_event_category’ /usr/include/mysql/storage/ndb/mgmapi/mgmapi.h:877: warning: ‘struct ndb_mgm_severity’ declared inside parameter list /usr/include/mysql/storage/ndb/mgmapi/mgmapi.h:877: warning: its scope is only this definition or declaration, which is probably not what you want /usr/include/mysql/storage/ndb/mgmapi/mgmapi.h:929: warning: ‘struct ndb_mgm_loglevel’ declared inside parameter list /usr/include/mysql/storage/ndb/mgmapi/mgmapi.h: In function ‘ndb_mgm_filter_clusterlog’: /usr/include/mysql/storage/ndb/mgmapi/mgmapi.h:1221: error: ‘ndb_mgm_event_severity’ undeclared (first use in this function) /usr/include/mysql/storage/ndb/mgmapi/mgmapi.h:1221: error: (Each undeclared identifier is reported only once /usr/include/mysql/storage/ndb/mgmapi/mgmapi.h:1221: error: for each function it appears in.) /usr/include/mysql/storage/ndb/mgmapi/mgmapi.h:1221: error: expected ‘)’ before ‘s’ /usr/include/mysql/storage/ndb/mgmapi/mgmapi.h:1222: error: too few arguments to function ‘ndb_mgm_set_clusterlog_severity_filter’ After patching mgmapi.h I get: $ gcc -o f1 f1.c f2.c -I /usr/include/mysql/storage/ndb/ -L/usr/lib64/mysql/ -lndbclient -lstdc++ -lmysys -lmysqlclient -pthread /tmp/cc8VMnw5.o: In function `ndb_mgm_filter_clusterlog': f2.c:(.text+0x0): multiple definition of `ndb_mgm_filter_clusterlog' /tmp/ccszpbOH.o:f1.c:(.text+0x0): first defined here /tmp/cc8VMnw5.o: In function `ndb_mgm_get_logfilter': f2.c:(.text+0x2b): multiple definition of `ndb_mgm_get_logfilter' /tmp/ccszpbOH.o:f1.c:(.text+0x2b): first defined here /tmp/cc8VMnw5.o: In function `ndb_mgm_set_loglevel_clusterlog': f2.c:(.text+0x42): multiple definition of `ndb_mgm_set_loglevel_clusterlog' /tmp/ccszpbOH.o:f1.c:(.text+0x42): first defined here /tmp/cc8VMnw5.o: In function `ndb_mgm_get_loglevel_clusterlog': f2.c:(.text+0x76): multiple definition of `ndb_mgm_get_loglevel_clusterlog' /tmp/ccszpbOH.o:f1.c:(.text+0x76): first defined here collect2: ld returned 1 exit status This is caused by the inline functions at the end. Defining DOXYGEN_SHOULD_SKIP_DEPRECATED fixes this last problem. Suggested fix: Apply the attached patch.