Can't run my app on another machine.

Problems building or running the engine, queries about how to use features etc.
Post Reply
chibix
Gnoblar
Posts: 8
Joined: Sun Mar 18, 2007 12:51 pm

Can't run my app on another machine.

Post by chibix »

Hi,

I work with VC ++ 2005 with SP1 and Windows PSDK.

I followed the tutoirial for beginners on the wiki. Everything is ok but i can't run my app on another pc. I get an error like 'can't execute this program' or 'this program is not well configured.' ( I have this msg in french ).

I tried a simple hello world app and it didn't work as well.
After I found out than if I set the code generation in multithread and not multithread dll it worked. So i tried to make this with my ogre project but ofcourse it didn't linked in debug and in release, it worked but crashed on my another pc !

I even copied the msvcr80.dll and msvcp80.dll but it didn't change anything.

Can you help me please, I really doesn't understand a thing here.

User avatar
Samir
Halfling
Posts: 59
Joined: Sat Jun 25, 2005 12:11 pm

Post by Samir »

To run a program compiled with Visual C++ 2005 without having to install its runtime using an installer, you'll have to include in the same folder as your application files msvcr80.dll msvcp80.dll msvcm80.dll as well as a manifest file named Microsoft.VC80.CRT.Manifest containing (make sure you save it in UNICODE):

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright © 1981-2001 Microsoft Corporation-->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" 
                                 manifestVersion="1.0">
  <noInheritable/>
  <assemblyIdentity
    type="win32"
    name="Microsoft.VC80.CRT"
    version="8.0.50727.762"
    processorArchitecture="x86"
    publicKeyToken="1fc8b3b9a1e18e3b" />
  <file name="msvcr80.dll"/>
  <file name="msvcp80.dll"/>
  <file name="msvcm80.dll"/>
</assembly>
That worked fine for me and was enough until I ran into a problem last week. The problem is, SP1 changed the runtime from version 8.0.50608.0 to version 8.0.50727.762 which is fine if you run the program on the same machine as the SP1 installer already configures it to redirects all calls from version 8.0.50608.0 to version 8.0.50727.762.
But the problem is, the last version of Ogre is compiled with 8.0.50727.762 while CEGUI (one of Ogre's dependencies) is compiled with some libraries which where compiled with 8.0.50608.0. I couldn't manage to compile all of CEGUI with all its dependencies and recompile Ogre again, it was too much work. So instead, I used a resource editor (XN resource editor: http://www.wilsonc.demon.co.uk/d10resourceeditor.htm) to remove the dependency entry on 8.0.50608.0 in files CEGUIBase.dll and CEGUIExpatParser.dll and to my application's exe file. So their embedded manifest went from this:

Code: Select all

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.762" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50608.0" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>
to this:

Code: Select all

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.762" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>
Hope that helps. Let me know if you stumble on some of thoses steps, hoping that the CEGUI dependencies will soon be recompiled against version 8.0.50727.762.

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

Or, you can just deploy your application with an installer (like the OGRE Demos distro does). It's a bit easier ;) We use WiX.

Or, if you don't want to use a 'proper' installer, you can run the separate VC resdist package on the other machine (vcredist_x86.exe), although this is only provided with the Pro edition of VC I think.

User avatar
Samir
Halfling
Posts: 59
Joined: Sat Jun 25, 2005 12:11 pm

Post by Samir »

I'm afraid the problem is not just about the VC8 runtime being on the target machine, copying the 3 dll files and the manifest would solve that. The problem is with the fact that CEGUI's dependencies still use an old version of the runtime (no SP1) and an installer solution would still not solve that as those dependencies would still need a redirection to the new version.

chibix
Gnoblar
Posts: 8
Joined: Sun Mar 18, 2007 12:51 pm

Post by chibix »

I tried this but it doesn't work... I used the program 'depends' to check the depedencies of the exe but everything was ok ! I don't know why the launcher doesn't want to load my exe.

I'll try an installer.

chibix
Gnoblar
Posts: 8
Joined: Sun Mar 18, 2007 12:51 pm

Post by chibix »

But I can't download the msi ... :'(

chibix
Gnoblar
Posts: 8
Joined: Sun Mar 18, 2007 12:51 pm

Post by chibix »

I'll try wix, thank you for your help.

User avatar
Samir
Halfling
Posts: 59
Joined: Sat Jun 25, 2005 12:11 pm

Post by Samir »

I'm sure the problem won't be solved with an installer (msi or wix), you have to know which dlls are using the old version of the runtime and remove those too. Mine where CEGUIBase.dll and CEGUIExpatParser.dll, maybe you have others.

Open all dlls you're using with XN resource editor and make sure they are using only the same version as the dlls you're copying (or installing).

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

Samir wrote:I'm afraid the problem is not just about the VC8 runtime being on the target machine, copying the 3 dll files and the manifest would solve that. The problem is with the fact that CEGUI's dependencies still use an old version of the runtime (no SP1) and an installer solution would still not solve that as those dependencies would still need a redirection to the new version.
I was pretty sure the SP1 redist install sets that up. If you look inside the WinSxS area after having installed the SP1 redists you'll see that there is a pre-SP1 runtime entry which is set up to use the SP1 DLLs. It does on the machines I've installed it on anyway.

User avatar
Samir
Halfling
Posts: 59
Joined: Sat Jun 25, 2005 12:11 pm

Post by Samir »

The installer might do that, I'm not sure, I haven't tried. The reason I didn't try is that I did not have the priviledge to run an installer on the machine I wanted to run my application on, and this is why I used the copy dlls + manifest method.

chibix
Gnoblar
Posts: 8
Joined: Sun Mar 18, 2007 12:51 pm

Post by chibix »

I think that this is not a dll problem. I mean, if the loader can't find a dll, you have a notice about which dll is not found but this is not the case here.

chibix
Gnoblar
Posts: 8
Joined: Sun Mar 18, 2007 12:51 pm

Post by chibix »

I give up for today. Anyway, I don't see why an installer would make my app running.

And why now, I can't juste make an executable and use it simply. Why is it so complicated -_-.

User avatar
Frenetic
Bugbear
Posts: 806
Joined: Fri Feb 03, 2006 7:08 am

Post by Frenetic »

chibix wrote:And why now, I can't juste make an executable and use it simply. Why is it so complicated -_-.
I feel your pain. :(

chibix
Gnoblar
Posts: 8
Joined: Sun Mar 18, 2007 12:51 pm

Post by chibix »

I'll try this tonight:

http://blogs.msdn.com/nikolad/articles/427101.aspx

I seems to be a problem of manifest or something like that as described above by Samir. I already made a manifest but I'll retry again !

ELO
Gnoblar
Posts: 4
Joined: Sat Mar 31, 2007 3:57 pm

Post by ELO »

We solved this problem here by installing an updated redistribution package.

Information can be found here:
http://blogs.msdn.com/vcblog/archive/20 ... px#1397242
The file is located in folder:

C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\vcredist_x86\

I have the VS Standard Edition installed but I think it is not installed when you use the Express Edition.

In addition there is no direct link (AFAIK) from Microsoft to download this package.
Download:
http://www.apachelounge.com/download/vc ... 86-sp1.exe

Hope this is helpful.

User avatar
Samir
Halfling
Posts: 59
Joined: Sat Jun 25, 2005 12:11 pm

Post by Samir »

Sinbad already fixed the problem before releasing the final SDK...so this problem doesn't exist anymore in the latest version...

chibix
Gnoblar
Posts: 8
Joined: Sun Mar 18, 2007 12:51 pm

Post by chibix »

Thank you but i have solve the problem with a manifest.
Anyway this link is quite useful !

User avatar
AntonTheManton
Greenskin
Posts: 100
Joined: Sun Jan 14, 2007 1:47 am

Visual C++

Post by AntonTheManton »

I have been programming C++ for many years, and quite frankly, the best solution is -> do not use Microsoft Visual C++.

Microsoft maintains its own compiler - which is an absolute nightmare -> you wait until they release the next version and none of your code works any more!

The best approach is to use the GCC (GNU C Compiler) set, which includes G++.

On Windows machines this is part of a package called MinGW, which is a bit of a pain to set up, but is worth it in the end. You can then run a 'visual' environment on top - many of these are very good (eclipse, code blocks etc).

Once you are using a real compiler, your code is guaranteed to compile on any machine (Linux,Mac,ALL Windows). In this way it is much more portable, and you don't have to worry about getting locked-in to a specific version of the Microsoft compiler.

If possible, it's better to share the source code, rather than the binaries, as you know that it will compile on any machine, and it will be optimised to that machine. Although if you are distributing to non-programmers, this isn't really an option (in this case you would have to compile different versions for different machines yourself).

Not a direct answer to your problem - but it had to be said by someone.

Yogr
Gnoblar
Posts: 10
Joined: Sun Apr 01, 2007 10:50 pm

Post by Yogr »

Guys this forum rocks! I had the same problem and I solved it thanks to this thread.

My problem was that the runtime dll versions were totally screwed up! I had a manifest with version 0 dependency, my installed dlls were on version 762 and the ones on the running machine (installed using the vc2005 redinst) were on version 42!
I solved the problem copying all the runtime dlls to the applicationj folder along with the VC8 manifest with the correct dll version.

Microsoft tried to solve the "DLL Hell" nightmare, but create a bigger nightmare for the developers!

User avatar
radioman
Greenskin
Posts: 132
Joined: Sun Dec 31, 2006 3:59 pm
Location: lithuania

Post by radioman »

if any interesting 'Visual Studio Manifest solution to run your app anywhere': http://radioman.wordpress.com/2007/04/12/070412/

I have randomly crash on opengui with old version, i rebuild it with this method, and all is working perfect.

You can test it with my game sdk: http://forum.miracle-intermedia.net/viewtopic.php?t=28
peace & serenity

Post Reply