HOME  NEWS  FORUM  DOWNLOAD  LINK
OpenCOBOL - an open-source COBOL compiler
Main Menu
Download
Documentation
Development
Who's Online
12 user(s) are online (4 user(s) are browsing Forum)

Members: 0
Guests: 12

more...
Powered by
SourceForge

Xoops

Creative Commons

OpenCOBOL Forum Index
   OpenCOBOL
     Bug in cobc for MSVC: mt.exe is called too often
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
human
Posted on: 2009/9/15 15:08
Webmaster
Joined: 2007/5/15
From: GERMANY
Posts: 1416
Bug in cobc for MSVC: mt.exe is called too often
There is a small bug in cobc.c concerning the following lines
#if _MSC_VER >= 1400
	/* Embedding manifest */
	if (ret == 0) {
		if (verbose_output) {
			sprintf (buff, "mt /manifest \"%s.exe.manifest\" /outputresource:\"%s.exe\";#2", name, name);
		} else {
			sprintf (buff, "mt /nologo /manifest \"%s.exe.manifest\" /outputresource:\"%s.exe\";#2", name, name);
		}
		ret = process (buff);
		sprintf (buff, "%s.exe.manifest", name);
		cobc_check_action (buff);
	}
#endif


This is done too often, we need another check (not only ret == 0). If you have
cobc.exe -x HELLO.cob
the call of mt.exe is fine, but it should not be called when you use a precompiled C file (like used in User Manual 2.3, Dynamic C to COBOL)
cobc -x -o hello-d hello-dynamic.obj

In the 2nd case there is no manifest, therefore mt.exe fails.

human
simrw
Posted on: 2009/9/16 10:12
Webmaster
Joined: 2005/5/31
From: Bad Soden, Germany
Posts: 791
Re: Bug in cobc for MSVC: mt.exe is called too often
Looks to me like the "identity" is wrong.
I think those "#2" should be "#1".
What status/error does mt report?

Roger
human
Posted on: 2009/9/16 10:29
Webmaster
Joined: 2007/5/15
From: GERMANY
Posts: 1416
Re: Bug in cobc for MSVC: mt.exe is called too often
As I wrote before the first one with -x works fine, but at the 2nd one there is no manifest at all why mt.exe complains about missing manifest (the .exe itself works fine).

human
simrw
Posted on: 2009/9/16 13:24
Webmaster
Joined: 2005/5/31
From: Bad Soden, Germany
Posts: 791
Re: Bug in cobc for MSVC: mt.exe is called too often
What happens when you change as I suggested?
In those calls to "mt", change the ;#2 to ;#1.

Roger
ska
Posted on: 2009/9/16 14:53
Just can't stay away
Joined: 2008/3/17
From: NYC
Posts: 145
Re: Bug in cobc for MSVC: mt.exe is called too often
Quote:
human wrote:
If you have
cobc.exe -x HELLO.cob
the call of mt.exe is fine, but it should not be called when you use a precompiled C file
cobc -x -o hello-d hello-dynamic.obj

In the 2nd case there is no manifest, therefore mt.exe fails.
human


It must be called.
There is manifest and I don't see mt.exe failing:


G:\open-cobol\build_windows\test>cobc -x -o hello-d -v hello-dynamic.obj
cl /MD /Fe"hello-d"  "hello-dynamic.obj"  g:\open-cobol\build_windows\win32\debug\libcob.lib g:\open-cobol\build_windows\win32\gmp.lib
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86

Copyright (C) Microsoft Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 8.00.50727.762
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:hello-d.exe
hello-dynamic.obj
g:\open-cobol\build_windows\win32\debug\libcob.lib
g:\open-cobol\build_windows\win32\gmp.lib
mt /manifest "hello-d.exe.manifest" /outputresource:"hello-d.exe";#2
Microsoft (R) Manifest Tool version 5.2.3790.2075
Copyright (c) Microsoft Corporation 2005.
All rights reserved.


Manifest is necessary. I saw exe not running correctly but actually more problems are with DLLs - they could just quietly run incorrectly


----------------
Regards,
Sergey

human
Posted on: 2009/9/16 15:31
Webmaster
Joined: 2007/5/15
From: GERMANY
Posts: 1416
Re: Bug in cobc for MSVC: mt.exe is called too often
In general mt.exe is VERY necessary when using MSVC >= 8.

There's no difference in using #1 and #2.

Original version "cobc.exe -x HELLO.cob -v", Quote:
calling: mt /manifest "HELLO.exe.manifest" /outputresource:"HELLO.exe";#2
Microsoft (R) Manifest Tool version 5.2.3790.2076
Copyright (c) Microsoft Corporation 2005.
All rights reserved.
Exit code from call: 0


Original version "cobc -x -o hello-d hello-dynamic.obj -v", Quote:
calling: mt /manifest "hello-d.exe.manifest" /outputresource:"hello-d.exe";#2
Microsoft (R) Manifest Tool version 5.2.3790.2076
Copyright (c) Microsoft Corporation 2005.
All rights reserved.

hello-d.exe.manifest : general error c1010070: Failed to load and parse the manifest.
Exit code from call: 31


New version "cobc.exe -x HELLO.cob -v", Quote:
calling: mt /manifest "HELLO.exe.manifest" /outputresource:"HELLO.exe";#1
Microsoft (R) Manifest Tool version 5.2.3790.2076
Copyright (c) Microsoft Corporation 2005.
All rights reserved.
Exit code from call: 0


New version "cobc -x -o hello-d hello-dynamic.obj -v", Quote:
calling: mt /manifest "hello-d.exe.manifest" /outputresource:"hello-d.exe";#1
Microsoft (R) Manifest Tool version 5.2.3790.2076
Copyright (c) Microsoft Corporation 2005.
All rights reserved.

hello-d.exe.manifest : general error c1010070: Failed to load and parse the manifest.
Exit code from call: 31


All four are working. It seems like there is no need for mt.exe if there is no preprocessing/translating done by OC AND MSVC 2008 is used. Is there a possibility to know this and to not call mt.exe in this case?

human
simrw
Posted on: 2009/9/16 15:59
Webmaster
Joined: 2005/5/31
From: Bad Soden, Germany
Posts: 791
Re: Bug in cobc for MSVC: mt.exe is called too often
Actually, I think the prob is with MSVC 8. The clue is in the version of the mt tool. That's from an earlier
MSVC version. According to some reports I looked at on the web, MSVC 8 does not have a mt.exe ?

What now?

Roger
human
Posted on: 2009/9/16 17:09
Webmaster
Joined: 2007/5/15
From: GERMANY
Posts: 1416
Re: Bug in cobc for MSVC: mt.exe is called too often
Ska, did you tried to use a precompiled C file (like used in User Manual 2.3, Dynamic C to COBOL)
cobc -x -o hello-d hello-dynamic.obj

There is no manifest generated from cl.exe Version 9 (=MSVC 2008) when you have this special case. Is this different with MSVC 8?


human


BTW: I use MSVC 9 Express (_MSC_VER = 1500), ska seems to use MSVC 8 (_MSC_VER = 1400). Maybe the mt.exe was not shipped with MSVC 8 Express (if it wasn't shipped it could be downloaded with SDK), but is clearly shipped with MSVC 8.
What I find interesting is the version of mt.exe. The one of ska and mine seems to be nearly the same.
ska
Posted on: 2009/9/16 19:38
Just can't stay away
Joined: 2008/3/17
From: NYC
Posts: 145
Re: Bug in cobc for MSVC: mt.exe is called too often
Quote:
human wrote:
Ska, did you tried to use a precompiled C file


Sure I did
VS2008:

G:\open-cobol\build_windows\test>cl /c -I g:\open-cobol\build_windows\.. -I g:\open-cobol\build_windows\win32 -Ig:\open-cobol\build_windows  /MD /Fo"hello-dynamic.obj" hello-dynamic.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

hello-dynamic.c

G:\open-cobol\build_windows\test>cl /Od /MD /Fe"hello-d"  "hello-dynamic.obj"  g:\open-cobol\build_windows\win32\debug\libcob.lib g:\open-cobol\build_windows\win32\gmp.lib
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 9.00.21022.08
Copyright (C) Microsoft Corporation.  All rights reserved.

/debug
/out:hello-d.exe
hello-dynamic.obj
g:\open-cobol\build_windows\win32\debug\libcob.lib
g:\open-cobol\build_windows\win32\gmp.lib


manifest produced - hello-d.exe.manifest

<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level='asInvoker' uiAccess='false' />
      </requestedPrivileges>
    </security>
  </trustInfo>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type='win32' name='Microsoft.VC90.CRT' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
    </dependentAssembly>
  </dependency>
</assembly>



----------------
Regards,
Sergey

ska
Posted on: 2009/9/16 19:51
Just can't stay away
Joined: 2008/3/17
From: NYC
Posts: 145
Re: Bug in cobc for MSVC: mt.exe is called too often
Quote:
human wrote:
What I find interesting is the version of mt.exe. The one of ska and mine seems to be nearly the same.


I have like 7 or 8 mt.exe, some of different sizes, but most of them report version 5.2.3790.2075

There is no mt.exe inside VS2008 directory tree.
But cl from VS2008 generates manifest file.

I don't know if its embedding is required for VS2008.


----------------
Regards,
Sergey

(1) 2 »
Threaded | Newest First Previous Topic | Next Topic | Top

Register To Post
 
Copyright (C) 2005 The OpenCOBOL Project. All rights reserved.
Powered by Xoops2 | PHP | MySQL | Apache
ocean-net