Perl: Installing MQSeries CPAN module on Windows XP

Installing MQSeries module on Windows XP is a piece of cake, as long as you get the right tools before you even try.

Update: July 2, 2009 I had to install the module on a new computer running Windows XP and it looks like I had missed a few steps in the original how-to below. It's been updated with the manual editing steps. From step 3 down, it's all new.

This is what you need:

  1. MQSeries installed (get the 90-day trial version here. You will need to register, but there's no charge for that)
  2. Microsoft Visual C++ (it's free, and you can get it here)
  3. Perl (I use ActiveState)

Steps to get it installed:

  1. Open a command prompt (Start->Run->cmd.exe)
  2. (Extremely important!!)Set up your build environment by running vcvarsall.bat. Mine is under C:\Program Files\Microsoft Visual Studio 9.0\VC
    An alternative to this step is to open a Visual Studio 2008 Command Prompt (Start->All Programs->Microsoft C++ 2008 Express Edition->Visual Studio Tools->Visual Studio 2008 Command Prompt)
  3. Make sure your environment variables are set with MQ data: INCLUDE=path\to\tools\c\include directory, LIB=\path\to\tools\lib directory (typing set will show you your env vars)
  4. Install pre-requisite Params::Validate by running perl -MCPAN -e "install Params::Validate"
  5. Download MQSeries manually by running perl -MCPAN -e "get MQSeries"
  6. cd into the directory where you have your cpan (mine is c:\Perl\cpan\build) and enter MQSeries-x.xx-* (where * is a series of random chars if you're using the latest CPAN)
  7. With a decent text editor (I'm using Notepad++ and also like Crimson Editor and Programmer's Notepad 2), edit CONFIG file: uncomment MQMTOP = ... and replace the path with the path to your MQ Tools directory. It's OK to use long directory and file names (e.g c:\Program Files\IBM\Websphere MQ\Tools)
  8. Now cd into the utils directory, open parse_headers file and comment out or delete the line near the top where it says "my $include = '/opt/mqm/inc';". The reason for this is that my overwrites the $include variable previously populated by parse_config file.
  9. Save your changes and in the base directory for the MQSeries build, run perl Makefile.PL. It might complain about some libs not being found, but that wasn't a show stopper for me.
  10. Run nmake. It came with your MS Visual C++ install and should be in your PATH.
  11. Run nmake test. It'll fail, since you didn't set any valid data in the CONFIG file. If you have any valid data such as QM and Queues to test it with, go ahead and set them in the CONFIG file and run nmake test again. If not, that's OK.
  12. If nmake test was the only place where it failed, then you're good to run nmake install.

That's it - Perl MQSeries module should now be installed.

14 comments to Perl: Installing MQSeries CPAN module on Windows XP

  • [...] que eu gosto de trabalhar. Ele já começou em grande estilo, documentando em detalhes como instalar o módulo CPAN do MQ no [...]

  • Sean Sneed

    I was not able to get this installed. Is there any other ideas.

    • Vinny

      Hi Sean,

      Did you follow all the steps? What error did you get and on what step?

      • Here’s a followup on Sean’s problem:

         

        1) He did not have MQSeries paths in his include and lib environment variables. They’re supposed to be added by the MQSeries install, but for some weird reason, his didn’t.

         

        2) vcvarsall.bat wasn’t run (or so I understand), which caused problems due to the environment setup.

         

        3) Another error he was getting (MQSeries.c : fatal error C1902: Program database manager mismatch; please check
        your installation) was regarding a messed up MS Visual C++ 2008 Express install. mspdb80.dll was in the Visual C++ bin directory when it shouldn’t. If you’re experiencing the same problem, follow this link for more info.

  • Alan

    Hi Vinny!

    Thanks for the great install steps. I will give it a try in a little while.
    I was wondering if there is a binary install option.
    Eventually I would need to create a binary install(er) for this module here anyway.

    Thanks!
    Alan

  • Vinny

    Hey Alan,
    I’ll try to build some PPDs and will let you know. If you have any good sites explaining how to do that, please post it. The only one I found so far was http://jenda.krynicky.cz/perl/PPM.html, but I’m not having much progress.

  • Wayne

    Vinny thanks, super easy and worked like a charm!

  • Herman Lip

    I follow your instructions and fail.
    Error when doing perl makefile.pl
    Unrecognized architecture [MSWin32-x86-multi-thread] and compiler [cl]. Not setting rpath.

    I ignored this error/warning and do nmake and get a lot warnings and follows with these errors
    MQSeries.xs(2543) : error C2146: syntax error : missing ‘)’ before identifier ‘PRIdLEAST64′
    MQSeries.xs(2679) : error C2146: syntax error : missing ‘)’ before identifier ‘SCNdLEAST64′
    MQSeries.xs(2686) : error C2196: case value ‘256′ already used
    MQSeries.xs(2691) : error C2196: case value ‘512′ already used
    MQSeries.xs(2699) : error C2181: illegal else without matching if
    MQSeries.xs(2702) : error C2043: illegal break
    MQSeries.xs(2703) : error C2046: illegal case
    MQSeries.xs(2705) : error C2043: illegal break
    MQSeries.xs(2706) : error C2047: illegal default
    MQSeries.xs(2711) : error C2065: ‘Hconn’ : undeclared identifier
    MQSeries.xs(2711) : error C2065: ‘Hmsg’ : undeclared identifier
    MQSeries.xs(2711) : error C2065: ‘SetPropOpts’ : undeclared identifier
    MQSeries.xs(2711) : error C2065: ‘name’ : undeclared identifier
    MQSeries.xs(2711) : error C2065: ‘PropDesc’ : undeclared identifier
    MQSeries.xs(2711) : error C2065: ‘Type’ : undeclared identifier
    MQSeries.xs(2711) : error C2065: ‘value_len’ : undeclared identifier
    MQSeries.xs(2711) : error C2065: ‘value_ptr’ : undeclared identifier
    MQSeries.xs(2711) : warning C4022: ‘MQSETMP’ : pointer mismatch for actual parameter 8
    MQSeries.xs(2711) : error C2065: ‘CompCode’ : undeclared identifier
    MQSeries.xs(2711) : error C2065: ‘Reason’ : undeclared identifier
    MQSeries.c(4776) : error C2065: ‘PropDesc’ : undeclared identifier
    MQSeries.c(4776) : error C2224: left of ‘.Version’ must have struct/union type
    MQSeries.c(4776) : error C2198: ‘Perl_newSViv’ : too few arguments for call
    MQSeries.c(4778) : error C2065: ‘PropDesc’ : undeclared identifier
    MQSeries.c(4778) : error C2224: left of ‘.Options’ must have struct/union type
    MQSeries.c(4778) : error C2198: ‘Perl_newSViv’ : too few arguments for call
    MQSeries.c(4780) : error C2065: ‘PropDesc’ : undeclared identifier
    MQSeries.c(4780) : error C2224: left of ‘.Support’ must have struct/union type
    MQSeries.c(4780) : error C2198: ‘Perl_newSViv’ : too few arguments for call
    MQSeries.c(4782) : error C2065: ‘PropDesc’ : undeclared identifier
    MQSeries.c(4782) : error C2224: left of ‘.Context’ must have struct/union type
    MQSeries.c(4782) : error C2198: ‘Perl_newSViv’ : too few arguments for call
    MQSeries.c(4784) : error C2065: ‘PropDesc’ : undeclared identifier
    MQSeries.c(4784) : error C2224: left of ‘.CopyOptions’ must have struct/union type
    MQSeries.c(4784) : error C2198: ‘Perl_newSViv’ : too few arguments for call
    MQSeries.c(4787) : error C2065: ‘CompCode’ : undeclared identifier
    MQSeries.c(4789) : error C2065: ‘Reason’ : undeclared identifier
    MQSeries.c(4792) : error C2059: syntax error : ‘do’
    MQSeries.c(4792) : error C2059: syntax error : ‘while’
    MQSeries.c(4793) : error C2059: syntax error : ‘}’

    Any help is much appreciated

    • Vinny

      Hi Herman, I’d put my chips on the error you ignored. Some questions:

      Which Perl are you using?
      Which Windows?
      Are you trying from Cygwin?
      Did you get the VC installed correctly?
      Did you use the command prompt through the link that is installed by Visual Studio to run perl Makefile.pl ?

  • Herman Lip

    Thanks for the quick response
    1) Perl 5.10.1 build 1007
    2) Windows XP professional sp2
    3) I am not trying from Cygwin. However, I have Cygwin installed on my mcahine.
    4) I believe I install VC correctly and the environment variable is set up correctly.
    5) I don’t really understand your last question. I use to Windows command prompt to run perl Makefile.pl

    One more thing, before I read your article, I use gcc instead of cl (I did install curl using gcc sucessfully). I have the same error with gcc.

    • Vinny

      #5 is your problem right there… Step 2 from the post should resolve the problem.

      2) (Extremely important!!)Set up your build environment by running vcvarsall.bat. Mine is under C:\Program Files\Microsoft Visual Studio 9.0\VC
      An alternative to this step is to open a Visual Studio 2008 Command Prompt (Start->All Programs->Microsoft C++ 2008 Express Edition->Visual Studio Tools->Visual Studio 2008 Command Prompt)

  • Herman Lip

    I did ran vcvarsall.bat after I install VC and that is why I use Windows Command prompt. Now I try to use Visual Studio 2008 Command Prompt. Same problem.

    • Vinny

      Herman,

      I really don’t know what may be the problem. I still think it’s a problem related to the “Unrecognized Architecture” though. Please keep us posted if you figure something out.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>