|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Building 64 bit MQ App on Win8..issues.. |
« View previous topic :: View next topic » |
Author |
Message
|
new_mqdev |
Posted: Sat Feb 22, 2014 12:52 am Post subject: Building 64 bit MQ App on Win8..issues.. |
|
|
Newbie
Joined: 19 Feb 2014 Posts: 6
|
Hello,
My environment: Windows 8 running WMQ v7.5.
Goal: To compile the samples (I know the sample program binaries are included - am trying to compile from command line so I can make changes to the samples).
What I have done:
I downloaded MinGW and tried to get gcc to work. Had multiple issues to get gcc recognize the MQ libraries. Researched mqseries.net and learnt horror stories of using "non IBM recommended" compilers. Lesson learnt. Upon further digging, learnt MS Visual Express C/C++ compiler is a good option (ie supported compiler)
Downloaded MS Visual Express 2013. Though all I needed was the commandline C/C++ compiler, endured all the crap (.NET 4.5, SQL Server etc etc) that came as a bundle (took 2 hours to download). The installable by default installed the compiler in c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC. When I try to compile using the "CL" command (am basically a commandline guy - do not fancy the IDEs), had issues getting it to recognize the include files.
Also the commadline command with spaces enclosed in quotes again did not work - mainly due to the spaces. Copied the VC folder under c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC into a separate folder (c:\MyCCompiler\VC) - this time without spaces. Got around the spaces issue.
Next the CL command was unable to find the include files. Solved it using the /I switch.
Next came the libraries - mqm.lib. Included this by listing the libs at the end of the compile command. At this point the linker start complaining about the default libraries - LIBCMT.lib, OLDNAMES.lib and finally kernel32.lib! At this point, my commandline compile command looked like this:
===
C:\MQ75\tools\c\Samples>C:\MyCCompiler\VC\bin\cl amqsget0.c /I C:\MyCCompiler\VC\include /I %INLUDE% -Fe amqsget_new.exe C:\MQ
75\tools\lib64\mqm.lib C:\MyCCompiler\VC\lib\LIBCMT.lib C:\MyCCompiler\VC\lib\OLDNAMES.lib
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.21005.1 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
amqsget0.c
Microsoft (R) Incremental Linker Version 12.00.21005.1
Copyright (C) Microsoft Corporation. All rights reserved.
/out:amqsget_new.exe
amqsget0.obj
C:\MQ75\tools\lib64\mqm.lib
C:\MyCCompiler\VC\lib\LIBCMT.lib
C:\MyCCompiler\VC\lib\OLDNAMES.lib
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
===========
Am unable to figure why kernel32.lib is entering the picure as I am essentially building a 64 bit App. Also shouldn't there be a simpler way of linking the standard libs instead of listing every one of those at the end (I can understand the need to have mqm.lib listed - but the rest???)
Folks - can any one guide me as to how to go about this? Will continue to dig but if someone has already been there, done that, would appreciate a shout-out...this started out a simple task but morphed into a complicated exercise (maybe am getting stupider as time passes!) |
|
Back to top |
|
 |
new_mqdev |
Posted: Sat Feb 22, 2014 4:20 am Post subject: Resolved... |
|
|
Newbie
Joined: 19 Feb 2014 Posts: 6
|
Hello All,
Turns out my MQ installation is in 32 bit mode as verified by the command dspmqver.
I linked 32 bit MQ lib after adding in the missing libs as I kept discovering them (took a couple iterations here...). The final compilation commnd that worked is:
C:\MQ75\mqxr\samples>C:\MyCCompiler\VC\bin\cl -MD amqsget0.c -Fenew.exe /IC:\MQ75\tools\c\include /IC:\MyCCompiler\VC\in
clude C:\MQ75\tools\Lib\mqm.lib C:\MyCCompiler\VC\lib\MSVCRT.lib C:\MyCCompiler\VC\lib\OLDNAMES.lib "C:\Program Files (
x86)\Windows Kits\8.1\Lib\winv6.3\um\x86\kernel32.lib"
If there is a way to avoid listing those libs at the end, let me know. As for me, I have written a batch file which lists all the above and takes the program as arg and does the compile - am all set for now (though I would really love to improvise without spending a lot of time on it!)
Thanks
-mqdev |
|
Back to top |
|
 |
gbaddeley |
Posted: Sun Feb 23, 2014 2:35 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
You shouldn't need to specify the full path names for anything. Are you setting all the required environment variables for VC ?
I use the VC command line compiler, and call %VS90COMNTOOLS%vsvars32.bat before running cl, link, nmake etc. _________________ Glenn |
|
Back to top |
|
 |
RogerLacroix |
Posted: Mon Feb 24, 2014 2:04 pm Post subject: Re: Building 64 bit MQ App on Win8..issues.. |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
new_mqdev wrote: |
Downloaded MS Visual Express 2013. Though all I needed was the commandline C/C++ compiler, endured all the crap (.NET 4.5, SQL Server etc etc) that came as a bundle (took 2 hours to download). |
First off, 2013 isn't supported and way, way over kill for what you needed. But it is done, so you can try and use it.
I've never heard of anyone having PATH issues when it is installed in the default location. I personally hate long path name, so I short it to: D:\P_Files\MSVS6\ or D:\P_Files\MSVS2010\
Did you put each path name in double quotes?
I use Eclipse everyday of my life for both Java and C coding. I do NOT use the MS Visual 2010 IDE. In Eclipse, when I create a new C project I select an empty makefile. I manually create the makefile for what I need and Eclipse happily parses everything correctly.
Here's a basic 32-bit makefile, I have used:
Code: |
#
# Make file
#
!include <win32.mak>
MQMINC = "D:\Program Files (x86)\IBM\WebSphere MQ\Tools\c\include"
MQMLIB = "D:\Program Files (x86)\IBM\WebSphere MQ\Tools\Lib"
OUTDIR = .\Release
all: $(OUTDIR)\testpgm.exe
### -----------------------------------------------------------------
$(OUTDIR)\testpgm.exe: testpgm.obj
$(link) $(conlflags) -out:$*.exe $** $(conlibs) user32.lib $(MQMLIB)\mqm.lib
### -----------------------------------------------------------------
testpgm.obj : testpgm.c
### -----------------------------------------------------------------
# Rules for cleaning out those old files
clean:
del *.bak *.pdb *.obj $(OUTDIR)\*.res $(OUTDIR)\*.exp $(OUTDIR)\*.lib $(OUTDIR)\*.map $(OUTDIR)\*.exe $(OUTDIR)\*.dll
### -----------------------------------------------------------------
# Inference rule for updating the object files
.c.obj:
$(cc) $(cflags) $(cvars) -I$(MQMINC) $*.c |
Here's a basic 64-bit makefile, I have used:
Code: |
#
# Make file
#
!include <win32.mak>
MQMINC = "D:\Program Files (x86)\IBM\WebSphere MQ\Tools\c\include"
MQMLIB = "D:\Program Files (x86)\IBM\WebSphere MQ\Tools\Lib64"
OUTDIR = .\Release64
all: $(OUTDIR)\testpgm.exe
### -----------------------------------------------------------------
$(OUTDIR)\testpgm.exe: testpgm.obj
$(link) $(conlflags) -out:$*.exe $** $(conlibs) user32.lib $(MQMLIB)\mqm.lib
### -----------------------------------------------------------------
testpgm.obj : testpgm.c
### -----------------------------------------------------------------
# Rules for cleaning out those old files
clean:
del *.bak *.pdb *.obj $(OUTDIR)\*.res $(OUTDIR)\*.exp $(OUTDIR)\*.lib $(OUTDIR)\*.map $(OUTDIR)\*.exe $(OUTDIR)\*.dll
### -----------------------------------------------------------------
# Inference rule for updating the object files
.c.obj:
$(cc) $(cflags) $(cvars) -I$(MQMINC) $*.c |
Of course, all of this assumes that you have run the appropriate MS VS setup script to load the specific MS VS environment variables.
i.e. MS VS v6
D:\P_Files\MSVS6\VC98\Bin\VCVARS32.BAT
i.e. MS VS 2010
"D:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /Release /x64
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
new_mqdev |
Posted: Thu Feb 27, 2014 11:43 pm Post subject: |
|
|
Newbie
Joined: 19 Feb 2014 Posts: 6
|
Roger and gbaddeley,
I will try the methods suggested by you folks. Thanks a ton for chipping in..much appreciated!
-mqdev |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Feb 28, 2014 5:27 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I typically launch Eclipse with the CDT from a VisualStudio command prompt, if I'm doing "straight" C/C++. If I'm doing windows dev, I use VS.
Whenever I try and compile an MQ C program, I go back to the Info Center section on Building MQ Applications on Windows, and double-check all of my compiler commands against the sample for the version of MQ I'm compiling against. |
|
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
|
|
|
|