#55884: mandoc @1.14.3: not using the right compiler

Jan Stary hans at stare.cz
Wed Feb 28 07:52:06 UTC 2018

The ticket is closed, so I will continue here.

>  Actually it's not specific to the universal variant. Rather, the problem
>  is that the port is not UsingTheRightCompiler.

mandoc's ./configure sets CC to whatever make(1) thinks CC is:
CC=`printf "all:\\n\\t at echo \\\$(CC)\\n" | env -i make -sf -`
Why exactly is it "not the right compiler"?

Maybe I don't get the whole premise:

  If not instructed otherwise, most software builds C code using "cc" or
  "gcc". But "/usr/bin/cc" and "/usr/bin/gcc" are not specific
  compilers; they're symlinks to some suitable default compiler, but it
  varies based on Xcode version. Users might also have created
  a "/opt/local/bin/gcc" symlink, pointing to any installed compiler, by
  using "port select --set gcc". So we cannot rely on "cc" oc "gcc"
  being any particular compiler. 

Yes, we cannot, and that's OK because we should not, _by_default_.
This is a UNIX system compiling C code. Call 'cc'. Duh.

It's true that /usr/bin/cc is a symlink to some suitable default compiler.
So call that, thus calling a suitable default compiler, _by_default_.

Yes, there are ports that do need to call some particular compiler,
but it's those ports' job then to find and use that.

> I had my MacPorts configured to error out if `cc` is used
> using the method described at  UsingTheRightCompiler#testing.

Why would you do that?

Mandoc is extremely portable. I have yet to see a UNIX system where
it does not build. Except here: of course it "breaks" if you explicitly
make it impossible to run 'cc', which is the right compiler.

BTW, this is how configure.cc is described in the guide:

    Set CC compiler flags for selecting a C compiler.
    Default: ???

"compiler flags for selecting a compiler"?

> Perhaps the portfile code that set `CC`
>  that was removed in [14f7de9e9ad521cce6389678675706e8593b9834/macports-
>  ports] was needed after all.

It is only "needed" if you make it artificially impossible
to call 'cc' (or whatever the port ./configures to be CC).

So: because ports must not call 'cc' on your system,
let's complicate the mandoc Portfile for everyone.


More information about the macports-dev mailing list