Compiling and Running Windows programs on Ubuntu
For a while I had been wanting to get my company's products to compile and run on linux and since they are written in QT and M$ VS C 6 it was somewhat of a challenge. Here are few tips that might help somebody else on the same road. I did this on ubuntu 7.04 but probably most of this is not very linux distro specific, so give it a shot. Most of my help came from this slightly old doc, so I am not going to repeat everything contained in this doc by J. Grant:
http://codingstyle.com/articles/using-ms-vcpp-with-gnu-wine.html
1.First make sure you got latest latest wine, what threw me off was that wine version doesn't use correct decimal numbering i.e. 0.9.09 is called 0.9.9 so it came before for example 0.9.10. Anyway you can get latest 0.9.38 that I used from here:
http://wine.budgetdedicated.com/apt/pool/main/w/wine/
2.Now copy all the MS VC6 files as well as QT files if you need them from you windows machine to your linux box, folders you should need are called Common, VC98 and something like qtdll/3.0.5(or whatever QT you have). Puth them under .wine/drive_c where ever you like but
remember the path for step 5.
3. From your windows XP machine copy MSVCRT.DLL to the ubuntu box default wine system32 folder at:
~/.wine/drive_c/windows/system32
4. On ubuntu command line run
winecfg
and go to libraries. Add MSVCRT.DLL as native override.
ALSO CHANGE OS EMULATION TO WINDOWS XP
5. PATH IS VERY IMPORTANT TO GET RIGHT
From ubuntu command line run
wine regedit
navigate to
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment
add the PATHs from step 3 following, for example in my case path is as follows:
c:\windows\system32;c:\windows;d:\nexaclient\qtdll\3.0.5\bin;d:\vs\common\msdev98\bin;d:\vs\vc98\bin
6. now try running
wine nmake
and make sure you get something like
NMAKE : fatal error U1064: MAKEFILE not found and no target specified
Stop.
so you know nmake is running and in the PATH. Check step above it's not working.
7. For some reason wine DOS shell called from nmake .mak script could not run the QT moc command, so I did via following little RUBY script to be run inside the directory with the QT headers in it:
headers=`ls *h`
headers.each do |header|
puts `wine moc #{header.chop!} -o moc_#{header.sub!('.h','.cpp')}`
end
8. Export ENV variables and call wine nmake, so for example in my case from ubuntu shell I issued:
export INCLUDE="z:\root\vs\vc98\include;z:\root\vs\vc98\mfc\include;z:\root\vs\vc98\mfc\src;z:\root\vs\vc98\atl\include;z:\root\nexaclient\qtdll\3.0.5\include;z:\root\nexaclient\qt\viewer\Common"
export LIB="z:\root\vs\vc98\lib;z:\root\vs\vc98\mfc\lib;z:\root\vs\vc98\mfc\src"
export QTDIR="z:\root\nexaclient\qtdll\3.0.5"
You can also put these vars into a script that also calls the nmake so you don't have to keep retyping them.
I also changed my .mak script to default to RELEASE and now when I call
wine nmake mymak.mak
I will get MYEXE.EXE in Release folder under the directory with the code
9. After this running the EXE was simple as in the correct DIR calling:
wine myexe.exe
and Viva La FSM! it works!
10. Next I also the great free installer generating program, Innosetup
http://www.jrsoftware.org/isinfo.php
this one was as simple as running the installer, after downloading to ubuntu box simply called:
wine setup.exe
and remarkably, it all just works! (or at least it did after a long night....)
Hopefully this helps somebody to get going a little quicker.
GLUCK!
http://codingstyle.com/articles/using-ms-vcpp-with-gnu-wine.html
1.First make sure you got latest latest wine, what threw me off was that wine version doesn't use correct decimal numbering i.e. 0.9.09 is called 0.9.9 so it came before for example 0.9.10. Anyway you can get latest 0.9.38 that I used from here:
http://wine.budgetdedicated.com/apt/pool/main/w/wine/
2.Now copy all the MS VC6 files as well as QT files if you need them from you windows machine to your linux box, folders you should need are called Common, VC98 and something like qtdll/3.0.5(or whatever QT you have). Puth them under .wine/drive_c where ever you like but
remember the path for step 5.
3. From your windows XP machine copy MSVCRT.DLL to the ubuntu box default wine system32 folder at:
~/.wine/drive_c/windows/system32
4. On ubuntu command line run
winecfg
and go to libraries. Add MSVCRT.DLL as native override.
ALSO CHANGE OS EMULATION TO WINDOWS XP
5. PATH IS VERY IMPORTANT TO GET RIGHT
From ubuntu command line run
wine regedit
navigate to
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment
add the PATHs from step 3 following, for example in my case path is as follows:
c:\windows\system32;c:\windows;d:\nexaclient\qtdll\3.0.5\bin;d:\vs\common\msdev98\bin;d:\vs\vc98\bin
6. now try running
wine nmake
and make sure you get something like
NMAKE : fatal error U1064: MAKEFILE not found and no target specified
Stop.
so you know nmake is running and in the PATH. Check step above it's not working.
7. For some reason wine DOS shell called from nmake .mak script could not run the QT moc command, so I did via following little RUBY script to be run inside the directory with the QT headers in it:
headers=`ls *h`
headers.each do |header|
puts `wine moc #{header.chop!} -o moc_#{header.sub!('.h','.cpp')}`
end
8. Export ENV variables and call wine nmake, so for example in my case from ubuntu shell I issued:
export INCLUDE="z:\root\vs\vc98\include;z:\root\vs\vc98\mfc\include;z:\root\vs\vc98\mfc\src;z:\root\vs\vc98\atl\include;z:\root\nexaclient\qtdll\3.0.5\include;z:\root\nexaclient\qt\viewer\Common"
export LIB="z:\root\vs\vc98\lib;z:\root\vs\vc98\mfc\lib;z:\root\vs\vc98\mfc\src"
export QTDIR="z:\root\nexaclient\qtdll\3.0.5"
You can also put these vars into a script that also calls the nmake so you don't have to keep retyping them.
I also changed my .mak script to default to RELEASE and now when I call
wine nmake mymak.mak
I will get MYEXE.EXE in Release folder under the directory with the code
9. After this running the EXE was simple as in the correct DIR calling:
wine myexe.exe
and Viva La FSM! it works!
10. Next I also the great free installer generating program, Innosetup
http://www.jrsoftware.org/isinfo.php
this one was as simple as running the installer, after downloading to ubuntu box simply called:
wine setup.exe
and remarkably, it all just works! (or at least it did after a long night....)
Hopefully this helps somebody to get going a little quicker.
GLUCK!
0 Comments:
Post a Comment
<< Home