Here’s what I’ve observed:
compilers.choose fc cc
compiler.setup require_fortran -g95 -clang
If I issue sudo port xyz +gcc11, I get ${configure.cc} = /usr/bin/clang.
Mark Brethen
[email protected]
> On Jul 3, 2022, at 4:29 PM, David Strubbe <[email protected]> wrote:
>
> Hello Mark,
>
> Don't whitelist a particular one that you think works; blacklist ones that
> you know don't work.
> Additionally, I wonder if you are actually using the result of the compilers
> portgroup. You have to tell it to use the compiler from the variants for e.g.
> CC. See examples on that. If you don't do this, it has no effect on what is
> used. Yes there are also some subtleties about different versions of
> compilers as stated here:
> https://trac.macports.org/wiki/UsingTheRightCompiler
> <https://trac.macports.org/wiki/UsingTheRightCompiler>
>
> David
>
> On Sun, Jul 3, 2022 at 2:16 PM Mark Brethen <[email protected]
> <mailto:[email protected]>> wrote:
> Having looked at the examples, this one is similar to what I tried (and fails
> to build):
>
> compilers.choose fc cc
> compilers.setup require_fortran -g95 -clang
>
> :info:build make: *** [ccx_2.18.a] Error 1
> :info:build make: Leaving directory
> `/opt/local/var/macports/build/_Users_marbre_ports_cad_CalculiX-ccx/CalculiX-ccx/work/ccx_2.18/src'
> :info:build Command failed: cd
> "/opt/local/var/macports/build/_Users_marbre_ports_cad_CalculiX-ccx/CalculiX-ccx/work/ccx_2.18/src"
> && /usr/bin/make -j1 -w CC=/usr/bin/clang FC= CFLAGS="-O2
> -I../../spooles-2.2/ -DARCH=Linux -DSPOOLES -DARPACK -DMATRIXSTORAGE
> -DUSE_MT=1" DIR="../../spooles-2.2"
> :info:build Exit code: 2
> :error:build Failed to build CalculiX-ccx: command execution failed
> :debug:build Error code: CHILDSTATUS 48534 2
> :debug:build Backtrace: command execution failed
> :debug:build while executing
> :debug:build "system {*}$notty {*}$callback {*}$nice $fullcmdstring"
> :debug:build invoked from within
> :debug:build "command_exec -callback portprogress::target_progress_callback
> build"
> :debug:build (procedure "portbuild::build_main" line 8)
> :debug:build invoked from within
> :debug:build "$procedure $targetname"
>
>
> whereas adding a whitelist succeeds (using gfortran):
>
> compiler.whitelist macports-gcc-11
> compilers.choose fc cc
> compilers.setup require_fortran -g95 -clang
>
> Is this a difference between mp and apple gcc?
>
>
> Mark Brethen
> [email protected] <mailto:[email protected]>
>
>
>
>> On Jul 3, 2022, at 2:50 PM, David Strubbe <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> Hello Mark,
>>
>> I think you may have a basic misunderstanding here. The compilers portgroup
>> provides variants that select compilers, rather than being a way to select
>> the compiler in the portfile. It will provide gcc/gfortran (in specific
>> versions). If something like clang doesn't work, you remove it from the
>> variants list. "active_variants" is about compatibility of compilers used by
>> dependences. As far as I know, variants are definitely still the recommended
>> way of handling compiler selection. I suggest you look at some examples to
>> see how to use compilers portgroup. I made many in the science category,
>> such as octopus, sparskit, berkeleygw, libxc.
>>
>> David
>>
>> On Sat, Jul 2, 2022 at 4:20 PM Mark Brethen <[email protected]
>> <mailto:[email protected]>> wrote:
>> This port does not have config, so I’m having to pass the build args. How do
>> I specify a gcc (gfortran) compiler? Clang doesn’t work.
>>
>> Thanks,
>> Mark
>>
>>
>>
>> > On Jul 2, 2022, at 2:21 PM, Mark Brethen <[email protected]
>> > <mailto:[email protected]>> wrote:
>> >
>> > Still not working…
>> > <main.log>
>> >
>> >
>> > Mark Brethen
>> > [email protected] <mailto:[email protected]>
>> >
>> >
>> >
>> >> On Jul 2, 2022, at 2:15 PM, Mark Brethen <[email protected]
>> >> <mailto:[email protected]>> wrote:
>> >>
>> >> I should have looked at the active-variants tcl:
>> >>
>> >> require_active_variants arpack accelerate mpich
>> >>
>> >> should be
>> >>
>> >> require_active_variants arpack "accelerate mpich"
>> >>
>> >> Mark Brethen
>> >> [email protected] <mailto:[email protected]>
>> >>
>> >>
>> >>
>> >>> On Jul 2, 2022, at 1:48 PM, Mark Brethen <[email protected]
>> >>> <mailto:[email protected]>> wrote:
>> >>>
>> >>> Attaching log
>> >>> <main.log>
>> >>>
>> >>> Mark
>> >>>
>> >>>
>> >>>
>> >>>> On Jul 2, 2022, at 9:22 AM, Mark Brethen <[email protected]
>> >>>> <mailto:[email protected]>> wrote:
>> >>>>
>> >>>> I looked at the compilers PortGroup tcl but can’t figure out how to set
>> >>>> up gcc (for gfortran). I tried setting "compilers.choose cc” and
>> >>>> “compilers.setup require_fortran” but it continues to use clang.
>> >>>>
>> >>>> Thanks
>> >>>> Mark
>> >>>>
>> >>>>
>> >>>
>> >>
>> >
>>
>