7 Replies Latest reply on Feb 16, 2011 3:18 AM by 840093

    Source and make for libmqcrt.so

      Is it possible obtain make to compile librery c api libmqcrt.so and relative source ???? I have download source 4.3 source, in package there is a
      /mq/src/share/cclient and subdirectories, all these directories i need compile for obtain a libmqcrt.so library ???

      It's possible obtain source and make of these library.


      Best Regards

      Giovanni Palleschi
        • 1. Re: Source and make for libmqcrt.so
          As far as I know SUN has no plans to provide build files for C-API in near future.

          • 2. Re: Source and make for libmqcrt.so
            Thk for replay.

            I understand. But sources under : /mq/src/share/cclient for version 4.3 are correctly alligned with last version and are they all parts of libmqcrt.so library ???? I can rebuild build files but i am not sure that are all sources. Pls if you know replay.

            Best regards.
            • 3. Re: Source and make for libmqcrt.so

              All C-API source is included in the source zip bundle.
              The C-API has a build dependency on the NSS/NSPR development libraries.

              • 4. Re: Source and make for libmqcrt.so
                Thk u. I have recompiled all sources and recreate library to test mq examples for 4.3 version.
                • 5. Re: Source and make for libmqcrt.so
                  hi ,can you tell me how to buidl c -APIs ?
                  • 6. Re: Source and make for libmqcrt.so
                    As we also needed a 64-bit version of the library and as there's currently no official information available on how to compile libmqcrt.so (except for an incomplete build file crules.xml) we started to try it by ourself and it wasn't that hard. But as its not worth doing things twice I decided to post the required steps here. Allright, my knowledge about C/C++ is a bit rusty and I've never written an ant skript before, but here are the steps needed to build libmqcrt.so. This is tested with OpenMQ 4.5 build 06 on Ubuntu 10.04.

                    You will need to install the the following packages (if they're not already there):
                    - build-essential
                    - ant
                    - libnss3-dev
                    - libnspr4-dev

                    Download the OpenMQ source and extract into a directory of your choice (e.g. +/usr/local/src/+). As this message is limited to 7.500 characters I can only attach an ant script skeleton below (just duplicate the +<exec>...</exec>+ part for each source file under +<openmq4_5-source>/mq/src/share/cclient/+ and adapt filename and path). In general you have to compile each +.cpp+ and +.c+ file like this:
                    $ g++ -shared -fPIC -DLINUX -D_REENTRANT -O2 -I/usr/include/nspr -I/usr/include/nss -lnss3 -lnspr4 -lssl3 -o SubstituteMe.o -c SubstituteMe.cpp
                    Note the subdirectories in the client directory and the +.c+ file in cshim directory. Finally you've got to link all the object files together:
                    $ g++ -Wl,-soname,libmqcrt.so -shared -fPIC -DLINUX -D_REENTRANT -O2 -I/usr/include/nspr -I/usr/include/nss -lnss3 -lnspr4 -lssl3 -o libmqcrt.so *\.o
                    Save the attached build.xml skeleton to +<openmq4_5-source>/mq/src/share/cclient/+ and edit it in your favourite editor. Afterwards just execute
                    $ ant
                    There will be some warnings which can be ignored. After the ant process has finished you (hopefully) got libmqcrt.so at <openmq4_5-source>/mq/src/share/cclient/dist. :-)


                    build.xml skeleton to place in +<openmq4_5-source>/mq/src/share/cclient/+:
                    <project name="mqcrt" default="dist" basedir=".">
                              Oracle Java System Message Queue C API Library
                         <property name="src" location="src" />
                         <property name="build" location="build" />
                         <property name="dist" location="dist" />
                         <property name="cc" value="g++" />
                         <property name="nssinclude" value="" />
                         <property name="nsslib" value="" />
                         <property name="ccopts" value="-shared -fPIC -DLINUX -D_REENTRANT -O2 -I/usr/include/nspr -I/usr/include/nss -lnss3 -lnspr4 -lssl3" />
                         <target name="init">
                              <mkdir dir="${build}" />
                              <mkdir dir="${dist}" />
                         <target name="build" depends="init">
                              <!-- replicate the part below for each .cpp and .c source file //-->
                              <exec executable="/bin/sh" os="Linux">
                                   <arg line='-c "${cc} ${ccopts} -o ${build}/SubstituteMe.o -c ${basedir}/basictypes/SubstituteMe.cpp;"' />
                         <target name="dist" description="Builds the C Client API" depends="build">
                              <exec executable="/bin/sh" os="Linux">
                                   <arg line='-c "${cc} -Wl,-soname,libmqcrt.so ${ccopts} -o ${dist}/libmqcrt.so ${build}/*\.o;"' />
                         <target name="clean">
                              <delete dir="${build}" />
                              <delete dir="${dist}" />
                    • 7. Re: Source and make for libmqcrt.so
                      I've already compiled libmqcrt.so at 64bit linux and used it in China Mobile project, would you like to touch me ?