I'm teaching a class in which I would like students to run a precompiled command-line program on their own laptops. Some students have Windows; others have Mac. I was able to create a self-contained binary that the Windows users can just drop into their working directory and run.
To my surprise, I'm finding it far more difficult to do the same thing for Mac users. In particular, it appears to be impossible to compile a standalone binary program with all required libraries statically linked. The particular libraries that need to be present are libgfortran and libquadmath, since the gfortran compiler is used to compile the legacy F77 code (and it's too big a program to convert to another language).
So the only potentially workable solution I've found so far is for students to first install Xcode, then Xcode's command line tools, and finally gfortran on their own computer before my executable will find the gfortran library and run. But this is way too much work (and disk space) for what I want them to do.
My question: is there a way I'm overlooking to compile my program in completely self-contained form? Obviously it's hard for me to experiment, because it involves other people's computers.
EDIT: I found the following post which describes essentially the same problem: https://groups.google.com/forum/#!topic/comp.lang.fortran/TPEQQEwa0HI Unfortunately, the solution given doesn't work for me, even after I delete some options and make appropriate substitutions.