I am planning on creating a compiler that will generate assembly, that is as far as I really want to go with this project (don't want to create the object files myself or any of the machine code). Since I'm doing this on linux, I would like to use the gas assembler. I'm not sure the best way to package the application. Should I require that the people have gas on their system already (which it is on most linux distros by default if I'm not mistaken, which I could be)? Or is it better to package the source with my application, or even package the actual application with my compiler?

By packaging I mean any form of distribution so that would include putting the code up on github as well.

  • What kind of compiler to you want to work on? What kind of source language?? – Basile Starynkevitch Dec 20 '11 at 15:18
  • right now, just a toy language to get the hang of it as well as try some stuff out. I'm hoping to make a career out of it (I'm making it my focus in school as well, however, I have "foundation classes" I must take before I can take my compiler classes) – Jetti Dec 20 '11 at 15:23
  • If you're creating .rpm files or the Debian equivalent, you'd presumably specify the dependency there. If you're expecting people to compile from source, you probably want ./configure;make;sudo make install to work, and you check for that. Alternately, put the requirements in the README.txt or other appropriate file. There are specific instructions available once you decide how you're distributing. – David Thornley Dec 20 '11 at 15:25

Require that people have gas. This is the preferred way for most OSS software, and you make life for potential distributors a lot easier by sticking to the standard.

The rationale behind the standard is a variation of DRY: If everyone would be packaging dependencies with their source packages, any distribution would face a myriad of similar libraries with different versions in the different source packages.

There are three places where you should indicate dependencies:

  1. In the human-readable README file of your project
  2. Checked at source configuration time by autoconf via configure and configure.ac
  3. Checked by the package manager for binary distributions by setting a Depends directive (.deb) or a dependency (.rpm)
| improve this answer | |
  • Thank you for your response and for answering my question, it is much appreciated. – Jetti Dec 20 '11 at 17:31

I won't bother about packaging your hypothetical compiler first. Work on your compiler prototype, and publish its source code in a free license (because nobody will pay you for your compiler!!!). If it interests some people, it will become packaged, or at least you'll get (later) suggestions on how to do so.

You could look at existing compilers packaging (e.g. for GCC, tinycc, Ocaml) in common linux distributions.

| improve this answer | |
  • 1
    I'm not expecting that people will pay for it nor am I expecting anybody to even use it. I'm just wondering how somebody can pull the code and get the compiler to work given it has a dependency on gas. – Jetti Dec 20 '11 at 15:20
  • Then look at how other compiler packages are doing. Details may depend upon the language (in particular for languages -like Ocaml, Go, ...- having a better idea of modules than what C gives). Some compilers have to generate a global thing at link time... – Basile Starynkevitch Dec 20 '11 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.