紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
ros2 foxy 自定义消息接口编译 “没有规则可制作目标”
-
@87725837 你的构建命令是在哪一个目录下运行的
-
@小鱼 工作空间下运行的
oem@oem-ThinkPad-X1-Yoga-3rd:~/town_ws$ colcon build --packages-select village_interfaces Starting >>> village_interfaces --- stderr: village_interfaces make[1]: *** 没有规则可制作目标“village_interfaces__py/CMakeFiles/village_interfaces__py.dir/all”,由“CMakeFiles/village_interfaces__python.dir/all” 需求。 停止。 make[1]: *** 正在等待未完成的任务.... make: *** [Makefile:146:all] 错误 2 --- Failed <<< village_interfaces [0.12s, exited with code 2] Summary: 0 packages finished [0.50s] 1 package failed: village_interfaces 1 package had stderr output: village_interfaces
-
@87725837 排除一些环境因素先,可以尝试在root下构建:
在oem@oem-ThinkPad-X1-Yoga-3rd:~/town_ws$目录下执行如下命令:
sudo su
source /opt/ros/foxy/setup.bash
rm -rf build install log
colcon build -
@小鱼
结果如下:oem@oem-ThinkPad-X1-Yoga-3rd:~/town_ws$ sudo su [sudo] oem 的密码: root@oem-ThinkPad-X1-Yoga-3rd:/home/oem/town_ws# source /opt/ros/foxy/setup.bash root@oem-ThinkPad-X1-Yoga-3rd:/home/oem/town_ws# rm -rf build/ install/ log/ root@oem-ThinkPad-X1-Yoga-3rd:/home/oem/town_ws# colcon build Starting >>> village_interfaces Starting >>> village_li Starting >>> village_wang Finished <<< village_li [1.37s] --- stderr: village_interfaces make[1]: *** 没有规则可制作目标“village_interfaces__py/CMakeFiles/village_interfaces__py.dir/all”,由“CMakeFiles/village_interfaces__python.dir/all” 需求。 停止。 make[1]: *** 正在等待未完成的任务.... make: *** [Makefile:146:all] 错误 2 --- Failed <<< village_interfaces [2.91s, exited with code 2] Aborted <<< village_wang [8.64s] Summary: 1 package finished [9.06s] 1 package failed: village_interfaces 1 package aborted: village_wang 1 package had stderr output: village_interfaces root@oem-ThinkPad-X1-Yoga-3rd:/home/oem/town_ws#
自定义消息的包还是一样的报错
-
@87725837 尝试开一个新的工作空间,下载我的代码,进行构建测试,再排除下代码问题,代码地址:https://github.com/fishros/ros2_town
-
@小鱼 结果如下:
oem@oem-ThinkPad-X1-Yoga-3rd:~$ git clone https://github.com/fishros/ros2_town 正克隆到 'ros2_town'... remote: Enumerating objects: 1134, done. remote: Counting objects: 100% (1134/1134), done. remote: Compressing objects: 100% (510/510), done. remote: Total 1134 (delta 556), reused 1053 (delta 477), pack-reused 0 接收对象中: 100% (1134/1134), 1.44 MiB | 701.00 KiB/s, 完成. 处理 delta 中: 100% (556/556), 完成. oem@oem-ThinkPad-X1-Yoga-3rd:~$ cd ros2_town/ oem@oem-ThinkPad-X1-Yoga-3rd:~/ros2_town$ ls README.md src oem@oem-ThinkPad-X1-Yoga-3rd:~/ros2_town$ cd src/ oem@oem-ThinkPad-X1-Yoga-3rd:~/ros2_town/src$ ls village_interfaces village_li village_wang village_zhang oem@oem-ThinkPad-X1-Yoga-3rd:~/ros2_town/src$ cd .. oem@oem-ThinkPad-X1-Yoga-3rd:~/ros2_town$ coclon build coclon:未找到命令 oem@oem-ThinkPad-X1-Yoga-3rd:~/ros2_town$ colcon build Starting >>> village_interfaces --- stderr: village_interfaces make[1]: *** 没有规则可制作目标“village_interfaces__py/CMakeFiles/village_interfaces__py.dir/all”,由“CMakeFiles/village_interfaces__python.dir/all” 需求。 停止。 make[1]: *** 正在等待未完成的任务.... make: *** [Makefile:146:all] 错误 2 --- Failed <<< village_interfaces [3.35s, exited with code 2] Summary: 0 packages finished [3.86s] 1 package failed: village_interfaces 1 package had stderr output: village_interfaces 3 packages not processed oem@oem-ThinkPad-X1-Yoga-3rd:~/ros2_town$
-
@87725837 在 ros2 foxy 自定义消息接口编译 “没有规则可制作目标” 中说:
coclon build
coclon:未找到命令
oem@oem-ThinkPad-X1-Yoga-3rd:~/ros2_town$ colcon build可以确定是环境问题了,应该和你混装ros和ros2造成的,请附上你的 ~/.bashrc 文件内容,进一步检查环境。
-
# ~/.bashrc: executed by bash(1) for non-login shells. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # for examples # If not running interactively, don't do anything case $- in *i*) ;; *) return;; esac # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options HISTCONTROL=ignoreboth # append to the history file, don't overwrite it shopt -s histappend # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) HISTSIZE=1000 HISTFILESIZE=2000 # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize # If set, the pattern "**" used in a pathname expansion context will # match all files and zero or more directories and subdirectories. #shopt -s globstar # make less more friendly for non-text input files, see lesspipe(1) [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" # set variable identifying the chroot you work in (used in the prompt below) if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi # set a fancy prompt (non-color, unless we know we "want" color) case "$TERM" in xterm-color|*-256color) color_prompt=yes;; esac # uncomment for a colored prompt, if the terminal has the capability; turned # off by default to not distract the user: the focus in a terminal window # should be on the output of commands, not on the prompt #force_color_prompt=yes if [ -n "$force_color_prompt" ]; then if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then # We have color support; assume it's compliant with Ecma-48 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such # a case would tend to support setf rather than setaf.) color_prompt=yes else color_prompt= fi fi if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi unset color_prompt force_color_prompt # If this is an xterm set the title to user@host:dir case "$TERM" in xterm*|rxvt*) PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" ;; *) ;; esac # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" alias ls='ls --color=auto' #alias dir='dir --color=auto' #alias vdir='vdir --color=auto' alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' fi # colored GCC warnings and errors #export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' # some more ls aliases alias ll='ls -alF' alias la='ls -A' alias l='ls -CF' # Add an "alert" alias for long running commands. Use like so: # sleep 10; alert alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' # Alias definitions. # You may want to put all your additions into a separate file like # ~/.bash_aliases, instead of adding them here directly. # See /usr/share/doc/bash-doc/examples in the bash-doc package. if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi # enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). if ! shopt -oq posix; then if [ -f /usr/share/bash-completion/bash_completion ]; then . /usr/share/bash-completion/bash_completion elif [ -f /etc/bash_completion ]; then . /etc/bash_completion fi fi source ~/realsense_ws/devel/setup.bash # >>> fishros initialize >>> echo "ros:foxy(1) noetic(2) ?" read choose case $choose in 1) source /opt/ros/foxy/setup.bash;; 2) source /opt/ros/noetic/setup.bash;; esac # <<< fishros initialize <<<
-
@87725837 在 ros2 foxy 自定义消息接口编译 “没有规则可制作目标” 中说:
source ~/realsense_ws/devel/setup.bash
请去掉这句后再次测试,这是ros1的命令,可能会环境变量产生很大影响
-
还是不行
这是我删掉bashrc里那句话后重新开的终端进行编译的结果:ros:foxy(1) noetic(2) ? 1 oem@oem-ThinkPad-X1-Yoga-3rd:~/ros2_town$ rm -r build/ log/ install/ oem@oem-ThinkPad-X1-Yoga-3rd:~/ros2_town$ colcon build --packages-select village_interfaces Starting >>> village_interfaces --- stderr: village_interfaces make[1]: *** 没有规则可制作目标“village_interfaces__py/CMakeFiles/village_interfaces__py.dir/all”,由“CMakeFiles/village_interfaces__python.dir/all” 需求。 停止。 make[1]: *** 正在等待未完成的任务.... make: *** [Makefile:146:all] 错误 2 --- Failed <<< village_interfaces [2.33s, exited with code 2] Summary: 0 packages finished [2.71s] 1 package failed: village_interfaces 1 package had stderr output: village_interfaces