Sourcing setup.sh fails with: unexpected EOF while looking for matching `"'
I'm trying to install ROS Kinetic, and it keeps failing at various points in the catkin_make process, most notably and most frequently like so:
I ran:
source /opt/ros/kinetic/setup.bash
(sometimes I get the following)
-bash: /tmp/setup.sh.SIm4vZkcV4: line 38: unexpected EOF while looking for matching `"'
-bash: /tmp/setup.sh.SIm4vZkcV4: line 39: syntax error: unexpected end of file
-bash: [: 0: unary operator expected
and then
catkin_make
And here's the output:
Base path: /home/ubuntu/catkin_ws
Source space: /home/ubuntu/catkin_ws/src
Build space: /home/ubuntu/catkin_ws/build
Devel space: /home/ubuntu/catkin_ws/devel
Install space: /home/ubuntu/catkin_ws/install
####
#### Running command: "cmake /home/ubuntu/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/ubuntu/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/ubuntu/catkin_ws/install -G Unix Makefiles" in "/home/ubuntu/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/ubuntu/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/kinetic
-- This workspace overlays: /opt/ros/kinetic
-- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.12", minimum required is "2")
-- Using PYTHON_EXECUTABLE: /usr/bin/python2
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/ubuntu/catkin_ws/build/test_results
-- Found gmock sources under '/usr/src/gmock': gmock will be built
-- Found PythonInterp: /usr/bin/python2 (found version "2.7.12")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found gtest sources under '/usr/src/gmock': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.18
-- BUILD_SHARED_LIBS is on
/home/ubuntu/catkin_ws/devel/env.sh: 31: /tmp/setup.sh.URSsHUDdg8: Syntax error: Unterminated quoted string
Traceback (most recent call last):
File "/home/ubuntu/catkin_ws/build/catkin_generated/generate_cached_setup.py", line 22, in <module>
code = generate_environment_script('/home/ubuntu/catkin_ws/devel/env.sh')
File "/opt/ros/kinetic/lib/python2.7/dist-packages/catkin/environment_cache.py", line 61, in generate_environment_script
output = subprocess.check_output([env_script, sys.executable, '-c', python_code])
File "/usr/lib/python2.7/subprocess.py", line 574, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['/home/ubuntu/catkin_ws/devel/env.sh', '/usr/bin/python2', '-c', 'import os; print(dict(os.environ))']' returned non-zero exit status 2
CMake Error at /opt/ros/kinetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
execute_process(/usr/bin/python2
"/home/ubuntu/catkin_ws/build/catkin_generated/generate_cached_setup.py")
returned error code 1
Call Stack (most recent call first):
/opt/ros/kinetic/share/catkin/cmake/all.cmake:207 (safe_execute_process)
/opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:20 (include)
CMakeLists.txt:56 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/ubuntu/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/ubuntu/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed
No matter what, I seem to be having an error in the auto-generated setup.sh file. Not sure how to proceed from here.
REQUESTED INFO EDITS:
followed the instructions on the install page ...
Are you building Kinetic from source?
I was not, but now I am. Same syntax error.
Why?
I thought there would be a different outcome. There was not.
If you don't have a good reason to build from source (and this goes for all packages, not just the "base ROS install"), then don't do it. Always try (hard) to use binary (ie: released) packages.
Please remove the Catkin workspace in which you were trying to build before, and make sure you've installed Kinetic using
apt
.As to your problem: please tell us what you did exactly (ie: how you installed ROS). Also include the output of
lsb_release -a
,uname -rvmp
,printf %q "$IFS"
andps -p $$
(note the double dollar sign).I've added to the information above.
Just for completeness, could you show the contents of
/opt/ros/kinetic/setup.bash
and/opt/ros/kinetic/setup.sh
?And based on the
armv7l
in theuname
output you appear to be running this on anarm
platform (RPi by any chance?).That is not necessarily a problem, but would have been good to mention.
I would recommend to remove the
source /opt/ros/kinetic/setup.bash
line from your.bashrc
for now. It's not needed (you can do it manually) and it would unbreak your setup for now.As a test, please run this
sed
command (copy-paste it, it's a single command line):This will make
setup.sh
not delete the temporarysetup.sh
file it creates in the/tmp
directory so we can take a look at it.Then open a new terminal, type
source /opt/ros/kinetic/setup.bash
. It will probably still fail.But now there should be a file called
/tmp/setup.sh.SOME_RANDOM_CHARACTERS
. Open it withless /tmp/setup.sh.SOME_RANDOM_CHARACTERS
(obviously replaceSOME_RANDOM_CHARACTERS
with whatever is there on your machine).Copy the contents of this file and append it to your question text.
There might be a special character in your username, or home directory or something else that breaks parsing of the setup file.