tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: GCC_REQD and 32-bit arm



nia <nia%NetBSD.org@localhost> writes:

> On Sat, Apr 02, 2022 at 07:51:52AM -0400, Greg Troxel wrote:
>> 
>> nia <nia%NetBSD.org@localhost> writes:
>> 
>> >> Do you mean
>> >> 
>> >>   base system gcc is ok, but all pkgsrc versions < 10 are broken?
>> >
>> > Yes.
>> >
>> >>   this is only about fortran?
>> >
>> > It's about fortran and g++.
>> 
>> OK, so this probably explains blas and related problems.
>> 
>> >> If pkgsrc gcc < 10 is broken, perhaps we can just pretend they don't
>> >> exist on arm, so if pgksrc gcc is chosen, 10 would be the min version?
>> >
>> > Maybe, the logic for choosing a GCC version is complex. It decides the
>> > minimum version it can use in gcc.mk, then detects whether it's built-in
>> > or not, so it isn't a simple case of removing attempts to gcc prior to
>> > 10 on ARM.
>> 
>> I am not sure this makes sense, but as a thought experiment remove all
>> pkgsrc gcc versions < 10.  Then run on arm and I think it would be ok.
>> So what I am suggesting is basically:
>> 
>>   in the logic where we register that gcc versions exist, if [CPU is arm
>>   and gcc < 10, whatever the conditional ought to be] then don't
>>   register them
>> 
>> Then packages will compute a minimum, and the available choices will be
>> what's builtin (no fortran of course), and 10 and up, just as if we had
>> deleted the <10 packages.
>
> This will mean that the base compiler will never be used, which is
> probably not want we want. We want newer GCC to be used where packages
> require it (modern C++, and fortran)

I don't follow.   Right now the available compilers are

  base (gcc 7 in Netbsd 9, but no gfortran)
  gcc6
  gcc7
  gcc8
  gcc9
  gcc10

and the selection logic chooses the lowest version that is >= the
required version.

I think you are saying that on arm, pkgsrc gcc[6789] are 1) ok for C/C++
and 2) broken for fortran.

So what I mean is that somewhere in the mk files, e.g. gcc8 is recorded
as available in pkgsrc.  On arm, omit gcc6 to gcc9 as being available,
just as if they had been removed.  So the selection logic will see

  base (gcc 7 in Netbsd 9, but no gfortran)
  gcc10

and thus choose between base and gcc10.


We already have in gfortran.mk:

  # gcc9 doesn't work on NetBSD/aarch64, but gcc10 does.                                                                                        
  .if !empty(POSSIBLE_GFORTRAN_VERSION:M9) && !empty(MACHINE_PLATFORM:MNetBSD-*-aarch64*)
  POSSIBLE_GFORTRAN_VERSION=      10
  .endif

and perhaps this should be extended to gcc[6789] on arm?


But probably you mean: if we're going to force fortran to 10, we should
force everything that uses pkgsrc gcc to 10, both to save time and to
avoid ABI compat.  That gets us a world with base and gcc10 only.

So in that spirit, having read the code a bit, I suggest to wrap this

  _NEED_GCC6?=    no
  .for _pattern_ in ${_GCC6_PATTERNS}
  .  if !empty(_GCC_REQD:M${_pattern_})
  _NEED_GCC6=     yes
  .  endif
  .endfor


in some conditional which is basically "Is gcc6 not broken on this
platform", and similarly for the others.  Then even if GCC_REQD=6,
_NEED_GCC6 will not be turned on, but _NEED_GCC10 will be turned on, and
we'll get 10.

This is tricky and I could be getting it wrong, of course.

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index