ros / meta-ros

OpenEmbedded Layers for ROS 1 and ROS 2
MIT License
391 stars 255 forks source link

[scarthgap] maximum shebang size exceeded, the maximum size is 128. [shebang-size] on beluga-ros #1220

Open mark-bchoi opened 2 months ago

mark-bchoi commented 2 months ago

Hi,

I have an issue in building beluga-ros package.

error is

ERROR: beluga-ros-2.0.1-1-r0 do_populate_sysroot: QA Issue: : /work/armv8a-oe4t-linux/beluga-ros/2.0.1-1/sysroot-destdir/opt/ros/humble/lib/beluga_ros/occupancy_grid_to_ndt maximum shebang size exceeded, the maximum size is 128. [shebang-size]
ERROR: beluga-ros-2.0.1-1-r0 do_populate_sysroot: do_populate_sysroot for this recipe installed files with QA issues
ERROR: Logfile of failure stored in: /home/bchoi/nvidia-yocto-bsp/bchoi-build/tmp/work/armv8a-oe4t-linux/beluga-ros/2.0.1-1/temp/log.do_populate_sysroot.1117401
ERROR: Task (/home/bchoi/nvidia-yocto-bsp/layers/meta-ros/meta-ros2-humble/generated-recipes/beluga/beluga-ros_2.0.1-1.bb:do_populate_sysroot) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3595 tasks of which 3591 didn't need to be rerun and 1 failed.

My build branches are

Yocto branch : scarthgap
ROS2 branch : humble

I think it was caused by shebang size in below files.

bchoi@ubuntu-22:~/nvidia-yocto-bsp/bchoi-build/tmp/work/armv8a-oe4t-linux/beluga-ros/2.0.1-1/image$ cat opt/ros/humble/lib/beluga_ros/occupancy_grid_to_ndt
#!/home/bchoi/nvidia-yocto-bsp/bchoi-build/tmp/work/armv8a-oe4t-linux/beluga-ros/2.0.1-1/recipe-sysroot-native/usr/bin/python3-native/python3
# EASY-INSTALL-ENTRY-SCRIPT: 'beluga-ros==2.0.1','console_scripts','occupancy_grid_to_ndt'
import re
import sys

# for compatibility with easy_install; see #2198
__requires__ = 'beluga-ros==2.0.1'

try:
    from importlib.metadata import distribution
except ImportError:
    try:
        from importlib_metadata import distribution
    except ImportError:
        from pkg_resources import load_entry_point

def importlib_load_entry_point(spec, group, name):
    dist_name, _, _ = spec.partition('==')
    matches = (
        entry_point
        for entry_point in distribution(dist_name).entry_points
        if entry_point.group == group and entry_point.name == name
    )
    return next(matches).load()

globals().setdefault('load_entry_point', importlib_load_entry_point)

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(load_entry_point('beluga-ros==2.0.1', 'console_scripts', 'occupancy_grid_to_ndt')())
bchoi@ubuntu-22:~/nvidia-yocto-bsp/bchoi-build/tmp/work/armv8a-oe4t-linux/beluga-ros/2.0.1-1/image$

Perhaps, it can be related with https://github.com/ros/meta-ros/pull/1215.

If I apply https://github.com/ros/meta-ros/pull/1215, Can I clear this issue?

BR, Mark

jiaxshi commented 2 months ago

I think you can add install append to delete the HOST prefix, refer to do_install:append() in meta-ros2/classes/ros_ament_python.bbclass

mark-bchoi commented 2 months ago

Hi @jiaxshi

Thanks for reply. Yes, I added it.

By the way, I think it would not be fundamental solution. there are in many cases added host path to build results in building packages.

WARNING: beluga-ros-2.0.1-1-r0 do_package_qa: QA Issue: File /opt/ros/humble/share/ament_index/resource_index/parent_prefix_path/beluga_ros in package beluga-ros contains reference to TMPDIR [buildpaths]

I hope to find how to fix it fundamentally.

robwoolley commented 3 weeks ago

@mark-bchoi It seems that the fundamental problem is that the Python setuptools rewrite the shebang to use whichever Python executable is used to do the install. I encountered this before and this was the solution I used: https://github.com/ros/meta-ros/commit/c2ec1ce7efd5a971c3361ff62923e942f17f494e

mark-bchoi commented 3 weeks ago

@robwoolley Thanks for comment.

I have not drilled this issue yet and it still can not be fixed even I applied patch as https://github.com/ros/meta-ros/commit/c2ec1ce7efd5a971c3361ff62923e942f17f494e and found topic-tools have the same issue.

Initialising tasks: 100% |#########################################################################################################################################################################################################################################################################################################################################################| Time: 0:00:02
NOTE: Executing Tasks
WARNING: topic-tools-1.1.1-1-r0 do_package_qa: QA Issue: File /opt/ros/humble/share/ament_index/resource_index/parent_prefix_path/topic_tools in package topic-tools contains reference to TMPDIR [buildpaths]
NOTE: Tasks Summary: Attempted 3753 tasks of which 3733 didn't need to be rerun and all succeeded.

Summary: There was 1 WARNING message.
bchoi@ubuntu-22:~/nvidia-yocto-bsp/bchoi-build$
mark-bchoi commented 3 weeks ago

@robwoolley Sorry I misunderstood for this issue. I can clear this issue with as your solution.

Thanks.

robwoolley commented 3 weeks ago

Hi @mark-bchoi, thanks for confirming that it worked. I'm just reopening the issue so I remember to merge in the fix.

Best regards, Rob