You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Stefan Bodewig <bo...@apache.org> on 2003/08/06 12:10:51 UTC

and Mono (was Re: cvs commit: ant/src/etc/testcases/taskdefs/optional dotnet.xml)

On Tue, 05 Aug 2003, Steve Loughran <st...@iseran.com> wrote:

> I see the default references are going to be trouble.

More trouble than I had expected.

After making sure that there was no trailing ; I get this here

[...]
      [csc] /usr/lib/System.dll is out of date
      [csc] /usr/lib/corlib.dll is out of date
      [csc] working from source directory /home/bodewig/ASF/jakarta/jakarta-ant/src/etc/testcases/taskdefs/optional
      [csc] /home/bodewig/ASF/jakarta/jakarta-ant/src/etc/testcases/taskdefs/optional/dotnet/example.cs is out of date
      [csc] /home/bodewig/ASF/jakarta/jakarta-ant/src/etc/testcases/taskdefs/optional/dotnet/example2.cs is out of date
      [csc] compiling 2 files
[... SNIPPED ...]
      [csc] error CS0518: The predefined type `System.Object' is not defined

and so on.

First, obviously the /reference argument is not doing what I (being
the C# neophyte I am) thought it would do (you describe it as
CLASSPATH equivalent) - as its content is considered as something that
may need a recompilation.

When I drop the /nostdlib+ generated by
includedefaultreferences="false", I get rid of these errors but the
compilation fails as mcs now tries to write to the .dlls and fails (no
permission to do so, of course).

If I now also remove the /reference argument, things go OK until I hit

error CS5001: Program /home/bodewig/ASF/jakarta/jakarta-ant/src/etc/testcases/taskdefs/optional/dotnet/build/ExampleCsc.exe does not have an entry point defined

which is quite close to what I'd expect from the task to emit as well.
I think this is a second problem that we can try to solve later.

Now the main problem is that includedefaultreferences does two things,
it controls the /nostdlib argument and it also controls an implicit
set of references that will be added as argument.  For Mono we do not
want the second part as it references assemblies not present there.

I feel a new attribute is getting close.  adddefaultreferences that by
default takes the same value as includedefaultreferences?

(best viewed with a non-proportional font 8-)

adddefaultreferences | includedefaultreferences | effect
=====================================================================
true                 | true                     | /nostdlib+ and
                     |                          | implicit /reference
---------------------------------------------------------------------
true                 | false                    | /nostdlib- but
                     |                          | implicit /reference
---------------------------------------------------------------------
false                | true                     | /nostdlib+ and no
                     |                          | implicit /reference
---------------------------------------------------------------------
false                | false                    | /nostdlib- and no
                     |                          | implicit /reference

I don't think the second line makes sense, but anyway.  Mono users
would then use the third combination.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: and Mono (was Re: cvs commit: ant/src/etc/testcases/taskdefs/optional dotnet.xml)

Posted by Steve Loughran <st...@iseran.com>.
Stefan Bodewig wrote:

> On Wed, 06 Aug 2003, Steve Loughran <st...@iseran.com> wrote:
> 
> 
>>yup. We either want no refs, or we want the mono refs.
> 
> 
> With /nostdlib+ and Mono refs it doesn't work (Mono tries to open the
> refs in read/write mode, no idea why).  So in the case of Mono I'd
> vote for no refs.

OK

> 
> 
>>I was thinking of something different,
> 
> 
> As you understand the .NET area and I don't, at least not yet, please
> go ahead and use me and my Linux setup as the Mono guinea pig.

I have mono on a box here too.

> 
> 
>>1. drop all predefined references the moment you name an executable
>>on the command line.
> 
> 
> Won't that cause a backwards compatibility problem?

no, because we didnt let people name an executable until last week.

> 
> 
>>How can I say <fileset path="${env.PATH}" includes="System.dll"/>
> 
> 
> Similar to how <extdirs> is handled in <javac>?  I.e. add a Path
> nested element and make the task create filesets from it - fall back
> to env.PATH or env.Path if the user doesn't specify a path?
> 
> On Linux it doesn't seem to use PATH but either something that's
> hardcoded inside of Mono or the dynamic linker architecture (as it
> picks up the .dlls from /usr/lib for me).  "strings mono" doesn't give
> any clues to me.  I'd probably simply have to read the documentation
> to know 8-)




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: and Mono (was Re: cvs commit: ant/src/etc/testcases/taskdefs/optional dotnet.xml)

Posted by Steve Loughran <st...@iseran.com>.
Stefan Bodewig wrote:
> On Thu, 07 Aug 2003, Steve Loughran <st...@iseran.com> wrote:
> 
> 
>>Does it work?
> 
> 
> Yes
> 
> testCSC-Mono:
>       [csc] compiling 2 files
>       [csc] WROTE SYMFILE: 2 sources, 2 methods, 3 types, 4 line numbers, 0 locals, 2 namespaces, 247 bytes of string data
>       [csc] OffsetTable [639 - 52:515 - 2:591:48 - 2:567:24 - 3]
>       [csc] Compilation succeeded
> 
>      [exec] hello, I look like Java, but I'm really .NET
> 
>    [delete] Deleting: /home/bodewig/ASF/jakarta/jakarta-ant/src/etc/testcases/taskdefs/optional/dotnet/build/ExampleCsc.exe
> 
> testCSC-MS:
> 
> testCSC:
> 
> BUILD SUCCESSFUL
> Total time: 7 seconds
> 
> after changing the <exec> to invoke "mono", that is.

Ahh. I have wine on my box, which does auto-run PE executables. It must 
have been trying to run the exe


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: and Mono (was Re: cvs commit: ant/src/etc/testcases/taskdefs/optional dotnet.xml)

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 07 Aug 2003, Steve Loughran <st...@iseran.com> wrote:

> Does it work?

Yes

testCSC-Mono:
      [csc] compiling 2 files
      [csc] WROTE SYMFILE: 2 sources, 2 methods, 3 types, 4 line numbers, 0 locals, 2 namespaces, 247 bytes of string data
      [csc] OffsetTable [639 - 52:515 - 2:591:48 - 2:567:24 - 3]
      [csc] Compilation succeeded

     [exec] hello, I look like Java, but I'm really .NET

   [delete] Deleting: /home/bodewig/ASF/jakarta/jakarta-ant/src/etc/testcases/taskdefs/optional/dotnet/build/ExampleCsc.exe

testCSC-MS:

testCSC:

BUILD SUCCESSFUL
Total time: 7 seconds

after changing the <exec> to invoke "mono", that is.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: and Mono (was Re: cvs commit: ant/src/etc/testcases/taskdefs/optional dotnet.xml)

Posted by Steve Loughran <st...@iseran.com>.
Stefan Bodewig wrote:
> On Wed, 06 Aug 2003, Steve Loughran <st...@iseran.com> wrote:
> 
> 
>>yup. We either want no refs, or we want the mono refs.
> 
> 
> With /nostdlib+ and Mono refs it doesn't work (Mono tries to open the
> refs in read/write mode, no idea why).  So in the case of Mono I'd
> vote for no refs.
> 
> 
>>I was thinking of something different,
> 
> 
> As you understand the .NET area and I don't, at least not yet, please
> go ahead and use me and my Linux setup as the Mono guinea pig.
> 
> 
>>1. drop all predefined references the moment you name an executable
>>on the command line.
> 
> 
> Won't that cause a backwards compatibility problem?
> 

Added a new reference that controls stdlib include/exclude. I've left 
the old one still in there, but am reasonably sure that we could cut the 
old behaviour out on default references and nothing would break (as 
excluding the stdlib is so drastic, I doubt anyone does it)

Does it work? No, not yet. And /home/slo becomes drive F:

testCSC-Mono:
       [csc] compiling 2 files
      [exec] fixme:win32:PE_CreateModule Unknown directory 14 ignored
      [exec] err:module:import_dll Module (file) mscoree.dll (which is 
needed by
F:\Java\Apache\ant\src\etc\testcases\taskdefs\optional\dotnet\build\ExampleCsc.e
xe) not found

Drive F. Hmmm. Maybe the CLR has assumptions about drive letters built 
in from the beginning -so its easier to flow with the design defect than 
it is is to correct it.

-steve


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: and Mono (was Re: cvs commit: ant/src/etc/testcases/taskdefs/optional dotnet.xml)

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 06 Aug 2003, Steve Loughran <st...@iseran.com> wrote:

> yup. We either want no refs, or we want the mono refs.

With /nostdlib+ and Mono refs it doesn't work (Mono tries to open the
refs in read/write mode, no idea why).  So in the case of Mono I'd
vote for no refs.

> I was thinking of something different,

As you understand the .NET area and I don't, at least not yet, please
go ahead and use me and my Linux setup as the Mono guinea pig.

> 1. drop all predefined references the moment you name an executable
> on the command line.

Won't that cause a backwards compatibility problem?

> How can I say <fileset path="${env.PATH}" includes="System.dll"/>

Similar to how <extdirs> is handled in <javac>?  I.e. add a Path
nested element and make the task create filesets from it - fall back
to env.PATH or env.Path if the user doesn't specify a path?

On Linux it doesn't seem to use PATH but either something that's
hardcoded inside of Mono or the dynamic linker architecture (as it
picks up the .dlls from /usr/lib for me).  "strings mono" doesn't give
any clues to me.  I'd probably simply have to read the documentation
to know 8-)

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: and Mono (was Re: cvs commit: ant/src/etc/testcases/taskdefs/optional dotnet.xml)

Posted by Steve Loughran <st...@iseran.com>.
Stefan Bodewig wrote:
> On Tue, 05 Aug 2003, Steve Loughran <st...@iseran.com> wrote:
> 
> 
>>I see the default references are going to be trouble.
> 
> 
> More trouble than I had expected.
> 
> After making sure that there was no trailing ; I get this here
> 
> [...]
>       [csc] /usr/lib/System.dll is out of date
>       [csc] /usr/lib/corlib.dll is out of date
>       [csc] working from source directory /home/bodewig/ASF/jakarta/jakarta-ant/src/etc/testcases/taskdefs/optional
>       [csc] /home/bodewig/ASF/jakarta/jakarta-ant/src/etc/testcases/taskdefs/optional/dotnet/example.cs is out of date
>       [csc] /home/bodewig/ASF/jakarta/jakarta-ant/src/etc/testcases/taskdefs/optional/dotnet/example2.cs is out of date
>       [csc] compiling 2 files
> [... SNIPPED ...]
>       [csc] error CS0518: The predefined type `System.Object' is not defined
> 
> and so on.
> 
> First, obviously the /reference argument is not doing what I (being
> the C# neophyte I am) thought it would do (you describe it as
> CLASSPATH equivalent) - as its content is considered as something that
> may need a recompilation.
> 
> When I drop the /nostdlib+ generated by
> includedefaultreferences="false", I get rid of these errors but the
> compilation fails as mcs now tries to write to the .dlls and fails (no
> permission to do so, of course).

what seemed a good idea of (a) having a predefined set of inclusions, 
and (b) having the turn-off-inclusions do two things, was clearly a 
mistake. Sorry.

> 
> If I now also remove the /reference argument, things go OK until I hit
> 
> error CS5001: Program /home/bodewig/ASF/jakarta/jakarta-ant/src/etc/testcases/taskdefs/optional/dotnet/build/ExampleCsc.exe does not have an entry point defined
> 
> which is quite close to what I'd expect from the task to emit as well.
> I think this is a second problem that we can try to solve later.

that's cool, that's just a no-main eror.

> 
> Now the main problem is that includedefaultreferences does two things,
> it controls the /nostdlib argument and it also controls an implicit
> set of references that will be added as argument.  For Mono we do not
> want the second part as it references assemblies not present there.

yup. We either want no refs, or we want the mono refs.

> 
> I feel a new attribute is getting close.  adddefaultreferences that by
> default takes the same value as includedefaultreferences?
> 
> (best viewed with a non-proportional font 8-)
> 
> adddefaultreferences | includedefaultreferences | effect
> =====================================================================
> true                 | true                     | /nostdlib+ and
>                      |                          | implicit /reference
> ---------------------------------------------------------------------
> true                 | false                    | /nostdlib- but
>                      |                          | implicit /reference
> ---------------------------------------------------------------------
> false                | true                     | /nostdlib+ and no
>                      |                          | implicit /reference
> ---------------------------------------------------------------------
> false                | false                    | /nostdlib- and no
>                      |                          | implicit /reference
> 
> I don't think the second line makes sense, but anyway.  Mono users
> would then use the third combination.

I was thinking of something different, now that there is a <references> 
fileset in the task.

1. drop all predefined references the moment you name an executable on 
the command line. So only the stdlib goes in, the rest are missing

2. fix up the IsManagedExecutable() test to look at the flag in the PE 
header that says 'we are managed code'. I'd need to write a win32 app to 
  calculate the offset from winnt.h definitions, but then its easy.

3. have people include references that *somehow* refer to the files in 
version of .net they are building against.
<references dir="D:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\ 
includes="*.dll">

I dont see an env variable on windows that points to the current version 
of .net, and you cannot hard code it. When you include stuff without 
giving a full path, the compiler searches the path. How can I say 
<fileset path="${env.PATH}" includes="System.dll"/>







---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org