|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Help needed with C Compiler on Solaris for Security Exit |
« View previous topic :: View next topic » |
Author |
Message
|
MikeDent |
Posted: Wed Feb 24, 2010 9:49 am Post subject: Help needed with C Compiler on Solaris for Security Exit |
|
|
Newbie
Joined: 24 Feb 2010 Posts: 6
|
Hi all
I am an MQ administrator who knows nothing about writing and compiling code.
I need to compile a security exit based on sample code provided by a partner organisation (DTCC - Depository Trust Clearing Corporation), but I don't know how.
I have tried compiler options like this:
g++ -shared -fPIC -O3 -m64 mqmdh001.c -o mqmdh001.so
(which compiles, but can't be loaded by MQ)
and this:
cc -xarch=native -mt -G -o mqmdh003.so mqmdh003.c -I/opt/mqm/inc -L/opt/mqm/lib64 -R/opt/mqm/lib64 -R/usr/lib/64 -lmqm -lmqmcs -lmqmzse -lsocket -lnsl -ldl
(which fails to compile)
The truth is, I'm flailing around in the dark. Can anyone point me in the right direction with some useful compiler arguments?
I'm on Solaris 10, MQ 6.0.2.2, g++ version 3.4.6, cc version unknown
Many thanks
Mike |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Feb 24, 2010 9:57 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
|
Back to top |
|
 |
RogerLacroix |
Posted: Wed Feb 24, 2010 1:38 pm Post subject: Re: Help needed with C Compiler on Solaris for Security Exit |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
|
Back to top |
|
 |
MikeDent |
Posted: Wed Feb 24, 2010 2:24 pm Post subject: |
|
|
Newbie
Joined: 24 Feb 2010 Posts: 6
|
Thanks for the responses Roger / MQJeff
Jeff - I'll send through the compiler errors tomorrow when I'm in the office.
Roger - Yes, I had seen your page on exits. My problem is that I don't know how to go from raw code, to something that can be used by MQ. The manual pages for the compilers are packed full of obscure flags and options, and I wasn't able to decipher what I needed to make them work for my code on my system.
DTCC don't provide the full shared library - I assume that it needs to be compiled specifically for a given system, MQ version and configuration. It also needs to have a couple of customer-specific values written into it before compilation.
This guy had a problem compiling the same code, but obviously knows how to drive a C compiler better than I do:
http://www.mqseries.net/phpBB2/viewtopic.php?p=230322&sid=eefebd427dc391e1c53a8917ab252b52
I'll attach the errors tomorrow morning, and perhaps that will clarify things.
Thanks again
Mike |
|
Back to top |
|
 |
gbaddeley |
Posted: Wed Feb 24, 2010 3:11 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
|
Back to top |
|
 |
MikeDent |
Posted: Thu Feb 25, 2010 6:28 am Post subject: |
|
|
Newbie
Joined: 24 Feb 2010 Posts: 6
|
Thanks Glenn
One of the commands I tried was taken from that page, but it fails (see below)
Here's what I've got...
If I run this:
g++ -m64 -shared -fPIC -O3 mqmdh003.c -o mqmdh003.so
Or this:
g++ -m64 -shared -fPIC -O3 mqmdh003.c -o mqmdh003.so -I/opt/mqm/inc -L/opt/mqm/lib64 -R/opt/mqm/lib64 -R/usr/lib/64 -lmqm -lmqmcs -lmqmzse -lsocket -lnsl -ldl
Then an output file is generated without any errors. The second command generates a slightly larger output file than the first
If I try to run the channel, calling either of these files, I get the same result:
Code: |
-------------------------------------------------------------------------------
25/02/10 02:01:40 PM - Process(18095.1) User(mqm) Program(runmqchl_nd)
AMQ6175: The system could not dynamically load the shared library
'/var/mqm/exits64/mqmdh003.so'. The system returned error message 'ld.so.1:
runmqchl_nd: fatal: libstdc++.so.6: open failed: No such file or directory'.
The queue manager will continue without this module.
EXPLANATION:
This message applies to UNIX systems. The shared library
'/var/mqm/exits64/mqmdh003.so' failed to load correctly due to a problem with
the library.
ACTION:
Check the file access permissions and that the file has not been corrupted.
----- amqxufnx.c : 1159 -------------------------------------------------------
25/02/10 02:01:40 PM - Process(18095.1) User(mqm) Program(runmqchl_nd)
AMQ9535: User exit not valid.
EXPLANATION:
Channel program 'XXXXXXXX.YYYYYYYY' ended because user exit
'/var/mqm/exits64/mqmdh003.so(MQMDH003)' is not valid.
ACTION:
Ensure that the user exit is specified correctly in the channel definition, and
that the user exit program is correct and available. |
Alternatively, if I use this Sun C Compiler command (from the App Prog Guide):
cc -xarch=native -mt -G -o mqmdh003.so mqmdh003.c -I/opt/mqm/inc -L/opt/mqm/lib64 -R/opt/mqm/lib64 -R/usr/lib/64 -lmqm -lmqmcs -lmqmzse -lsocket -lnsl -ldl
then it fails with the following output:
Code: |
"mqmdh003.c", line 11: warning: no explicit type given
"mqmdh003.c", line 11: syntax error before or at: "C"
"/usr/include/iso/stdio_iso.h", line 74: syntax error before or at: FILE
"/usr/include/iso/stdio_iso.h", line 191: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 193: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 194: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 195: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 196: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 197: syntax error before or at: FILE
"/usr/include/iso/stdio_iso.h", line 198: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 199: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 202: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 204: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 214: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 216: syntax error before or at: __va_list
"/usr/include/iso/stdio_iso.h", line 218: syntax error before or at: __va_list
"/usr/include/iso/stdio_iso.h", line 219: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 220: syntax error before or at: FILE
"/usr/include/iso/stdio_iso.h", line 221: syntax error before or at: FILE
"/usr/include/iso/stdio_iso.h", line 222: syntax error before or at: FILE
"/usr/include/iso/stdio_iso.h", line 225: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 226: syntax error before or at: FILE
"/usr/include/iso/stdio_iso.h", line 235: syntax error before or at: FILE
"/usr/include/iso/stdio_iso.h", line 237: syntax error before or at: FILE
"/usr/include/iso/stdio_iso.h", line 239: syntax error before or at: FILE
"/usr/include/iso/stdio_iso.h", line 241: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 242: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 244: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 245: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 246: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 249: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 250: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 251: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 256: syntax error before or at: *
"/usr/include/iso/stdio_iso.h", line 257: syntax error before or at: FILE
"/usr/include/iso/stdio_c99.h", line 54: syntax error before or at: *
"/usr/include/iso/stdio_c99.h", line 55: syntax error before or at: __va_list
"/usr/include/iso/stdio_c99.h", line 57: syntax error before or at: __va_list
"/usr/include/iso/stdio_c99.h", line 71: syntax error before or at: __va_list
"/usr/include/stdio.h", line 231: syntax error before or at: *
"/usr/include/stdio.h", line 259: syntax error before or at: *
"/usr/include/stdio.h", line 260: syntax error before or at: *
"/usr/include/stdio.h", line 269: syntax error before or at: *
"/usr/include/stdio.h", line 271: syntax error before or at: *
"/usr/include/stdio.h", line 280: syntax error before or at: *
"/usr/include/stdio.h", line 281: syntax error before or at: *
"/usr/include/stdio.h", line 282: syntax error before or at: *
"/usr/include/stdio.h", line 283: syntax error before or at: *
"/usr/include/stdio.h", line 285: syntax error before or at: FILE
"/usr/include/stdio.h", line 295: syntax error before or at: *
"/usr/include/stdio.h", line 297: syntax error before or at: *
"/usr/include/stdio.h", line 308: syntax error before or at: *
"/usr/include/stdio.h", line 309: syntax error before or at: FILE
"/usr/include/stdio.h", line 318: syntax error before or at: *
"/usr/include/stdio.h", line 319: syntax error before or at: *
"/usr/include/stdio.h", line 328: syntax error before or at: *
"/usr/include/stdio.h", line 329: syntax error before or at: *
"/usr/include/stdio.h", line 329: syntax error before or at: FILE
"/usr/include/stdio.h", line 330: syntax error before or at: *
"/usr/include/stdio.h", line 331: syntax error before or at: *
"/usr/include/stdio.h", line 332: syntax error before or at: *
"/usr/include/stdio.h", line 333: syntax error before or at: *
"/usr/include/stdio.h", line 334: syntax error before or at: *
"mqmdh003.c", line 44: undefined symbol: fp
"mqmdh003.c", line 52: warning: improper pointer/integer combination: op "="
"mqmdh003.c", line 95: syntax error before or at: }
cc: acomp failed for mqmdh003.c |
Any ideas?
Many thanks
Mike |
|
Back to top |
|
 |
Mr Butcher |
Posted: Thu Feb 25, 2010 6:59 am Post subject: |
|
|
 Padawan
Joined: 23 May 2005 Posts: 1716
|
I am not familiar with your platform, but BlockIP2, which is a security exit too, provides the following compile information in its manual:
Solaris_x86 and MQ version 6.0 / 7.0
gcc -c -m64 BlockIP2.c -ansi -fPIC -DUNIX -DSOLARIS -
D_REENTRANT -DHNLUP -I/opt/mqm/inc -Wall
/usr/ccs/bin/amd64/ld -64 -mt -G -o BlockIP2 BlockIP2.o -
R/usr/lib/64 -lsocket -lnsl -ldl
Solaris SPARC and MQ version 6.0 / 7.0 using gcc
gcc -I/opt/mqm/inc -m64 -o BlockIP2 BlockIP2.c -G -m64 -L
/usr/lib/64 -lthread -lsocket -lc -lnsl -ldl -DUNIX -
DSOLARIS -D_REENTRANT -DHNLUP
Solaris SPARC and MQ version 6.0 / 7.0 using cc
cc -xarch=v9 -xcode=abs64 -mt -G -o
/var/mqm/exits64/BlockIP2 BlockIP2.c -I/opt/mqm/inc –R
/usr/lib/64 -lsocket -lnsl -ldl -DUNIX -DSOLARIS -
D_REENTRANT -DHNLUP
maybe one of these helps..... _________________ Regards, Butcher |
|
Back to top |
|
 |
MikeDent |
Posted: Thu Feb 25, 2010 8:46 am Post subject: |
|
|
Newbie
Joined: 24 Feb 2010 Posts: 6
|
Problem Solved!
I'm going to write this up, in the hope that it helps other hapless MQ Admins who find themselves in a similar position.
This is probably very basic stuff for people in the development community, but it's been a rapid ascent of the learning curve for me.
Following Mr Butcher's suggestions, I found this post by Brian Shelden:
http://osdir.com/ml/network.mq.devel/2006-06/msg00086.html
It introduced me to the "ldd" - list dynamic dependencies - command.
I had compiled the shared library using this:
g++ -m64 -shared -fPIC -O3 mqmdh003.c -o mqmdh003.so -I/opt/mqm/inc -L/opt/mqm/lib64 -R/opt/mqm/lib64 -R/usr/lib/64 -lmqm -lmqmcs -lmqmzse -lsocket -lnsl -ldl
And then ran ldd:
Code: |
mike$ ldd mqmdh003.so
libmqm.so => /opt/mqm/lib64/libmqm.so
libmqmcs.so => /opt/mqm/lib64/libmqmcs.so
libmqmzse.so => /opt/mqm/lib64/libmqmzse.so
libsocket.so.1 => /usr/lib/64/libsocket.so.1
libnsl.so.1 => /usr/lib/64/libnsl.so.1
libdl.so.1 => /usr/lib/64/libdl.so.1
librt.so.1 => /usr/lib/64/librt.so.1
libstdc++.so.6 => (file not found)
libm.so.2 => /usr/lib/64/libm.so.2
libgcc_s.so.1 => (file not found)
libthread.so.1 => /lib/64/libthread.so.1
libc.so.1 => /lib/64/libc.so.1
libmqz.so => /opt/mqm/lib64/libmqz.so
libmp.so.2 => /lib/64/libmp.so.2
libmd5.so.1 => /lib/64/libmd5.so.1
libscf.so.1 => /lib/64/libscf.so.1
libaio.so.1 => /lib/64/libaio.so.1
libdoor.so.1 => /lib/64/libdoor.so.1
libuutil.so.1 => /lib/64/libuutil.so.1
libgen.so.1 => /lib/64/libgen.so.1
/platform/SUNW,Sun-Fire-V440/lib/sparcv9/libc_psr.so.1
/platform/SUNW,Sun-Fire-V440/lib/sparcv9/libmd5_psr.so.1 |
It showed me that two dependencies couldn't be found.
I had a search around the system, and found that my sysadmin had thoughtfully included them for me in /usr/sfw/lib/64
So I added a "-L" (libraries to use when linking/compiling) and a "-R" (libraries to use at runtime) entry for this directory.
The command now reads:
g++ -m64 -shared -fPIC -O3 -pthreads mqmdh001.c -o mqmdh001.so -I/opt/mqm/inc -L/opt/mqm/lib64 -L/usr/sfw/lib/64 -R/opt/mqm/lib64 -R/usr/lib/64 -R/usr/sfw/lib/64 -lmqm -lmqmcs -lmqmzse -lnsl -ldl -lrt -lgcc -lsocket
This time, ldd was able to identify all of the dependencies:
Code: |
mike$ ldd mqmdh003.so
libmqm.so => /opt/mqm/lib64/libmqm.so
libmqmcs.so => /opt/mqm/lib64/libmqmcs.so
libmqmzse.so => /opt/mqm/lib64/libmqmzse.so
libnsl.so.1 => /usr/lib/64/libnsl.so.1
libdl.so.1 => /usr/lib/64/libdl.so.1
librt.so.1 => /usr/lib/64/librt.so.1
libsocket.so.1 => /usr/lib/64/libsocket.so.1
libstdc++.so.6 => /usr/sfw/lib/64/libstdc++.so.6
libm.so.2 => /usr/lib/64/libm.so.2
libgcc_s.so.1 => /usr/sfw/lib/64/libgcc_s.so.1
libthread.so.1 => /lib/64/libthread.so.1
libc.so.1 => /lib/64/libc.so.1
libmqz.so => /opt/mqm/lib64/libmqz.so
libmp.so.2 => /lib/64/libmp.so.2
libmd5.so.1 => /lib/64/libmd5.so.1
libscf.so.1 => /lib/64/libscf.so.1
libaio.so.1 => /lib/64/libaio.so.1
libdoor.so.1 => /lib/64/libdoor.so.1
libuutil.so.1 => /lib/64/libuutil.so.1
libgen.so.1 => /lib/64/libgen.so.1
/platform/SUNW,Sun-Fire-V440/lib/sparcv9/libc_psr.so.1
/platform/SUNW,Sun-Fire-V440/lib/sparcv9/libmd5_psr.so.1 |
Hey presto, everything works
Many thanks to everyone who helped
Mike |
|
Back to top |
|
 |
Vitor |
Posted: Thu Feb 25, 2010 8:57 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
MikeDent wrote: |
Many thanks to everyone who helped |
And thanks to you for posting the solution.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
zonko |
Posted: Thu Feb 25, 2010 9:18 am Post subject: |
|
|
Voyager
Joined: 04 Nov 2009 Posts: 78
|
Unfortunately, the g++ compiler is not on the supported list, which is:
Quote: |
•Sun ONE Studio 9 Compiler Collection (C and C++)
•Sun Studio 10 Software for Solaris Platforms
•Sun ONE Studio 11 Enterprise Edition for Solaris (C and C++)
•Sun Studio 12 [see section note 1]
|
If you have any problems, IBM will refuse support of the exit unless it is built with a supported compiler.
As a matter of interest, why did you not try Mr Butcher's recommendation, or this command which comes straight out of the WMQ Intercomms manual?
Quote: |
Figure 92. Sample compiler and linker commands for channel exits on Solaris
$ cc -xarch=v9 -mt -G -o /var/mqm/exits64/exit exit.c -I/opt/mqm/inc
-L/opt/mqm/lib64 -R/opt/mqm/lib64 -R/usr/lib/64 -lmqm -lmqmcs -lmqmzse -lsocket
-lnsl -ldl
|
|
|
Back to top |
|
 |
MikeDent |
Posted: Thu Feb 25, 2010 9:40 am Post subject: |
|
|
Newbie
Joined: 24 Feb 2010 Posts: 6
|
Hi Zonko
Running with an unsupported compiler doesn't feel like a big issue (though I'm sure some will disagree). The in-house guys here use GCC, so I was able to get a better quality of help for this. If I encounter problems with this exit, then I'm already better placed and better educated to fix them myself than to phone IBM. So I'm happy enough.
I was indeed intending to use MrButcher's suggested commands, but I wanted to know what the various -Dxxxxxx options did before I ran them. After all, this is a matter of self-education as well as trying to get the job done.
It was whilst searching for these that I found Brian Shelden's post, and the oh-so-useful ldd
If you have a look at my earlier posts, you will see that I did try to run the command from the Intercomm (& App Prog) Guide. It failed, though, for reasons that I still don't understand.
I hope that elucidates things
Cheers
Mike |
|
Back to top |
|
 |
zpat |
Posted: Tue Jun 28, 2011 11:41 pm Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Mike - Have you since upgraded to WMQ v7 - and were there any problems with this exit? |
|
Back to top |
|
 |
MikeDent |
Posted: Thu Jan 31, 2013 8:56 am Post subject: |
|
|
Newbie
Joined: 24 Feb 2010 Posts: 6
|
zpat - this reply is probably too late for you, but might have some use to others.
Yes, we have upgraded. To 7.5.0.0. Today. And we have migrated to linux too. And in the dev environment we have run a very similar compile command which has worked fine.
This was it:
g++ -m64 -shared -fPIC -o /opt/rbos/mq/exits64/mqmdh003.so mqmdh003.c -I/opt/mqm/inc
Best regards
Mike |
|
Back to top |
|
 |
jvdv |
Posted: Sun Mar 03, 2013 4:17 pm Post subject: Compiling exits for MQ 7.1 using Sun Studio 12.3 |
|
|
Newbie
Joined: 28 Feb 2013 Posts: 4 Location: Canberra, Australia
|
After an upgrade to Solaris 10, Sun Studio 12.3 and MQ 7.1 we had a lot of problems with our MSG Exits failing and crashing the pooler process.
It is still early days, but it looks like our problems were due to the way we compiled the exits. A lot of the PIC switches are deprecated in Sun Studio 12.3.
Our last compilation attempt seems stable. This is what we used:
cc -xcode=pic32 -m64 -G -c ourExit.c -I/opt/mqm/inc -R/opt/mqm/lib64 -R/usr/lib/64 -lsocket -lnsl -ldl |
|
Back to top |
|
 |
RogerLacroix |
Posted: Thu Nov 21, 2013 3:19 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|