Make Compiler Dependency Explicit

Jahrme Risner macports at jahrme.com
Thu Jul 11 23:47:49 UTC 2019


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Wednesday, July 10, 2019 1:20 PM, Ryan Schmidt <ryandesign at macports.org> wrote:

> A compiler is only needed at build time, and should be declared in depends_build. gcc also has runtime libraries which your software may be using. These are needed both at build time and at runtime, so they should be declared in depends_lib.
>
> MacPorts 2.5.4 and earlier aren't smart enough to do that. If you specify a gcc compiler, MacPorts base knows that there's a library involved so it adds the whole gcc compiler port in depends_lib.
>
> This has been fixed [1] and will be released in MacPorts 2.6. Since this has not yet been released, it has not yet been tested by as large an audience as we would like, so there may be bugs. If you find any, please let us know.
>
> You can get the fix now by building MacPorts base from master [2].
>
> In almost all cases, ports should not touch compiler.whitelist. Instead, add forbidden compilers to compiler.blacklist. If that leaves no working compilers, append working compilers to compiler.fallback.
>
> If you insist on setting compiler.whitelist, then there is no point to modifying compiler.blacklist or compiler.fallback since the first entry of compiler.whitelist that is not blacklisted will be used.
>
> [1] https://github.com/macports/macports-base/commit/e0bd891f757606ff99e0611048de4f48f71dcce5
>
> [2] https://guide.macports.org/chunked/installing.macports.html#installing.macports.git

Thank you for the heads up that 2.6 will include a solution, I am currently trying with a git-build and waiting on all of the very time consuming source builds to complete. I will definitely report any issues that creep up.

As for the compiler blacklist/whitelist/fallback, I was using what was already provided, but if we can make it even more intelligent, that would be wonderful. If I understand you correctly, a Portfile should use either blacklist+fallback OR a whitelist as using the whitelist makes the other two lists largely redundant.

If that is correct, what would you suggest as the best setup to require a GNU gcc? The current blacklist includes:
 - *clang*
 - *llvm-gcc*
 - *apple-gcc*
 - gcc
 - gcc-3.3
 - gcc-4.0
 - gcc-4.2
This was crafted to ban all of Apple's fake gccs which are actually clang/llvm in disguise.

Thank you so much for your help!


More information about the macports-users mailing list