Bug 12331

Summary: meson issue
Product: buildroot Reporter: Jean-pierre Cartal <jpcartal>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: buildroot, m.weisser.m, yann.morin.1998
Priority: P5    
Version: 2019.02.7   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description Jean-pierre Cartal 2019-11-20 14:08:47 UTC
Meson script uses full path to python3 when executed which gives errors when the path is too long :

$ cat host/bin/meson 
#!/home/Dev/Ssd/buildroot/buildroot-2019.02.7/host/bin/python3
# EASY-INSTALL-ENTRY-SCRIPT: 'meson==0.49.0','console_scripts','meson'
__requires__ = 'meson==0.49.0'
import re
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(
        load_entry_point('meson==0.49.0', 'console_scripts', 'meson')()
    )
Comment 1 Thomas Petazzoni 2019-11-20 15:19:11 UTC
Yes, I also encountered this error. What I did so far to work around it is:

define HOST_MESON_FIXUP_SHEBANG
        $(SED) 's%^#!.*%#!/usr/bin/env python3%' $(HOST_DIR)/bin/meson
endef
HOST_MESON_POST_INSTALL_HOOKS += HOST_MESON_FIXUP_SHEBANG

in package/meson/meson.mk.
Comment 2 Thomas Petazzoni 2019-11-27 07:58:38 UTC
Looking back at this, your path "/home/Dev/Ssd/buildroot/buildroot-2019.02.7/host/bin/python3" is not that long, it's only 61 bytes long. This shouldn't cause a problem, the maximum shebang line is 128 bytes.

So I'm not sure why you think the length of the path is a problem. Could you give more details about the error you're seeing ?
Comment 3 Jean-pierre Cartal 2019-11-27 08:09:55 UTC
My bad, I removed parts of the path, so it seems shorter that the maximum allowed, but the real problem is indeed the length and your patch solved it.

Regards.
Comment 4 Yann E. MORIN 2020-01-13 17:37:40 UTC
*** Bug 12461 has been marked as a duplicate of this bug. ***
Comment 5 Yann E. MORIN 2020-01-13 18:08:08 UTC
I've sent a tentative patch to the list:
https://patchwork.ozlabs.org/patch/1222257/

It's not unlike Thomas' proposal, but with my little touch... ;-)