I have a ROS2 package which is failing to build. I'm following the ROS2 "Setting Up a Robot Simulation (Webots)" tutorial, and when I got to section 6 "Modify the setup.py file", I changed my file like so:
from setuptools import setup
from glob import glob
package_name = 'ad_boxtra'
setup(
name=package_name,
version='0.0.0',
packages=[package_name],
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + package_name, ['package.xml']),
('share/' + package_name, glob('launch/*.py')), # include all launch files
('share/' + package_name, glob('resource/*.urdf')), # include all webots-related resource files
('share/' + package_name + '/webots_simulation/worlds', # include desired webots worlds
['worlds/adboxtra_2022_simplified.wbt']),
],
install_requires=['setuptools'],
zip_safe=True,
maintainer='redacted',
maintainer_email='redacted',
description="redacted",
license='MIT License',
tests_require=['pytest'],
entry_points={
'console_scripts': [
'my_robot_driver = ad_boxtra.my_robot_driver:main',
],
},
)
I then ran colcon build with debug info from the root of my workspace and got:
user#host:~/my_ws $ colcon build --packages-select ad_boxtra --event-handlers console_direct+
Starting >>> ad_boxtra
running egg_info
writing ../../build/ad_boxtra/ad_boxtra.egg-info/PKG-INFO
writing dependency_links to ../../build/ad_boxtra/ad_boxtra.egg-info/dependency_links.txt
writing entry points to ../../build/ad_boxtra/ad_boxtra.egg-info/entry_points.txt
writing requirements to ../../build/ad_boxtra/ad_boxtra.egg-info/requires.txt
writing top-level names to ../../build/ad_boxtra/ad_boxtra.egg-info/top_level.txt
reading manifest file '../../build/ad_boxtra/ad_boxtra.egg-info/SOURCES.txt'
writing manifest file '../../build/ad_boxtra/ad_boxtra.egg-info/SOURCES.txt'
running build
running build_py
running install
running install_lib
running install_data
error: can't copy 'adboxtra_2022_simplified.wbt': doesn't exist or not a regular file
--- stderr: ad_boxtra
error: can't copy 'adboxtra_2022_simplified.wbt': doesn't exist or not a regular file
---
Failed <<< ad_boxtra [0.63s, exited with code 1]
Summary: 0 packages finished [0.70s]
1 package failed: ad_boxtra
1 package had stderr output: ad_boxtra
---
Failed <<< ad_boxtra [0.62s, exited with code 1]
Summary: 0 packages finished [0.71s]
1 package failed: ad_boxtra
1 package had stderr output: ad_boxtra
Why is this colcon build failing? If it helps, here's my directory tree:
AdBoxtra
├── ad_boxtra
│ ├── __init__.py
│ └── my_robot_driver.py
├── launch
│ └── my_robot_webots.launch.py
├── LICENSE
├── package.xml
├── README.md
├── resource
│ ├── ad_boxtra
│ └── my_robot.urdf
├── setup.cfg
├── setup.py
├── test
│ ├── test_copyright.py
│ ├── test_flake8.py
│ └── test_pep257.py
├── urdf
└── webots_simulation
├── controllers
│ └── arm_sweep
│ └── arm_sweep.py
├── libraries
├── plugins
│ ├── physics
│ ├── remote_controls
│ └── robot_windows
├── protos
└── worlds
└── adboxtra_2022_simplified.wbt
27 directories, 63 files
I did observe that in the install/ directory of my workspace, it seems that share/ad_boxtra/webots_simulation/worlds/ exists, but there's no .wbt files inside it. I don't know why this is though:
$ tree ~/rover_ws/install/ad_boxtra/
/home/redacted/rover_ws/install/ad_boxtra/
├── lib
│ ├── ad_boxtra
│ │ ├── conversationalist
│ │ ├── drive_control_serial
│ │ └── turtle_ad_boxtra
│ └── python3.8
│ └── site-packages
│ ├── ad_boxtra
│ │ ├── conversationalist.py
│ │ ├── drive_control_serial.py
│ │ ├── __init__.py
│ │ ├── my_robot_driver.py
│ │ ├── __pycache__
│ │ │ ├── conversationalist.cpython-38.pyc
│ │ │ ├── drive_control_serial.cpython-38.pyc
│ │ │ ├── __init__.cpython-38.pyc
│ │ │ ├── my_robot_driver.cpython-38.pyc
│ │ │ └── turtle_ad_boxtra.cpython-38.pyc
│ │ └── turtle_ad_boxtra.py
│ └── ad_boxtra-0.0.0-py3.8.egg-info
│ ├── dependency_links.txt
│ ├── entry_points.txt
│ ├── PKG-INFO
│ ├── requires.txt
│ ├── SOURCES.txt
│ ├── top_level.txt
│ └── zip-safe
└── share
├── ad_boxtra
│ ├── drive_control.launch.py
│ ├── hook
│ │ ├── ament_prefix_path.dsv
│ │ ├── ament_prefix_path.ps1
│ │ ├── ament_prefix_path.sh
│ │ ├── pythonpath.dsv
│ │ ├── pythonpath.ps1
│ │ └── pythonpath.sh
│ ├── my_robot.urdf
│ ├── my_robot_webots.launch.py
│ ├── package.bash
│ ├── package.dsv
│ ├── package.ps1
│ ├── package.sh
│ ├── package.xml
│ ├── package.zsh
│ ├── __pycache__
│ │ └── drive_control.launch.cpython-38.pyc
│ └── webots_simulation
│ └── worlds
├── ament_index
│ └── resource_index
│ └── packages
│ └── ad_boxtra
└── colcon-core
└── packages
└── ad_boxtra
18 directories, 38 files
From the Python documentation:
data_files specifies a sequence of (directory, files) pairs in the following way...
You wrote
('share/' + package_name + '/webots_simulation/worlds',['worlds/adboxtra_2022_simplified.wbt']), but it should be ('share/' + package_name + '/webots_simulation/worlds',['adboxtra_2022_simplified.wbt']).
You could check the build folder too. Just delete build and install and try again. It could be that.
OK so I know how to remove class files from all the jars under a dir. But, now I have different layer from a docker image, each layer is a tar file, and in the tar file there are the jar files.
Can I remove the class files from the jar files, packaged in tar files?
$ tree -L 3
.
├── 29e0fb8afe376cb02219c977cba1c9a80cca895f7f17b72c356f3e25a63337b9
│ ├── json
│ ├── layer.tar
│ └── VERSION
├── 3b75d6634da4d4f4932d2affeabb7454dc51ba160c3833b386c34e328da8f0ba
│ ├── amq # <<<<< this layer is extracted already, and you can see all the jars here. Other layers are not
│ │ ├── activemq-all-5.11.0.redhat-630495.jar
│ │ ├── bin
│ │ ├── conf
│ │ ├── data
│ │ ├── docs
│ │ ├── examples
│ │ ├── lib
│ │ ├── LICENSE
│ │ ├── NOTICE
│ │ ├── README.txt
│ │ ├── webapps
│ │ └── webapps-demo
│ ├── json
│ ├── layer.tar
│ ├── temp
│ └── VERSION
├── c1fa0e994b2d29f60fd2a6caecbe1ac3f987d001903523d60e532b6e08b094f0
│ ├── json
│ ├── layer.tar
│ └── VERSION
├── c8c84a6c1be5bdfc8caafd23082fd725e84f1c9cddb98fd56cad3a62544b2a3c.json
├── ef5088f89fbac64d2d5982ba14492227f60db1221f6bfd6290c6364a2a95a7e3
│ ├── json
│ ├── layer.tar
│ └── VERSION
├── manifest.json
├── repositories
└── script.sh # <<<<< the script is here
So you ask me why?
Well, did you hear people talking about log4j recently? :) I am doing this right now: log4j vulnerability check: how to quickly detect if log4j is used, in mavevn/in an image? "mvn dependency:tree" does not give a full picture
If someone can tell me how to remove these classes from jib maven plugin, that's better. They are from a base image and I doubt we could do that, though.
I have installed cjson using Lua Rocks locally.
luarocks install --local lua-cjson
But I cannot access the module.
> require('cjson')
stdin:1: module 'cjson' not found:
Packages were installed in to ~/.luarocks. Following is the file structure
.
├── bin
│ ├── json2lua
│ └── lua2json
├── lib
│ ├── lua
│ │ └── 5.4
│ │ └── cjson.so
│ └── luarocks
│ └── rocks-5.4
│ ├── lua-cjson
│ │ └── 2.1.0.6-1
│ │ ├── bin
│ │ │ ├── json2lua
│ │ │ └── lua2json
│ │ ├── lua-cjson-2.1.0.6-1.rockspec
│ │ ├── rock_manifest
│ │ └── tests
│ │ ├── agentzh.t
│ │ ├── bench.lua
│ │ ├── example1.json
│ │ ├── example2.json
│ │ ├── example3.json
│ │ ├── example4.json
│ │ ├── example5.json
│ │ ├── genutf8.pl
│ │ ├── numbers.json
│ │ ├── octets-escaped.dat
│ │ ├── README
│ │ ├── rfc-example1.json
│ │ ├── rfc-example2.json
│ │ ├── test.lua
│ │ ├── TestLua.pm
│ │ └── types.json
│ └── manifest
└── share
└── lua
└── 5.4
├── cjson
│ └── util.lua
├── json2lua.lua
└── lua2json.lua
What are the environment variables that should be in place for Lua to be able to find the packages?
luarocks path prints everything that should be added
➜ ~ luarocks path
export LUA_PATH='/usr/share/lua/5.4/?.lua;/usr/share/lua/5.4/?/init.lua;/usr/lib/lua/5.4/?.lua;/usr/lib/lua/5.4/?/init.lua;./?.lua;./?/init.lua;/home/s1n7ax/.luarocks/share/lua/5.4/?.lua;/home/s1n7ax/.luarocks/share/lua/5.4/?/init.lua'
export LUA_CPATH='/usr/lib/lua/5.4/?.so;/usr/lib/lua/5.4/loadall.so;./?.so;/home/s1n7ax/.luarocks/lib/lua/5.4/?.so'
export PATH='/home/s1n7ax/.luarocks/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/s1n7ax/.s1n7ax/bin:/home/s1n7ax/.yarn/bin:/home/s1n7ax/.local/bin'
It just prints them NOT run them. So that needs to be ran. I added following line to init script to add the path at system boot
eval $(luarocks path)
I have a few projects with common files, so I have made source/shared directory for them.
File structure looks like:
.
├── config.rb
├── build
├── source
│ ├── project-1
│ │ ├── index.html.slim
│ │ ├── js
│ │ │ ├── _templates.js.coffee
│ │ │ └── main.js.coffee
│ │ ├── layouts
│ │ │ └── layout.slim
│ ├── project-2
│ │ ├── index.html.slim
│ │ ├── js
│ │ │ ├── _templates.js.coffee
│ │ │ └── main.js.coffee
│ │ ├── layouts
│ │ │ └── layout.slim
│ └── shared
│ └── js
│ ├── vendor
│ │ ├── _json2.js
│ │ ├── html5shiv.js
Here I want source/shared/js/vendor/html5shiv.js to be in build directory, like main.js script.
When I am building project-1, build directory looks like:
build
├── index.html
├── js
│ ├── main-088a2c74.js
And with all that, can I somehow include shared files in build?
I use wooga's fork of mustache.erl (https://github.com/wooga/mustache.erl) in my project. And when I try to create release I get an error because rebar uses this mustache.beam file instead of a file included in its source.
What should I do to resolve this conflict?
The reason is not in rebar but is that some app in release tool search path contains the mustache.erl file as you release does.
Usually rel.config file contains {lib_dirs, ["../.."]} that force release tool search libs (apps) up your release directory. See example below. To fix it, move your release directory dipper (for example -> you_release/you_release) or move app that contains the same file (mustache.erl) to other place.
├── your_release_directory
│ ├── deps
│ │ └── mustache
│ │ ├── ebin
│ │ │ ├── mustache.app
│ │ │ └── mustache.beam
│ │ └── src
│ │ ├── mustache.app.src
│ │ └── mustache.erl
│ ├── ebin
│ │ └── mustache.beam
├── rebar (or any other app contains mustache.erl)
│ ├── ebin
│ │ └── mustache.beam
│ ├── src
│ │ └── mustache.erl