Ask Your Question
0

Sourcing setup.sh fails with: unexpected EOF while looking for matching `"'

asked 2020-01-04 13:44:43 -0500

greentreefrog8 gravatar image

updated 2020-01-07 14:03:30 -0500

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 ... (more)

edit retag flag offensive close merge delete

Comments

Are you building Kinetic from source?

gvdhoorn gravatar image gvdhoorn  ( 2020-01-05 08:10:32 -0500 )edit

I was not, but now I am. Same syntax error.

greentreefrog8 gravatar image greentreefrog8  ( 2020-01-05 08:13:37 -0500 )edit

I was not, but now I am

Why?

gvdhoorn gravatar image gvdhoorn  ( 2020-01-05 08:14:11 -0500 )edit

I thought there would be a different outcome. There was not.

greentreefrog8 gravatar image greentreefrog8  ( 2020-01-05 18:32:09 -0500 )edit

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" and ps -p $$ (note the double dollar sign).

gvdhoorn gravatar image gvdhoorn  ( 2020-01-06 01:45:09 -0500 )edit

I've added to the information above.

greentreefrog8 gravatar image greentreefrog8  ( 2020-01-06 10:04:55 -0500 )edit

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 the uname output you appear to be running this on an arm 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.

gvdhoorn gravatar image gvdhoorn  ( 2020-01-06 10:48:12 -0500 )edit

As a test, please run this sed command (copy-paste it, it's a single command line):

sudo sed -i 's|rm -f "$_SETUP_TMP"|#rm -f "$_SETUP_TMP"|g' /opt/ros/kinetic/setup.sh

This will make setup.shnot delete the temporary setup.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 with less /tmp/setup.sh.SOME_RANDOM_CHARACTERS (obviously replace SOME_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.

gvdhoorn gravatar image gvdhoorn  ( 2020-01-06 11:00:41 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2020-01-07 14:18:49 -0500

Dirk Thomas gravatar image

Several of your environment variable contain a single double quote: LC_ALL, PATH, LC_CTYPE. Please fix those to not contain quotes. I would expect it to work after that.

edit flag offensive delete link more

Comments

Converted this to an answer as this most likely is the answer.

gvdhoorn gravatar image gvdhoorn  ( 2020-01-07 14:21:31 -0500 )edit

yup, that was it. Thanks for your patience, y'all!

greentreefrog8 gravatar image greentreefrog8  ( 2020-01-07 14:28:58 -0500 )edit

Please mark the question as answered by ticking the checkmark (✓) to the left of the answer. Thanks.

gvdhoorn gravatar image gvdhoorn  ( 2020-01-07 14:32:29 -0500 )edit

i'm also getting this error. but i'm not able to fix it. isn't it setup.sh file which should be modifed and quotes to be checed?

dinesh gravatar image dinesh  ( 2020-03-28 12:08:42 -0500 )edit

No, you should just modify your environment variables

greentreefrog8 gravatar image greentreefrog8  ( 2020-03-29 13:53:39 -0500 )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

1 follower

Stats

Asked: 2020-01-04 13:10:49 -0500

Seen: 844 times

Last updated: Jan 07 '20