Compiler Selection

Ryan Schmidt ryandesign at macports.org
Wed Jul 13 21:29:01 UTC 2022


On Jul 3, 2022, at 13:39, Mark Brethen wrote:
> 
> According to the wiki:
> 
>> The compiler is chosen with the following precedence:
>> 
>> 	• If configure.compiler is set in the Portfile, then that is the compiler that is used.
>> 	• If the user sets default_compilers, the compiler is chosen from that list unless the compiler is blacklisted.
>> 	• If the Portfile sets compiler.whitelist, the compiler is chosen from that list unless the compiler is blacklisted. 
>> 	• If the Portfile sets compiler.fallback, the compiler is chosen from that list unless the compiler is blacklisted. 
>> 	• A compiler is chosen (Xcode compilers if possible) that
>> 		• is not blacklisted,
>> 		• is known to work on the particular version of the OS, and
>> 		• satisfies the requirements set in the Portfile.
> CalculiX requires gcc + fortran. I used ‘configure.compiler macports-gcc-11’ (it will not build with clang). But this seems too rigid. My initial goal was to set the latest version as default with the option of trying earlier versions of macports-gcc. I tried using compilers PortGroup but could not get that to work—I haven’t figured out the proper setup. Is it possible? I read that variants are no longer recommended for this.

If you must build with gcc, it is customary to offer variants to let the user choose which version of gcc, from among the set of compatible versions of gcc which you specify. It is my understanding that the purpose of the compilers portgroup is to assist you with that task but I have no further information about it. Read the comments in the compilers portgroup for assistance or check how other ports use this portgroup.



More information about the macports-dev mailing list