[mercury-users] csharp top_level.exe [was: csharp grade error in mdb.browse.cs]

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Dec 20 17:02:09 AEDT 2010

>> On Sat, 18 Dec 2010, Jeff Thompson wrote:
>>> On 12/7/2010 5:07 PM, Peter Wang wrote:
>>>> Now to Windows. I did change the PATH to put the Mercury bin
>>>>> directory in front of the Windows system directory.  At the command
>>>>> prompt, when I type "mmc" it invokes the compiler, but internally
>>>>> top_level.exe is still invoking the Microsoft Management Console. I
>>>>> don't know if this is some Windows Vista magic that can't be
>>>>> overridden.
>>>> I'm not sure why mmc is called at all.  When MERCURY_COMPILER is set, it
>>>> should be invoked directly.  Perhaps, on Windows or .NET, the new
>>>> process doesn't inherit the environment from the parent process.
>>>> The MSDN documentation for System.Diagnostics.Process.Start is silent on
>>>> this point.
>>>> The conflict with Microsoft Management Console has been annoying for a
>>>> long time.  I think we should provide an ambiguous synonym, e.g.
>>>> mercury_mmc.
>>> I tried to compile hello_world in Windows with the "mercury.bat" supplied 
>>> with the distribution which I modified to use the .NET top_level.exe. 
>>> Some success. It seems to invoke the compiler, but it gives this error:
>>> C:\mercury>mercury -v --csharp -m hello_world
>>> ** Error: error reading file `builtin.m' to generate dependencies.
>>> ** Module `builtin' is imported or included by module `hello_world'.
>>> mercury_compile: cannot find source for module `builtin' in directories .
>>> In Linux, how does mercury know where to find "builtin", etc. without 
>>> needed to rebuild them?
>> The compiler uses the the environment variables MERCURY_CONFIG_DIR and
>> MERCURY_STDLIB_DIR to determine where its configuration files and
>> libraries are installed.  (These should be set in mercury.bat, or if
>> on Linux etc in the mmc script.)
>> The above message is usually an indication that the library is either
>> not installed in the selected grade or that the library installation
>> cannot be found.
> Given the following code in prog_io.m, it seems that the error message should 
> list out the Dirs that it tried to search, but the list is empty. I made the 
> compiler give the same error on my Solaris box (where Mercury is working 
> great) and Dirs is also empty in the error message.  Do I need a compiler 
> switch so that it will display the Dirs it searches?

It should display the directories it is searching.  The fact that the
list is empty indicates that the compiler doesn't know where to find the
standard library (since in a correctly built installation, that at least
should be present).  This could be for a number of reasons:

(1) the library is not installed or is not installed in the grade
you are attempting to use.

(2) the mercury.bat or Mercury.config files are pointing to a different
installation location from the one in which the stdlib is actually installed.
(Mercury.config in INSTALL_PREFIX/lib/mercury/conf.)

(3) perhaps the handling of environment variables is buggy in the
C# grade.

What, if any, grades does the compiler report as being installed
if you use the --output-libgrades option?

To rule out (3), you could try setting the stdlib dir using
the --mercury-stdlib-directory option.

mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au

More information about the users mailing list