in4lio / ev3dev-c

LEGO MINDSTORMS EV3 Debian C library + Python, Ruby and Perl wrappers
MIT License
71 stars 30 forks source link

Having trouble getting started #21

Closed leviathan747 closed 6 years ago

leviathan747 commented 6 years ago

I'm having a little trouble getting started. I'm running ev3dev jessie on Raspberry Pi B+ V1.2

After initial setup, when I run make in the source/ev3 directory, this is my output:

/bin/sh: 1: arm-linux-gnueabi-gcc: not found
/bin/sh: 1: arm-linux-gnueabi-gcc: not found
/bin/sh: 1: arm-linux-gnueabi-gcc: not found
python -u ../../yupp/yup.py -q --pp-browse -d../../source/ev3 ev3_sensor.yu-h
* ERROR * 
  File "../../yupp/yup.py", line 290, in _pp
    ast = yuparse( yushell.input_file )
  File "/home/robot/ev3dev-c/yupp/yugen.py", line 932, in yuparse
    ( sou, ast ) = text.next()
  File "/home/robot/ev3dev-c/yupp/yugen.py", line 984, in ps_text
    ( sou, leg ) = ps_import( sou, depth + 1 )
  File "/home/robot/ev3dev-c/yupp/yugen.py", line 908, in wrapped
    return fn( sou, depth )
  File "/home/robot/ev3dev-c/yupp/yugen.py", line 1168, in ps_import
    leg = yuparse( _import_source( lpath, False ))
  File "/home/robot/ev3dev-c/yupp/yugen.py", line 932, in yuparse
    ( sou, ast ) = text.next()
  File "/home/robot/ev3dev-c/yupp/yugen.py", line 984, in ps_text
    ( sou, leg ) = ps_import( sou, depth + 1 )
  File "/home/robot/ev3dev-c/yupp/yugen.py", line 908, in wrapped
    return fn( sou, depth )
  File "/home/robot/ev3dev-c/yupp/yugen.py", line 1176, in ps_import
    leg = yuparse( _import_eval( leg ))
  File "/home/robot/ev3dev-c/yupp/yugen.py", line 887, in _import_eval
    sou = eval( code, dict( globals(), **builtin ))                                                                #pylint: disable=eval-used
  File "<string>", line 2, in <module>
  File "grab_sensors.py", line 42, in grab_sensors
    j = urllib2.urlopen( url )
  File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 437, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 550, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 475, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 558, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
TypeError: python: __init__() takes exactly 6 arguments (2 given)
  File "ev3_sensor-dict.yu", line 16
    )
     ^

makefile:289: recipe for target 'ev3_sensor.h' failed
make: *** [ev3_sensor.h] Error 4

python version is 2.7.9

Any guidance would be great.

tcwan commented 6 years ago

You don't have the compilers installed.

sudo apt-get install build-essential

However, I advise you to use Docker to build it on your PC instead of trying to do it on the Raspberry Pi. Edited: Oops, I didn't see that you're using the Raspberry Pi 1, there are no specific Docker images for your configuration, so you'll have to depend on the native tool option.

Also take a look at the writeups in the docs folder here. There is no TOC so you'll have to searh around.

leviathan747 commented 6 years ago

yeah that is the first thing I thought as well, but I did already do that. gcc works, but arm-linux-gnueabi-gcc cannot be found. I don't know if it needs to be aliased or if it's not installed or just not in my PATH. I modified the makefile to change the C compiler to just "gcc" which got me a little bit further but I got the same python failure.

tcwan commented 6 years ago

Hmm. I'm not sure why you'd run into the python error. In the README.md, it says:

You have to take into account that, by default, the preprocessing stage is skipping when compilation is performed on the brick or using Docker. Please set SKIP_PP = 0 in the makefile to allow preprocessing anywhere.

Try setting SKIP_PP=0, it will avoid triggering yupp, bypassing the source file generation step.

Edit: I've not tried building on the RPi before, are you using the ev3dev RPi image? https://github.com/ev3dev/ev3dev/releases/download/ev3dev-jessie-2017-09-14/ev3dev-jessie-rpi-generic-2017-09-14.zip

It is possible that GCC has the default name of `gcc' instead of the longer name, which is typically used in the Docker image for the cross compiler.

Edit2+: I'm not sure if yupp is dependent on python 3 or not. I'm using the Docker image which installs the default python-dev and swig3.0 packages for Debian on ARM.

leviathan747 commented 6 years ago

I missed that part. I tried setting SKIP_PP to 1 which let me skip the yupp step. It at least let me get through initial build and run the example. Thanks!

Edit: Yes, I'm using that image. Yeah, I had to modify the makefile to use gcc and ar for compiling and linking instead of the longer names.

I think yupp requires python 2... there are syntax errors if I try to use python3