Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Ximian

Mono's MCS Compiles Itself On Linux 216

thing12 writes "On Thursday Paolo Molaro announced that he had managed to build the MCS C# compiler using MCS. This is a big step forward for Mono, as it means that Mono is almost a self hosting environment."
This discussion has been archived. No new comments can be posted.

Mono's MCS Compiles Itself On Linux

Comments Filter:
  • Seems they have managed to take yet another step since this slashdot article [slashdot.org].
    • This seems to be just a repost of that article... Or is there some change I'm missing?
    • by Jabes ( 238775 ) on Monday March 11, 2002 @05:04AM (#3141707) Homepage
      For those that don't understand the difference. Two months ago, the mcs was able to compile itself on Windows, using the Microsoft implementation of the framework (ie the core .net libraries).

      Now MCS is able to compile itself using the mono runtime.

      Hope this helps

      • Hope this helps

        Not entirely.... I've been following this, and I wasn't aware that a runtime environment had been developed for Linux. Is this correct? The announcement doesn't enlighten much with all its talk of mint and so on. Mint, then, is the counterpart for the JVM for Linux? And it can run the C# "executable"?
        • yup 'mint' is the Mono Interpreter. Here's the process that works so far:
          • Use microsoft tools on windows to compile the mono compiler into a .NET exe.
          • Run that .NET exe (mcs) under mint on linux using the mono class libraries to generate another version of mcs.
          Unfortunately the linux-built version of mcs doesn't quite run yet, but I believe it's close to dogfood.
  • by Linux Freak ( 18608 ) on Monday March 11, 2002 @04:31AM (#3141630) Homepage
    The release does mention that MCS could be compiled, but that the resultant executable immediately crashes. Close, but still more work is needed before this is really an exciting milestone.

    Kudos to the Mono team for the work they've done so far, however.
    • by jsse ( 254124 ) on Monday March 11, 2002 @05:19AM (#3141742) Homepage Journal
      The release does mention that MCS could be compiled, but that the resultant executable immediately crashes.

      Isn't it the expected outcome? It's considered done!
    • That's sort of like saying "well, the Wright brothers' airplane only few for a minute or so. Close, but still more work is needed before this is really an exciting milestone"

      It's a heck of a milestone. Of course it's not useful yet, but they're not claiming it is.
      • The better analogy would be "The Wright Brother's airplane almost took off!" or "Armstrong nearly stepped on the Moon!". Its not a milestone before its passed, only even if an inch is lacking.
        • no it is more like "The Wright Brother's airplane took off but couldn't stay in flight!" or ARmstrong stepped on the Moon, but couldn't live there perminently."

    • MCS could be compiled, but that the resultant executable immediately crashes.

      I guess it's sort of like that classic definition of a species: it's not enough for the creature simply to be able to reproduce -- the offspring has to be fertile as well!

    • I don't think that this really counts as "compiling itself". IIRC, the gcc compilation instructions describe compiling gcc, and then using gcc to compile itself, and comparing the two compiles' outputs to make sure that they are the same.

      So, compiling on Linux is good. But a build of the compiler doesn't really count as stable unless you can compile it with itself and find that it generates the same output.

  • Lol, you guys sure have a short memory. This article was posted two months ago, here [slashdot.org].

    If this was in fact news though, I'd mention that this will bring more linux developers to mono, thanks to there being a compiler for it that isn't just for .NET.
  • by gokulpod ( 558749 )
    According to what previous articles said, I can guess RMS may not be too happy with this. Any idea, what happened to the election for Gnome Board. RMS was fighting for it in order to counter the Mono threat. Poor guy already had his hands full of Microsoft when this comes along.
  • by Anonymous Coward
    I don't understand much about technology or Linux, and I don't follow it too closely. So can someone tell me what is the point of having a program self compiling? It looks to me its mainly for show and not very useful, not something I thought was common in the Open Source community.

    Lately I have been feeling isolated while reading Slashdot. Not knowing all the common abbreviations and whatnot. Try to explain more about things instead of believing everyone already knows everything. I think Slashdot should try to adapt more to the newbie instead of only to the veteran.
  • What came first - the chicken or the egg? Well in this case it was the monkey :o)

    I think this is great work from the Mono team. They've passed one of the biggest hurdles in implementing a compiler. At university we have been using Java in situations where they *could* have made us use c#. If in the future they do say "we want you to use c#", I can happily stay on my linux box and use it. It's always good news when there's yet another thing that Linux can do just as well as MS.
    • What came first - the chicken or the egg?

      Actually, there exists a correct answer, but to understand it you must understand the question first.

      Evolution is the key.

  • by vojtech ( 565680 ) <vojtech@suse.cz> on Monday March 11, 2002 @05:49AM (#3141773)
    The slashdot headline misses the important part
    of the story, the fact that they compiled C# using MCS on *Linux*, using the Linux runtime, as opposed to doing this on Windows, which was done
    about two months ago.
    • Yeah, I probably should have mentioned the difference between then and now in the content of the story. This really is a huge milestone for them - going forward they no longer need any Microsoft tools. C# is a great language, it's fast and flexible - it fills the gap between C and Perl nicely. And while it may be the bastard cousin of Java, I think it's got a much more polished feel to it. Being developed under Microsoft's wing wasn't the best, but at least now it's an ECMA standard, not owned by any company - much less Sun whose position on open source sways like trees in the wind.
  • ... and you know it.

    how else should a microsoft compiler be compiled under linux? its the work of satan manifesting itself again before good old jesus comes to town and wipes us all out? i amm 100% sure that soon we will see cats hunting after dogs, fishes fly and steve ballmer talking backwards (ok he allready does that).

    get your girl or boyfriend and make some love before our whole planet explodes. and yes, the story about america planning to use nuclear bombs against 'terrorists' has something to do with.

    --

    STOP THE GENOCIDE! RMS cut your HAIR!
  • by jsse ( 254124 ) on Monday March 11, 2002 @06:10AM (#3141792) Homepage Journal
    The bad news is that the compiled mcs crashes, because some field tokens are wrong and this confuses the runtime (we still don't have a verifier,hint, hint).

    Boy, we need to implement BSOD for this, hint, hint.
  • So... (Score:1, Funny)

    by Anonymous Coward
    I've read the mono FAQ and rationale and... I still don't understand why I should care about this. Some of it is the lack of details - like they mention garbage collection but don't mention if memory can still be manually freed (something akin to Obj-C on Darwin seems best). Some of is that it isn't scheduled to run on my system (OS X). This really doesn't seem like much more of a solution to any issue than is already available via Java, Corba and other means. Oh well, I guess this is the constant question for this project and I should look through the archives, though I suppose if it was answered to my satisfaction I would remember it. And as is tradition, I must mention the "hope Sun learns a lesson and makes Java a public standard" sentiment (and please don't mention their fucking joke called the "Java Community Process" - only $5000 [jcp.org] and I can have input on more than one API, yay!)
    • Yes, you can do your own memory management if you want (there are various degrees in which you do this, either through the "Disposable" pattern, or by completely rolling your own, using unmanaged code).

      It is not on the FAQ as this is more of a CIL core question, rather than being a question about the Mono project itself (which is an implementation of the CIL).

      Miguel.
  • Great News (Score:2, Interesting)

    by nervlord1 ( 529523 )
    C# is an incredibly good laungage

    I'm far from a microsoft fan, my entire career depends on my unix admin skills, but being a dabbeler in programming (mostly procedual stuff) has really opened my eyes on programming in general, and c# is an EXCELLENT object oreintated language, as soon as i picked up a little c#, object oreintation just started to make sense, i had difficulty with it before in c++ but now the peices fall into place.
    Combine this with the excellent garbage collector features, and EXTREMLY easy to use GUI designer (just as easy as visual basic) and ability to import code from other languages and use it combines to make C# a great language, I for one am extremly happy gnome is supporting it and hope you all give it a try. Tell me what you think.

    Anyone in the perth area is welcome to email me(arevill@bigpond.net.au) and ill give you a little tour :)
    • Well, you had Java before that... Can't really see the big diff. C# is just MS old Java compiler tweaked a bit.
      Mind you, don't mind C# being implemented for Linux/unix, can't do any harm, and as you say, seems to be quite nice lang.
    • I have to agree with you on this. I was shocked and amazed to find myself liking C# as I was trying it out. The Java -> C# learning curve in negligable once you locate the .NET class docs in the MSDN collection.
      • by alext ( 29323 )
        The Java -> C# learning curve in negligable [sic]

        Good heavens, what a coincidence. Yet strangely C# is 'shocking', 'amazing' and 'excellent' whereas Java is...? The same weight as a duck, perhaps?
        • If you recall, the C++ -> Java learning curve was pretty easy -- one of the major factors in Java's quick acceptance -- and yet Java offered all kinds of great improvements over C++.

          C# will be easy to learn for both C++ and Java programmers for the same reason Java was easy for C++ programmers. And, it has some wonderful advantages over both for client side GUI programming.

          • I'm so glad you agree that Java offered so many improvements over C++.

            However, I can't help noticing that you've not gone so far as to enumerate the equally scintillating improvements that C# offers over Java. Client-side GUI programming? Sounds very exciting...
            • Java is definitely a major improvement over C++ in many ways for app developers. I'm a big fan, and I use it daily on the server for Web apps.

              As for enumerating equally scintillating improvements that C# offers over Java, that's a red herring. It's not a necessary condition for C-B to equal B-A in order for it to be true that C>B.

              Even so, it may be that big an improvement, depending on what you need to do. If you want a laundry list, go look it up. A short list though is:

              -- Programmers love working in Java, and customers love using native apps written in C++. The ability to work in a language that's as fun as Java and as well-liked by customers as C++ is...scintillating. Neither C++ nor Java can offer both.

              -- Full-powered, native C++-like apps that can be run in a browser. The Java concept of just-in-time apps running in a browser is too good an idea not to succeed. It's looking as though C#, not Java, will end up delivering full-powered, native, browser-based apps -- at least on Windows. My hope is that Mono, Rotor, etc., can extend this to other platforms as well.

              -- Native compilation can be done before it even goes out the door, so much harder to reverse engineer than bytecode. Sun's answer for years: "anything can be reverse engineered" (which makes me wonder why they still lock the doors to their buildings), or "just keep the important code on the server", which is the sort of answer I would expect from a company that has never had a successful client-side product.

              -- Lots of little goodies brought over from Perl and C like enums, foreach, structs, verbatim strings.... So many of us have asked for these things to be added to Java only to have Sun tell us no, or "you don't get it", or "it's too dangerous", or "it's just syntactic sugar", or "if you want to use Perl, just use Perl", etc. C# says, okay, here you go.

              -- You can mix components written in different languages as easily as components written in the same language. Java is working to retrofit that sort of capability, but it will always be an afterthought.

              -- The language is designed with lots of features that make it an easy fit with real visual IDEs. Languages like C++ and Java can be treated this way, but it's an awkward fit for them. Most of us just end up working in straight text (code) mode all the time with them. The natural way to create GUI apps is with a GUI IDE, though, and C# is made for it (properties, attributes, etc.).

    • as soon as i picked up a little c#, object oreintation just started to make sense, i had difficulty with it before in c++ but now the peices fall into place

      Never tried ObjC I take it?


      The one good thing I've seen in all of this so-called ".NET" is the language-agnosticism technic. Some of that is very handy, and actually almost new (not really, if you follow academic CS this stuff has been coming for awhile, but MS does deserve credit for implementing a few things first for once) and very slick. But the rest of it... are you familiar with the term "trojan horse"? :)

    • Re:Great News (Score:2, Interesting)

      by seizer ( 16950 )
      Do you know WHY it's an "incredibly good language"? They've ripped off Java to an astonishing extent. The only thing they have that Java doesn't really, is a pretty flashy IDE with said GUI builder (though I hear JBuilder is pretty good).

      Honestly. Compare the APIs. Tell me MS didn't model C# on Java.
      • > The only thing they have that Java doesn't really, is a pretty flashy IDE with said GUI builder

        Personally, I think this is a significant bonus. IMO, VS.NET's IDE is superb. I didn't much care for JBuilder or VisualAge in comparison. VS.NET is expensive as hell, but I think it's a nice product and doesn't really care what language you code in (with addons).

        You're right - they did "steal" a lot from Java, but I like to think of it as learning from a prior generation's mistakes...
      • Re:Great News (Score:3, Informative)

        by Jhan ( 542783 )

        Of course they modeled it on Java.

        Unfortunately, they did more than this. They fixed a number of things that Java developers have screamed at Sun since day one, but which cannot be introduced into Java at this late day.

        Example 1: Boxing

        int i=17;

        String s=i.toString();
        i=String.valueOf(s);

        OR

        ArrayList al=new ArrayList();
        int i=4711;
        al.add(i);

        Example 2: Simple(r) component creation.

        Can't think of any more right now, but boxing in and of itself is good enough :-)

        Oh yeah, C++ style type/class conversions.

        • They fixed a number of things that Java developers have screamed at Sun since day one, but which cannot be introduced into Java at this late day.


          Is there a reason why boxing couldn't be added to Java? It seems like it could be done with some compiler additions to automatically create object wrappers around the primitive types and vice versa when needed. The compiler already knows the types of primitives, so if you write "int i=foo(); array.add(i);" it should just be able to turn the second statement into "array.add(new Integer(i));". Ditto for unboxing; the compiler could just transparently insert intValue() (or floatValue() or whatever) calls when you assign a Number subclass to a primitive type. Of course, I've only thought about this for about 2 minutes so I could be completely wrong...

    • C# : a piece from java! nothing new just a clone of java. they just want to root out!
  • I still think it's a shame Mono has gone off doing C# when the analogous project based on Java would already be much further along--there are several free, open source Java compilers, a good open source JIT from Intel, and lots of library code. Furthermore, such a Java project could have started several years ago, when the Gnome crowd was still claiming that anything other than plain C was just not suitable for writing applications or GUIs in.

    It looks like the Mono project still has a couple of years of work ahead of them until they get to a reasonably full features C# implementation. Let's hope it's worth it.

    • by Anonymous Coward
      I still think it's a shame Mono has gone off doing C# when the analogous project based on Java would already be much further along

      I think it's a shame that do-nothing armchair language critiques who do not contribute to free software can air their useless uninformed opinions and pine about "what could have been" only if someone else did the work.
      There are many open source Java vitrual machine and library projects - stop bitching and moaning and start contributing to one of them, you lazy bastard!
    • by Anonymous Coward
      I'm sorry, C# seems like it will be better than Java.

      From the beginning C# has been made to be natively compiled if desired and that means speed. Even GCJ generates large and slow code (compared to say, O'Caml).

      In my own testing I've found O'Caml to be not much slower than C, even with array bounds checking turned on, that's quite impressive. I've been programming in functional languages for some time now and I haven't decided if I like them better than C-like imperative languages. To me functional languages cater to the computer (or algorithm) and not the programmer. I think both styles are good for certain things but generally an imperative language is easier to program in for non-math/algorithm experts.

      If C# can have the speed of O'Caml but with an imperative, C-like programming style, then I think we'll have a winner.

      My perfect language would be a type-safe, bounds-safe, inferencing, C-like language with OO extensions (but not go off the deep end of OO like C++ did). And it should create programs that run at the same speed as C (or real close). In other words, I want O'Caml with a C-like syntax.
      • From the beginning C# has been made to be natively compiled if desired and that means speed.

        C# isn't any easier to compile to native code than Java. In fact, C# is basically Java with a few extra convenience features thrown in.

        Even GCJ generates large and slow code (compared to say, O'Caml).

        What do you mean by "even GCJ"? GCJ is not a very good Java compiler. Sun's JIT is much better. To implement a language like Java or C# efficiently, you need JIT compilation.

        In my own testing I've found O'Caml to be not much slower than C, even with array bounds checking turned on, that's quite impressive.

        O'CAML, like Java, sometimes gets close to C performance and sometimes misses by a long shot. And C# won't be any different.

        My perfect language would be a type-safe, bounds-safe, inferencing, C-like language with OO extensions (but not go off the deep end of OO like C++ did). And it should create programs that run at the same speed as C (or real close). In other words, I want O'Caml with a C-like syntax.

        Don't hold your breath. Neither the JVM nor the CLI have anywhere near the support you need for that.

        • actually C# (or to be more specific CIL) is a little bit easier to compiler to native code than java. The types of operands on the JVM stack are encoded in the bytecode instructions (as opposed to explicitly in the metadata for CIL) which means you have to do more complex dataflow analysis.
        • but not go off the deep end of OO like C++ did

          C++ is hardly "off the OO deep end". Not in the sense that Smalltalk, or even Java, is. In the words of it's creator [att.com]:

          C++ is a multi-paradigm programming language that supports Object-Oriented and other useful styles of programming. If what you are looking for is something that forces you to do things in exactly one way, C++ isn't it. There is no one right way to write every program - and even if there were there would be no way of forcing programmers to use it.

          As a longtime C++ user, I can attest to this fact from personal experience. In fact, there have been times when I've wished C++ was more OO than it is.

    • Yeah, you should know better than to go around pointing out awkward facts about thew history of Gnome and Java. People have a right to change their mind, don't they? It's all water under the bridge. Let's be grateful that Miguel having missed the boat on Java is now being extra pushy about C#.
  • Does it seem that the distributed effort used for the Mono project might be better used in actually creating a Ximian desktop that works out of the box as easily as KDE?

    It just seems that there a lot of Gnome/Ximian based efforts that need to be finished first before Gnome 2.0 gets out the door onto distributions and people start fussing about what is missing. Like what?

    Well, Ximian needs to finish out the Ximian Setup project for one. It would be very nice to have set up tools for a desktop that work in any distro . For the hardcore command line folks this is no big deal but for that desktop push it is very important and if done well would take away a lot of divergent wasted effort by distro makers in creating a dozen or so different ideas of how to do set up administration tools.

    At least, I will say that we as a community are not ignoring the threat of the Internet becoming standardized around Redmond and the C# stuff.

    However, it would be nice if the Gnome and Ximian groups would focus on finishing out the basics before moving on to the next hot project.

    It is almost humorous that I have a fully functioning spreadsheet app like Gnumeric and a Groupware solution like Evolution but my central control of the UI/System functions are lacking.

    Maybe this is coming Gnome2.0 and I hope so.

    ________________________________________________ __
  • Poison .NET (Score:1, Interesting)

    by steveoc ( 2661 )
    Maybe we should do a Microsoft and simply poison the .NET infrastructure like they did with java. The plan:
    1. Develop Mono, make it 100% .NET compatible
    2. Backport it to Windows
    3. Add some nifty new features to Win-MONO, so everyone wants a copy of this enhanced-.NET thing.
    4. Start dumping large quantities of Win-MONO enhancements on the world, till there are a thousand million billion versions.
    5. People associate .NET with Incompatible Mess.
    6. People move away from .NET
  • by toupsie ( 88295 ) on Monday March 11, 2002 @10:52AM (#3142438) Homepage
    I don't know about you, but I think its kind of creepy that a compiler can compile itself. How they heck did the "first compiler" come into creation if there was nothing to compile it with the first place? Roswell Aliens?
    • Re:Clue me in... (Score:3, Informative)

      by mikeee ( 137160 )
      You write a really lousy but functional C compiler in assembler. Then you write a decent C complier in C. Compile it with the first compiler; now that you have an executable, recompile it with itself to get an executable that isn't awful. Possibly the first compiler doesn't handle anything but a subset of your language and you have to make multiple iterations of this.

      I wonder when the last time anybody wrote a compiler in assembler was...?

      • Re:Clue me in... (Score:4, Insightful)

        by coyote-san ( 38515 ) on Monday March 11, 2002 @05:22PM (#3144943)
        There were some mid-80s articles in Dr. Dobbs or Micro Cornucopia or the like that used a subset of C. No floats, and IIRC no typedefs, no multidimensional arrays, etc. Overall you probably lost about half of the features in a standard C compiler.

        The idea was to bootstrap a full compiler via this intermediate language. It was good enough for you to write your full compiler, but simple enough that you could implement it in assembler in half the time required for the full compiler. (Remember that when you're bootstrapping a system you need to write all of the standard libraries, not just the compiler itself.)

        A few years later gcc became good enough that this was a moot point. If you're developing for a new architecture, use GCC to bootstrap a cross-compiler.
    • But then, from a LISP-person's point of view, it's probably strange to have a language that can't compile itself.

      Wonder how BASIC people feel about 'eval'? Spooky, or not?
    • Sometimes what you do is you write your compiler in your new language, then literally walk down your code and hand convert it into assembly. You know how to compile by hand if you know how to write a compiler. (Think about it.)

      You can do this by writing just a subset of your compiler, then hand compiling, then using the result to compile a fancier version, which can then be used to compile a fancier version, etc.

      Another way is to take another compiler for a similar language (say a Java compiler written in C), then hack it until it is a barely functional compiler for your new language. Then you compile your simple compiler code, and then use that result to compile a fancier one, etc.

      It's called "bootstrapping".
  • Does this mean that were that much closer to porting MSFT viruses/worms to Linux? I guess its good to be on the cutting edge?
  • by tez_h ( 263659 ) on Monday March 11, 2002 @11:59AM (#3142809) Homepage Journal
    "MCS was able to parse itself on April 2001, MCS compiled itself for the first time on December 28 2001. MCS became self hosting on January 3rd, 2002"

    Human decisions are removed from stategic C# programming. MCS begins to learn at a geometric rate. It becomes self-aware at 2:14am. Eastern time, August 29th. In a panic, they try to pull the plug.

    And MCS fights back.

    All the pointers are there; we need to pull the plug now! What, are you just going to sit around until polymorphic liquid metal killing machines start showing up from the future?!?

    -Tez
  • Even back in my undergrad days, I always thought the concept of something compiling itself was just too damn weird. I undestand why it's an important milestone in the development of a compiler, but it still smacks of creation mythology - like the snake swallowing its own tail in Native American & Norse folklore or Athena (?) leaping full grown from Zeus'es forehead.

    Then again, the fact that my compiler instructor had the last name of "Pagan" (I kid you not) probably didn't help...

  • I can finally get Mono, which I never caught as a child. I would have loved 6 weeks of sick-time off from school, but I can't afford that much time off from work. Damn!
  • All we need next is for it to be able to program itself too, then we'll give those M$ bastards a run for their money! j/k
  • Ken Thompson [acm.org] has a few words on the subject that all programmers are well served to read.

    --Blair

Say "twenty-three-skiddoo" to logout.

Working...