Re: [PATCH 1/1] sb/linux.py: More reliably recognize distribution

2023-11-12 Thread Chris Johns
Hi Michael,

I cannot apply the patch. Git does not like it and applying with patch gives the
following error:

  patching file source-builder/sb/linux.py
  patch:  malformed patch at line 25: @@ -56,36 +57,11 @@ def load():

Are you able to get git to send the patch. If not could please attach the output
of `git format-patch -1`?

Thanks
Chris

On 11/11/2023 1:41 pm, Michael South wrote:
> 
> If available, use "distro" package (introduced Python 3.6, back-ported
> to 2.6)
> to recognize Linux distributions and versions.
> 
> Updates #4966
> ---
>  source-builder/sb/linux.py | 89 +-
>  1 file changed, 59 insertions(+), 30 deletions(-)
> 
> diff --git a/source-builder/sb/linux.py b/source-builder/sb/linux.py
> index d71ac39..45f88b0 100644
> --- a/source-builder/sb/linux.py
> +++ b/source-builder/sb/linux.py
> @@ -28,6 +28,7 @@ import pprint
>  import os
>   from . import path
> +from . import log
>   def load():
>  uname = os.uname()
> @@ -56,36 +57,11 @@ def load():
>  }
>   # platform.dist() was removed in Python 3.8
> -if hasattr(platform, 'dist'):
> -# Works for LSB distros
> -try:
> -distro = platform.dist()[0]
> -distro_ver = float(platform.dist()[1])
> -except ValueError:
> - # Non LSB distro found, use failover"
> - pass
> -else:
> - distro = ''
> -
> -# Non LSB - fail over to issue
> -if distro == '':
> -try:
> -issue = open('/etc/issue').read()
> -distro = issue.split(' ')[0]
> -distro_ver = float(issue.split(' ')[2])
> -except:
> -pass
> -
> -distro = distro.lower()
> -
> -# Manage distro aliases
> -if distro in ['centos']:
> -distro = 'redhat'
> -elif distro in ['fedora']:
> -if distro_ver < 17:
> -distro = 'redhat'
> -elif distro in ['ubuntu', 'mx', 'linuxmint']:
> -distro = 'debian'
> +# The distro module (introduced in Python 3.6, back-ported to 2.6)
> +# is preferred.
> +distro = ''
> +distro_like = ''
> +distro_ver = 0
>   variations = {
>  'debian' : { '__bzip2':('exe', 'required',
> '/bin/bzip2'),
> @@ -114,10 +90,63 @@ def load():
>   '__sed':  ('exe', 'required',
> '/bin/sed') },
>  }
>  +try:
> +import distro as distro_mod
> +distro = distro_mod.id()
> +distro_like = distro_mod.like()
> +try:
> +distro_ver = float(distro_mod.version())
> +except ValueError:
> +pass
> +except:
> +pass
> +
> +if distro == '' and hasattr(platform, 'dist'):
> +distro = platform.dist()[0]
> +try:
> +distro_ver = float(platform.dist()[1])
> +except ValueError:
> +pass
> +
> +# Non LSB - last resort, try issue
> +if distro == '':
> +try:
> +with open('/etc/issue') as f:
> +issue = f.read().split(' ')
> +distro = issue[0]
> +distro_ver = float(issue[2])
> +except:
> +pass
> +
> +if distro:
> +distro = distro.lower()
> +if distro_like:
> +distro_like = distro_like.lower().split(' ')[0]
> +
> +# Some additional distro aliases
> +if distro in ['centos']:
> +distro_like = 'redhat'
> +elif distro in ['fedora']:
> +if distro_ver < 17:
> +distro_like = 'redhat'
> +elif distro in ['ubuntu', 'mx', 'linuxmint']:
> +distro_like = 'debian'
> +
> +if not (distro in variations) and (distro_like in variations):
> +distro = distro_like
> +# Versions don't carry over to likes; e.g. linuxmint 21.6 !=
> debian 21.6.
> +distro_ver = 0
> +
>  if distro in variations:
>  for v in variations[distro]:
>  if path.exists(variations[distro][v][2]):
>  defines[v] = variations[distro][v]
> +else:
> +log.warning('Unrecognized OS distro; assuming defaults for
> grep, sed, etc.')
> +try:
> +distro_mod
> +except:
> +log.warning("The 'distro' package may fix this problem; try
> 'pip install distro'.")
>   defines['_build']= defines['_host']
>  defines['_build_vendor'] = defines['_host_vendor']
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 1/1] trace: build with c++17 if building against llvm 16+

2023-11-12 Thread Chris Johns
On 10/11/2023 7:27 pm, Sebastian Huber wrote:
> On 25.09.23 11:25, Sebastian Huber wrote:
>> On 25.09.23 08:45, Chris Johns wrote:
>>> On 22/9/2023 2:47 pm, Sebastian Huber wrote:
 On 22.09.23 04:36, Joel Sherrill wrote:
> Are we doing something that particularly requires C++17? AFAIK we haven't
> needed it yet and why wouldn't it also be needed with gcc? If the default 
> on
> recent gcc versions is that, ok but we should be precise in case an older 
> gcc
> with a different default is used.
 The problem is not that we use features of a particular standard. It is 
 that
 LLVM requires a particular standard for the header files it ships and that
 we use.

 I already fixed this some time ago:

 https://lists.rtems.org/pipermail/devel/2023-May/075269.html

 However, Chris didn't like the change.
>>> The issue was not specially about that change but the tested hosts. I am 
>>> fine if
>>> the referenced change builds on a recent MacOS and FreeBSD 13. I am still 
>>> none
>>> the wiser?
>>
>> Ok, lets wait until the RTEMS Project has the appropriate CI runners to do 
>> this.
> 
> The next RTEMS user hit this problem which I fixed May this year:
> 
> http://devel.rtems.org/ticket/4965
> 

Any test results? I am sorry but I have not had time to check.

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


POSIX function link question?

2023-11-12 Thread zhengxiaojun

Hi all:
I use dynamic load (RAP format) in my project, I enable POSIX in 
BSP, but do not refers POSIX API.  The application called some POSIX 
API,so when link without librtemscpu.a, the POSXI API can not be found 
in the basefile. If I link with librtemscpu.a, link is OK, but loading 
output: "duplicate global symbol " . I guess some global symbols are 
linked twice.

Is there any way to export POSIX API in BSP image? Now I put the
POSIX API used in a array in BSP, this looks a bit strange.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel