mirage / mirage-www

Website infrastructure and content for mirage.io
https://mirage.io
ISC License
172 stars 106 forks source link

will my project build with mirage? #460

Open yomimono opened 8 years ago

yomimono commented 8 years ago

This isn't in the faq, but it's a reasonably frequently asked question. The answer probably deserves its own blog entry or article. Were I to write it, I'd probably make a flowchart with something like:

...but that's an exceedingly crude and labor-intensive way of answering this question; I suspect better advice is available from better advisors.

amirmc commented 8 years ago

I think that would be a great set of things to write up up!

The first three points are important and because of dependencies, it may not always be clear to people how to figure out where the Unix deps are (without trial and error), or what libs they should use to avoid introducing such deps.

On 24 May 2016, at 13:19, Mindy Preston notifications@github.com wrote:

This isn't in the faq, but it's a reasonably frequently asked question. The answer probably deserves its own blog entry or article. Were I to write it, I'd probably make a flowchart with something like:

• Does your project make extensive use of the Unix module? • Does your project depend on filesystem storage? • If yes to either of the above, try factoring that away, then proceed below. • If no to the first two of the above, try wrapping your program's main in the closest example in mirage-skeleton and see what happens. ...but that's an exceedingly crude and labor-intensive way of answering this question; I suspect better advice is available from better advisors.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub

dbuenzli commented 8 years ago

Le mardi, 24 mai 2016 à 22:08, Amir Chaudhry a écrit :

The first three points are important and because of dependencies, it may not always be clear to people how to figure out where the Unix deps are (without trial and error),

Well instead of trial and error there's a thing called opam list --required-by PKG —rec which can already give a good guess; there may be false positives though (it includes build deps).

Daniel

hannesm commented 7 years ago

to add some notes:

The behaviour of mirage on unix (mirage configure -t unix) and other platforms (xen, solo5) is different since the otherlibs mentioned above are not provided on the freestanding platforms. Thus, while some mirage application might compile and run on Unix, it can fail on freestanding platforms. In addition to that, if there are any C stubs in any dependent library, they need to be "cross"compiled for freestanding (i.e. with the right CFLAGS).

It may be doable to generate a _tags which contains dontlink(unix num str threads) to get a very similar behaviour (apart from the C stubs, I've no solution for this right now) for both unix and freestanding platforms.