Ask Your Question
0

Very strange problem. Catkin build abc destroyed my terminal and everything

asked 2017-06-13 18:56:45 -0600

Brian Lee gravatar image

I really really hope someone has come across this before..

I am working on a ros workspace, and while testing how package structures work and all, I created a test package called "abc". The package.xml and CMakeLists.txt were both modified so that the package name is abc.

Adter having done catkin build abc, the rosrun command no longer works.. and nothing really works. When I opened up another terminal, i see a whole lot of error messages saying import os failed and import sys failed.. somehow my PATH has gone empty and thus cannot run any bash commands.

Upon some researching, I found out the reason was because there is a stdlib called abc inside python2.7. Oh my god. So it looks like catkin build somehow tried to link the stdlib abc and messed up the terminal and everything..

Please!! I really need this problem fixed. Any help would be appreciated greatly.

edit retag flag offensive close merge delete

Comments

If you'd like help, please provide exactly what you typed, what you modified etc. Did you run with sudo? Did you install? Those are all very important information. Do you still have the console output of the build? Without those we can't help you too much.

tfoote gravatar imagetfoote ( 2017-06-13 19:50:05 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2017-06-13 20:08:55 -0600

William gravatar image

I cannot reproduce what you've described. This is what I did (please try to provide similar steps to reproduce what you're seeing):

~
$ mkdir -p /tmp/test_ws/src

~
$ cd /tmp/test_ws/src/

/tmp/test_ws/src
$ catkin_create_pkg abc --rosdistro kinetic
Created file abc/package.xml
Created file abc/CMakeLists.txt
Successfully created files in /private/tmp/test_ws/src/abc. Please adjust the values in package.xml.

/tmp/test_ws/src
$ cd ..

/tmp/test_ws
$ source ~/kinetic/install/setup.bash

/tmp/test_ws
$ catkin config --install
-----------------------------------------------------------
Profile:                     default
Extending:             [env] /Users/william/kinetic/install
Workspace:                   /tmp/test_ws
-----------------------------------------------------------
Source Space:       [exists] /tmp/test_ws/src
Log Space:         [missing] /tmp/test_ws/logs
Build Space:       [missing] /tmp/test_ws/build
Devel Space:       [missing] /tmp/test_ws/devel
Install Space:     [missing] /tmp/test_ws/install
DESTDIR:            [unused] None
-----------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        merged
-----------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-----------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
-----------------------------------------------------------
Workspace configuration appears valid.

Initialized new catkin workspace in `/tmp/test_ws`
-----------------------------------------------------------

/tmp/test_ws
$ catkin b
==> Expanding alias 'b' from 'catkin b' to 'catkin build'
-----------------------------------------------------------
Profile:                     default
Extending:             [env] /Users/william/kinetic/install
Workspace:                   /tmp/test_ws
-----------------------------------------------------------
Source Space:       [exists] /tmp/test_ws/src
Log Space:         [missing] /tmp/test_ws/logs
Build Space:        [exists] /tmp/test_ws/build
Devel Space:        [exists] /tmp/test_ws/devel
Install Space:     [missing] /tmp/test_ws/install
DESTDIR:            [unused] None
-----------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        merged
-----------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-----------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
-----------------------------------------------------------
Workspace configuration appears valid.

NOTE: Forcing CMake to run for each package.
-----------------------------------------------------------
[build] Found '1' packages in 0.0 seconds.
Starting  >>> catkin_tools_prebuild
Finished  <<< catkin_tools_prebuild                [ 2.3 seconds ]
Starting  >>> abc
Finished  <<< abc                                  [ 2.5 seconds ]
[build] Summary: All 2 packages succeeded!
[build]   Ignored:   None.
[build]   Warnings:  None.
[build]   Abandoned: None.
[build]   Failed:    None.
[build] Runtime: 4.8 seconds total.
[build] Note: Workspace packages have changed, please re-source setup files to use them.

/tmp/test_ws
$ source ./install/setup.bash

/tmp/test_ws
$ rospack find abc
/tmp/test_ws/install/share/abc

/tmp/test_ws
$ catkin_find abc
/tmp/test_ws/install/share/abc
edit flag offensive delete link more
0

answered 2017-06-13 22:03:59 -0600

Brian Lee gravatar image

updated 2017-06-13 22:04:59 -0600

Thanks for the help! Here are the details. I can provide more details when I go to work tomorrow morning, but here is what I remember.

in the workspace, package folder "abc" was created. Inside, there is one msg inside the msg folder that declares three string arrays. say string[] a, string[] b, string[] c. I don't think this is important but will note it anyhow. And then there is one python node file inside the src folder. And there are two python files in the scripts folder. The CMakeFile.txt is modified so that its header indicates the package name "abc" and build depend & run depend for message_generation is added. package.xml file has nothing changed from the basic xml other than the package name at the top which is changed to "abc".

Then, "catkin build abc" <-- this exact command was used. Python version is 2.7

While building abc, somehow the catkin build command searched inside the python library and linked abc.py (abstract base classes). And I think this screwed everything up.

After this build, I couldn't run any of my previously working fine nodes. Also, whenever I opened up a terminal, I couldn't type in commands such as "ls" or "gedit" or "apt-get".. meaning it kinda felt like being in shell. Commands such as "source" or "echo" still worked. However, it was definitely bash.. because I was able to use arrow keys to navigate previous commands. The bash commands not working could be resolved by putting usr/bin and other stuff onto $PATH.. however, $PATH used to have a lot of stuff that ubuntu should usually have.. but $PATH was blank after the "catkin build abc".

~/.bashrc did not have any strange things.. in fact, I copied over some backup-files just before doing this, and the bashrc was identical. Tomorrow I was planning to check etc/bashrc stuff.. hopefully something weird is happening there?

Anyhow.. whenever a terminal opens, it displays about 20 lines of error. The lines consist of things like "failed to import os, module could not be found", "failed to import sys, module could not be found", "failed to import ABCMeta, module could not be found".. which all do not make sense at all. Well the ABCMeta is a class inside abc.py so yeah that part may be understandable but.. why is the terminal trying to load these files in the first place??

Also, I cannot run python.. if i try to run python, I get the same errors as above (regarding os, sys, ABCMeta, etc.).

I did not run sudo or install. This all happened after doing "catkin build abc". Before doing this, everything was fine. my other packages were building fine, running the nodes fine, publishing/subscribing to nodes fine.. doing everything fine.. no problems with the terminal etc..

Please help!

edit flag offensive delete link more

Comments

Does your bashrc source the setup.bash from your workspace?

ahendrix gravatar imageahendrix ( 2017-06-14 00:08:07 -0600 )edit

Some of the commands that run as part of the auto-generated setup.bash will run small python scripts to compute how to set the environment variables, and one of the environment variables that it set is the PATH, so if python isn't working then it may not update the PATH correctly.

ahendrix gravatar imageahendrix ( 2017-06-14 00:12:31 -0600 )edit

There's a lot of unknowns here, so knowing the exact error messages will help a lot.

ahendrix gravatar imageahendrix ( 2017-06-14 00:13:19 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2017-06-13 18:56:45 -0600

Seen: 216 times

Last updated: Jun 13 '17