Installing MQSeries module on Windows XP is a piece of cake, as long as you get the right tools before you even try.
Update: October 29, 2018 I haven’t worked on Windows for the past 8 years when we switched to Macs company wide so I haven’t really been keeping up with the MS world. Fortunately, a kind soul reached out to tell me that Visual Studio Express has been discontinued in favor of Visual Studio Community (thanks, Laura!). I’ve updated the download link to get C++ below. Feel free to read more about VSC in this post that Laura wrote.
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:
- MQSeries installed (get the 90-day trial version here. You will need to register, but there’s no charge for that)
- Microsoft Visual C++ (it’s free, and you can get it here)
- Perl (I use ActiveState)
Steps to get it installed:
- Open a command prompt (Start->Run->cmd.exe)
- (Extremely important!!)Set up your build environment by running vcvarsall.bat. Mine is under C:Program FilesMicrosoft Visual Studio 9.0VC
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) - Make sure your environment variables are set with MQ data: INCLUDE=pathtotoolscinclude directory, LIB=pathtotoolslib directory (typing
set
will show you your env vars) - Install pre-requisite Params::Validate by running perl -MCPAN -e “install Params::Validate”
- Download MQSeries manually by running perl -MCPAN -e “get MQSeries”
- cd into the directory where you have your cpan (mine is c:Perlcpanbuild) and enter MQSeries-x.xx-* (where * is a series of random chars if you’re using the latest CPAN)
- 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 FilesIBMWebsphere MQTools)
- 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.
- 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.
- Run nmake. It came with your MS Visual C++ install and should be in your PATH.
- 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.
- 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.
32 Responses
I was not able to get this installed. Is there any other ideas.
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
andlib
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.
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
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.
Vinny thanks, super easy and worked like a charm!
Anytime!
Vinny
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
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 ?
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.
#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 FilesMicrosoft Visual Studio 9.0VC
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)
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.
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.
Fantastic article. Complete and idiot-proof. Many thanks!
One other thing that might be worth noting is that if you sit behind an HTTP proxy, then you need the ‘http_proxy’ environment variable set up to allow Perl to download modules from CPAN. I’m new to Perl, and it took me a bit of Googling around to find out about this variable.
For anyone who needs to know, the format of http_proxy needs to be ‘http://server:port’. If your proxy requires authentication, you will be asked for the the username/password during the installation.
Thanks for the excellent article. I’m upgrading my MQ Client from V5.3 to v7.0.1 and was having problems getting my existing code to run under it so I tried to recompile MQSeries followed each of the steps above paying particular attention to step 2.
I’m on an XP machince using AS perl v5.10.1 and am using MSC v6.0 to compile the code for MQSeries v1.29. There are no problems with the code compiling and I’ve run some tests with the new version of MQ to make sure that piece is working. So now everything looks good except whem I try to run my script I keep getting an “This application has failed to start because MQM.dll was not found.” Any ideas?
Hi Steffen,
I’m glad you liked the article. The issue you described sounds to me like your Windows Path environment variable is missing the path to MQM.dll. Check out the “Verify System Variables” section of this article by Microsoft to see if you are indeed missing the path to MQM.dll from Path env var. It focuses on a different DLL, but the steps are the same.
Let me know how it goes.
I am using Microsoft Visual C++ 2010 Express on Windows 2003 and got the following nmake fatal error:
MQSeries.xs(2556) : error C2146: syntax error : missing ‘)’ before identifier ‘P
RIdLEAST64’
NMAKE : fatal error U1077: ‘”C:Program FilesMicrosoft Visual Studio 10.0VCBI
Ncl.EXE”‘ : return code ‘0x2’
Stop.
NMAKE : fatal error U1077: ‘C:PROGRA~1MICROS~1.0VCBINnmake.exe’ : return c
de ‘0x2’
Stop.
I ended up having to change the source, from:
sprintf(printed_number, “%” PRIdLEAST64, *(PMQINT64)buffer);
to:
sprintf(printed_number, “%PRIdLEAST64”, *(PMQINT64)buffer);
Otherwise everything worked without a hitch, thanks for the instructions!
I, too, had the same error as Dave and his fix worked. After running “perl MakeFile.PL” the source code c:perlcpanbuildMQSeries-1.31-xxxxxMQClientMQSeries.xs is output. Edit MQSeries.xs and adjust per Dave’s instructions and then run “nmake”.
Also, some other issues I had to overcome:
• If you get the following error:
===========================================================
Alert: While trying to ‘parse’ YAML file
‘C:PerlcpanFTPstats.yml’
with ‘YAML::XS’ the following error was encountered:
Usage: YAML::XS::LibYAML::Load(yaml_sv) at C:Perllib/YAML/XS.pm line 70.
===========================================================
… it means that
(1) you don’t have “YAML::LibYAML” installed or you have an old version installed. Run PPM (Perl Package Manager from Active State) or whatever means you use to update install Perl modules and get the latest YAML-LibYAML module (v1.34 as of this write-up).
• If you get the following error:
===========================================================
perl.exe – Unable To Locate Component
This application failed to start because MSVCR90.dll was not found. Re-installing the application may fix this problem.
===========================================================
… it means you must create a .manifest file per instructions here:
http://search.cpan.org/~mqseries/MQSeries-1.31/README.windows
http://msdn.microsoft.com/en-us/library/ms235591%28VS.80%29.aspx
http://www.davidlenihan.com/2007/07/winsxs.html
or see the summary of how to create a manifest file in the next section below.
• If you get the following error:
===========================================================
Microsoft Visual C++ Runtime Library
Program: C:Perlbinperl.exe
R6034
An application has made an attempt to load the C runtime library incorrectly.
Please contact the application’s support team for more information.
===========================================================
… it means you probably tried to place MSVCR90.dll (or similar C runtime library) into the C:windowssystem32 or adding the path to the runtime to the PATH variable, but this is not allowed in VS 2008 and future VS compilers. The correct way is to remove the change and create a manifest file to the WinSxS directory. See aforementioned section on creating a manifest file for Perl.
Here’s a summary:
Create a file called C:Perlbinperl.exe.manifest:
Search the C:WindowsWinSxS for MSVCR90.dll.
Examples:
C:WINDOWSWinSxSx86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_6f74963e
C:WINDOWSWinSxSx86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375
Notice that the section of the folder name corresponds to the version # of the file (e.g. 9.0.21022.8). More than likely you will want to choose the highest version number (most recent version). You will then reference this version number, processor type, unique ID and name in the XML template below:
Save this as C:Perlbinperl.exe.manifest.
A copy of my perl.exe.manifest file as an example (assuming the comments will display the XML else see example at http://www.davidlenihan.com/2007/07/winsxs.html):
Just wanted to add that most of the above fixes were not required if using Perl v5.10. (The above issues were experienced trying to compile MQSeries using Perl v5.8.) However the “PRIdLEAST64” fix still had to be applied to MQClientMQSeries.xs and MQServerMQSeries.xs (if server is being used). Also, if server is *NOT* being used, I had to modify MQSeries.pm and tweak the code to force “$server = 0” (despite having tried the various documented methods to force nmake to use the “client” rather than the “server” mode) in order to overcome the issue with being asked for “MQM.DLL” which is not required for client mode.
FYI, the PRIdLEAST64 issue appeared when using MQ v7. The issue did not appear in MQ v6.
Hi Vinny,
Thank you for this post and your detailed instructions, and appreciate everyone’s contributions.
Are there any changes to these instructions for Windows 7? The reason for asking it that, on Windows 7 I have installed MQ V7 and it is running and working, and have installed Perl v5.12.2 and Visual Studio 2010. I believe I have followed your instructions closely (including the correction to MQSeries.xs file suggested by Dave and others) and successfully have entered the commands from the Visual Studio Command Prompt successfully all the way to step 10 – the nmake. Now nmake fails with the following error:
MQSeries.obj : fatal error LNK1112: module machine type ‘X86’ conflicts with target machine type ‘x64’
NMAKE : fatal error U1077: ‘”C:Program Files (x86)Microsoft Visual Studio 10.0VCBINlink.EXE”‘ : return code ‘0x458’
Stop.
NMAKE : fatal error U1077: ‘C:PROGRA~2MICROS~2.0VCBINnmake.exe’ : return code ‘0x2’
Stop.
——————————-
If (a big if) I understand this error correctly, does it mean that the MQ Series modules in CPAN are for 32bit installation and not compatible with 64 bit of my machine? Do I understand this error correctly or whether I missed a step along the way? Is there a 64bit version of these modules that can be installed and I might have missed an option somewhere?
I would really appreciate any help or suggestion you or others might have. BTW, in a desperate attempt I have tried “perl Makefile.PL” and “nmake” from both Visual Studio Command Prompt and Visual Studio x64 Win64 Command Prompt with the sample result.
Just a quick update…I was able to get the MQ & Perl mode-mismatch resolved by uninstalling Perl x64 and installing Perl x86, (with no changes to C,C++, or MQ) and redo the steps. The rest of the install worked nicely after that change.
BTW there are two MQSeries.xs files, one in C:PerlcpanbuildMQSeries-x.xx-*MQServer and the other in C:PerlcpanbuildMQSeries-x.xx-*MQClient, that need the fix that Dave had suggested.
Hi
I have been trying to work Perl with WMQ but install fails with the error messages below –
C:PERL>perl -MCPAN -e “install Params::Validate”
Set up gcc environment – 4.5.2
It looks like you don’t have a C compiler and make utility installed. Trying
to install dmake and the MinGW gcc compiler using the Perl Package Manager.
This may take a a few minutes…
Downloading ActiveState Package Repository packlist…failed 500 Can’t connect t
o ppm4.activestate.com:80 (Bad hostname ‘ppm4.activestate.com’)
ppm.bat install failed: Can’t find any package that provides MinGW
It looks like the installation of dmake and MinGW has failed. You will not be
able to run Makefile commands or compile C extension code. Please check your
internet connection and your proxy settings!
Going to read ‘C:PerlcpanMetadata’
Database was generated on Mon, 13 Jun 2011 18:27:15 GMT
Running install for module ‘Params::Validate’
Running make for D/DR/DROLSKY/Params-Validate-1.00.tar.gz
Fetching with LWP:
http://ppm.activestate.com/CPAN/authors/id/D/DR/DROLSKY/CHECKSUMS
Fetching with LWP:
http://ppm.activestate.com/CPAN/authors/id/D/DR/DROLSKY/CHECKSUMS.gz
Warning: no success downloading ‘C:PerlcpansourcesauthorsidDDRDROLSKYCH
ECKSUMS.tmp676’. Giving up on it.
Fetching with LWP:
http://cpan.perl.org/authors/id/D/DR/DROLSKY/CHECKSUMS
Fetching with LWP:
http://cpan.perl.org/authors/id/D/DR/DROLSKY/CHECKSUMS.gz
Warning: no success downloading ‘C:PerlcpansourcesauthorsidDDRDROLSKYCH
ECKSUMS.tmp676’. Giving up on it.
Warning: no success downloading ‘C:PerlcpansourcesauthorsidDDRDROLSKYCH
ECKSUMS.tmp676’. Giving up on it.
No external ftp command available
Fetching with LWP:
http://ppm.activestate.com/CPAN/authors/id/D/DR/DROLSKY/CHECKSUMS
Fetching with LWP:
http://ppm.activestate.com/CPAN/authors/id/D/DR/DROLSKY/CHECKSUMS.gz
Warning: no success downloading ‘C:PerlcpansourcesauthorsidDDRDROLSKYCH
ECKSUMS.tmp676’. Giving up on it.
Fetching with LWP:
http://cpan.perl.org/authors/id/D/DR/DROLSKY/CHECKSUMS
Fetching with LWP:
http://cpan.perl.org/authors/id/D/DR/DROLSKY/CHECKSUMS.gz
Warning: no success downloading ‘C:PerlcpansourcesauthorsidDDRDROLSKYCH
ECKSUMS.tmp676’. Giving up on it.
Warning: no success downloading ‘C:PerlcpansourcesauthorsidDDRDROLSKYCH
ECKSUMS.tmp676’. Giving up on it.
No external ftp command available
Please check, if the URLs I found in your configuration file
(http://ppm.activestate.com/CPAN, http://cpan.perl.org) are valid. The
urllist can be edited. E.g. with ‘o conf urllist push ftp://myurl/‘
Could not fetch authors/id/D/DR/DROLSKY/CHECKSUMS
Now i have the following ENV values set –
C:PERL>set lib
lib=C:Program FilesIBMWebSphere MQtoolslib
C:PERL>set include
include=C:Program FilesIBMWebSphere MQtoolscinclude;C:Program FilesIBMW
ebSphere MQtoolscplusinclude
And MinGW compile installed and set to in C:MinGWbin.
Can anyone please indicate what the issue can be here?
Regards
Roy
Roy,
It looks to me like you’re having trouble getting Params::Validate installed. Have you tried installing it through PPM instead of CPAN?
> ppm install Params::Validate
Vinny
Hi Vinny
I have tried that too – error pasted below
C:>ppm install Params::Validate
Downloading ActiveState Package Repository packlist…failed 500 Can’t connect t
o ppm4.activestate.com:80 (Bad hostname ‘ppm4.activestate.com’)
ppm install failed: Can’t find any package that provides Params::Validate
Btw – i get this error whenever it tries to connect to cpan or ppm from command line – but the same works fine over browser . Not sure why this is so..
Regards
Roy
Looks like you’re behind a firewall or proxy. Please have a look at this FAQ: http://community.activestate.com/faq/ppm-firewall-problems
Cheers,
Vinny
Hi
Yes corret we have firewall . I just got the MQSeries copied manually from CPAN. But getting the error below for my code –
Can’t locate MQSeries.pm in @INC (@INC contains: C:/PERL/site/lib C:/PERL/lib .) at C:PunyaMQClientMQClient.pl line 28.
BEGIN failed–compilation aborted at C:PunyaMQClientMQClient.pl line 28.
I have applied for opening firewall port for PERl sites but its still not completed..
Roy,
You said you copied MQSeries.pm manually from CPAN. Did you follow all the steps in this article to do that? Or did you just pull up the module you found and copy it to your local perl lib? If so, then it won’t work. It needs to be installed, not copied.
Vinny
Thank you for the article. It helped me get my installation complete.
I did run into the same problem one of the previous posters mentioned: “Error when doing perl makefile.pl Unrecognized architecture [MSWin32-x86-multi-thread] and compiler [cl]. Not setting rpath.” Since some errors were being thrown by MQSeries, I assumed this “unrecognized architecture” message would lead me to the source of the problem.
After reviewing the referenced Makefile.pl(s), I realized this message should be more of a warning. The block that throws the error is looking to add additional libraries to rpath for: AIX, Linux and Solaris. Prior to the block, the default rpath is set. So, ultimately, it was not the source of my problem.
For me, the problem was that vcvars*.bat did not set the library paths as I had expected. I had to modify my env variables using system tools. Then all was well.
Thank you, again, for the fine article.
Hi Suzanne,
Thank you for sharing your case. I hope it will be helpful to others as well.
Cheers,
Vinny