Subject: | Patch for "multiple definition" error with MQ8 |
Date: | Wed, 20 Apr 2016 18:14:22 +0200 |
To: | bug-MQSeries [...] rt.cpan.org |
From: | Thorsten Hirsch <Thorsten.Hirsch [...] dzbank.de> |
Hi MQSeries team,
we ran into the following problem when trying to compile MQSeries-1.34 on
RHEL6 with MQ 8.0.0.4 and our own build of Perl 5.22.1:
$ make
[...]
gcc -c -I"/opt/mqm/inc" -I../include -fwrapv -fno-strict-aliasing -pipe
-fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O2 -DVERSION=\"1.34\"
-DXS_VERSION=\"1.34\" -fPIC
"-I/binaries/perl/current/lib/5.22.1/x86_64-linux/CORE"
-DMQ_CMVC_LVALUE=\"v8.0.0.4/p800-004-151017\" constants.c
gcc -c -I"/opt/mqm/inc" -I../include -fwrapv -fno-strict-aliasing -pipe
-fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O2 -DVERSION=\"1.34\"
-DXS_VERSION=\"1.34\" -fPIC
"-I/binaries/perl/current/lib/5.22.1/x86_64-linux/CORE"
-DMQ_CMVC_LVALUE=\"v8.0.0.4/p800-004-151017\" MQSeries.c
rm -f blib/arch/auto/MQClient/MQSeries/MQSeries.so
gcc -shared -Wl,-rpath -Wl,/opt/mqm/lib64 MQSeries.o constants.o -o
blib/arch/auto/MQClient/MQSeries/MQSeries.so \
\
constants.o: In function `MQACTP_STR':
constants.c:(.text+0x0): multiple definition of `MQACTP_STR'
MQSeries.o:MQSeries.c:(.text+0x0): first defined here
constants.o: In function `MQACTV_STR':
constants.c:(.text+0x40): multiple definition of `MQACTV_STR'
MQSeries.o:MQSeries.c:(.text+0x40): first defined here
constants.o: In function `MQACT_STR':
constants.c:(.text+0x70): multiple definition of `MQACT_STR'
MQSeries.o:MQSeries.c:(.text+0x70): first defined here
constants.o: In function `MQADOPT_CHECK_STR':
constants.c:(.text+0x120): multiple definition of `MQADOPT_CHECK_STR'
MQSeries.o:MQSeries.c:(.text+0x120): first defined here
[...]
You see the compilation was successful, but linking MQSeries.o and
constants.o throws an error. The string definitions (*_STR) are included
in both object files. I'm pretty sure MQ 8 has introduced the problem,
because there's a new header file in our 8.0.0.4 installation:
inc/cmqstrc.h. MQ 7.5.0.5 does not contain that header file.
The list of included header files is built dynamically by Makefile.PL,
*.xs, and *.in. The result is, that both, MQSeries.c as well as
constants.c include cmqstrc.h. Thus they are included in both object
files. Our patch introduces to skip cmqstrc.h when building the include
list for MQSeries.c. So the string definitions will only go into
constants.o and linking can run successfully.
Then there's at least one more file that needs to be patched for the new
header file: util/parse_headers, the "skip include guard" to be precise.
Here we see, that all header files are being parsed and ...well... the
regular expression looks for the specific comment "File not yet included".
if (m@^#if !defined.*\s+/\*\s+File not yet included\?\s+\*/@ ||
m@^#endif\s+/\* End of header file \*/@
) {
#print "Skip include guard: $_\n";
next;
}
That comment really exists in all header files ...except for the new
cmqstrc.h.
cmqbc.h:
#if !defined(MQBC_INCLUDED) /* File not yet included? */
#define MQBC_INCLUDED /* Show file now included */
[...]
cmqstrc.h:
#if !defined(CMQSTRC_INCLUDED)
#define CMQSTRC_INCLUDED
[...]
Of course we could ask IBM to include a specific comment in a header file,
but come one ...such a request sounds like a joke. We should better not
rely on a specific comment. So our fix adds another regular expression
into util/parse_headers that will work with cmqstrc.h.
I'm pretty sure the patch is compatible with all older MQ versions.
Please build a new version of the MQSeries module and include our patch.
Mit freundlichen Grüßen/Kind regards
Thorsten Hirsch
DZ BANK AG
IT
Entwicklung Integration
F/ITEI
Platz der Republik
60325 Frankfurt am Main
T +49 69 7447 99992
F +49 69 7447 99109
mailto:Thorsten.Hirsch@dzbank.de
Show quoted text
_________________________________________________
DZ BANK AG
Deutsche Zentral-Genossenschaftsbank, Frankfurt am Main
Platz der Republik, 60325 Frankfurt am Main
Deutschland/Germany
http://www.dzbank.de
http://www.geschaeftsbericht.dzbank.de
http://www.deutschland-made-by-mittelstand.de
http://www.bielmeiersblog.dzbank.de
http://www.dzbank-derivate.de
mailto:mail@dzbank.de, T +49 69 7447 01, F +49 69 7447 1685
Vorstand/Board of Directors: Wolfgang Kirsch (Vorsitzender/Chief Executive
Officer),
Lars Hille, Wolfgang Köhler, Dr. Cornelius Riese, Thomas Ullrich, Frank
Westhoff, Stefan Zeidler
Aufsichtsratsvorsitzender/Chairman of the Supervisory Board: Helmut
Gottschalk
Sitz/Registered Office: Stadt Frankfurt am Main, Amtsgericht Frankfurt am
Main
Handelsregister/Register of Companies: HRB 45651
_________________________________________________
Der Umwelt zuliebe: Bitte überlegen Sie, ob diese Mail unbedingt
ausgedruckt werden muss!
For the sake of the environment: Please consider if it is necessary to
print this email.
Message body not shown because it is not plain text.