7 Replies Latest reply: Feb 15, 2011 9:18 PM by 840093 RSS

    Source and make for libmqcrt.so

    807581
      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.

      Thk

      Best Regards

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

          Tom
          • 2. Re: Source and make for libmqcrt.so
            807581
            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
              807581
              Hi,

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

              Thanks.
              • 4. Re: Source and make for libmqcrt.so
                807581
                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
                  807581
                  hi ,can you tell me how to buidl c -APIs ?
                  • 6. Re: Source and make for libmqcrt.so
                    807581
                    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. :-)

                    Enjoy,
                    AnusPlus


                    build.xml skeleton to place in +<openmq4_5-source>/mq/src/share/cclient/+:
                    <project name="mqcrt" default="dist" basedir=".">
                         <description>
                              Oracle Java System Message Queue C API Library
                         </description>
                         
                         <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>
                         
                         <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;"' />
                              </exec>
                    
                         </target>
                         
                         <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;"' />
                              </exec>
                         </target>
                         
                         <target name="clean">
                              <delete dir="${build}" />
                              <delete dir="${dist}" />
                         </target>
                    </project>
                    • 7. Re: Source and make for libmqcrt.so
                      840093
                      I've already compiled libmqcrt.so at 64bit linux and used it in China Mobile project, would you like to touch me ?
                      msn:wyuanzhi920@hotmail.com