bivab / smbus-cffi

Python bindings for Linux SMBus access through i2c-dev using cffi
GNU General Public License v2.0
61 stars 31 forks source link

Error on beaglebone black with pypy's latest #2

Closed justinledwards closed 10 years ago

justinledwards commented 10 years ago

I'm not very great at python, so I'm not sure what to do with this. Normal python and smbus work great. I just wanted to test the speed with pypy.


/usr/local/pypy/bin/pip run on Mon Dec 23 02:59:17 2013 Downloading/unpacking git+https://github.com/bivab/smbus-cffi.git

Cloning https://github.com/bivab/smbus-cffi.git to /tmp/pip-NGDOQl-build

Found command 'git' at '/usr/bin/git' Running command /usr/bin/git clone -q https://github.com/bivab/smbus-cffi.git /tmp/pip-NGDOQl-build Running setup.py egg_info for package from git+https://github.com/bivab/smbus-cffi.git

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_access’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:31:3: warning: implicit declaration of function ‘i2c_smbus_access’ [-Wimplicit-function-declaration]

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_process_call’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:36:3: warning: implicit declaration of function ‘i2c_smbus_process_call’ [-Wimplicit-function-declaration]

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_read_byte’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:41:3: warning: implicit declaration of function ‘i2c_smbus_read_byte’ [-Wimplicit-function-declaration]

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_read_byte_data’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:46:3: warning: implicit declaration of function ‘i2c_smbus_read_byte_data’ [-Wimplicit-function-declaration]

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_read_word_data’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:51:3: warning: implicit declaration of function ‘i2c_smbus_read_word_data’ [-Wimplicit-function-declaration]

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_write_byte’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:56:3: warning: implicit declaration of function ‘i2c_smbus_write_byte’ [-Wimplicit-function-declaration]

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_write_byte_data’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:61:3: warning: implicit declaration of function ‘i2c_smbus_write_byte_data’ [-Wimplicit-function-declaration]

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_write_quick’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:66:3: warning: implicit declaration of function ‘i2c_smbus_write_quick’ [-Wimplicit-function-declaration]

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_write_word_data’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:71:3: warning: implicit declaration of function ‘i2c_smbus_write_word_data’ [-Wimplicit-function-declaration]

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_BLOCK_DATA’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:88:28: error: ‘I2C_SMBUS_BLOCK_DATA’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:88:28: note: each undeclared identifier is reported only once for each function it appears in

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_BLOCK_MAX’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:94:28: error: ‘I2C_SMBUS_BLOCK_MAX’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_BLOCK_PROC_CALL’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:100:28: error: ‘I2C_SMBUS_BLOCK_PROC_CALL’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_BYTE’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:106:28: error: ‘I2C_SMBUS_BYTE’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_BYTE_DATA’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:112:28: error: ‘I2C_SMBUS_BYTE_DATA’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_I2C_BLOCK_BROKEN’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:118:28: error: ‘I2C_SMBUS_I2C_BLOCK_BROKEN’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_I2C_BLOCK_DATA’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:124:28: error: ‘I2C_SMBUS_I2C_BLOCK_DATA’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_PROC_CALL’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:130:28: error: ‘I2C_SMBUS_PROC_CALL’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_QUICK’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:136:28: error: ‘I2C_SMBUS_QUICK’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_READ’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:142:28: error: ‘I2C_SMBUS_READ’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_WORD_DATA’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:148:28: error: ‘I2C_SMBUS_WORD_DATA’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_WRITE’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:154:28: error: ‘I2C_SMBUS_WRITE’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_check_union_i2c_smbus_data’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:161:12: error: dereferencing pointer to incomplete type

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:162:12: error: dereferencing pointer to incomplete type

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:163:33: error: dereferencing pointer to incomplete type

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_layout_union_i2c_smbus_data’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:167:58: error: field ‘y’ has incomplete type

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:169:12: error: invalid application of ‘sizeof’ to incomplete type ‘union i2c_smbus_data’

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:171:5: error: invalid use of undefined type ‘union i2c_smbus_data’

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:172:39: error: dereferencing pointer to incomplete type

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:173:5: error: invalid use of undefined type ‘union i2c_smbus_data’

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:174:39: error: dereferencing pointer to incomplete type

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:175:5: error: invalid use of undefined type ‘union i2c_smbus_data’

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:176:39: error: dereferencing pointer to incomplete type

Traceback (most recent call last):

  File "app_main.py", line 72, in run_toplevel

  File "app_main.py", line 578, in run_it

  File "<string>", line 16, in <module>

  File "/tmp/pip-NGDOQl-build/setup.py", line 7, in <module>

    import smbus

  File "smbus/__init__.py", line 1, in <module>

    from .smbus import ffi

  File "smbus/smbus.py", line 93, in <module>

    """, ext_package='smbus')

  File "/usr/local/pypy/lib_pypy/cffi/api.py", line 339, in verify

    lib = self.verifier.load_library()

  File "/usr/local/pypy/lib_pypy/cffi/verifier.py", line 74, in load_library

    self._compile_module()

  File "/usr/local/pypy/lib_pypy/cffi/verifier.py", line 139, in _compile_module

    outputfilename = ffiplatform.compile(tmpdir, self.get_extension())

  File "/usr/local/pypy/lib_pypy/cffi/ffiplatform.py", line 25, in compile

    outputfilename = _build(tmpdir, ext)

  File "/usr/local/pypy/lib_pypy/cffi/ffiplatform.py", line 50, in _build

    raise VerificationError('%s: %s' % (e.__class__.__name__, e))

VerificationError: CompileError: command 'cc' failed with exit status 1

Complete output from command python setup.py egg_info:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_access’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:31:3: warning: implicit declaration of function ‘i2c_smbus_access’ [-Wimplicit-function-declaration]

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_process_call’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:36:3: warning: implicit declaration of function ‘i2c_smbus_process_call’ [-Wimplicit-function-declaration]

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_read_byte’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:41:3: warning: implicit declaration of function ‘i2c_smbus_read_byte’ [-Wimplicit-function-declaration]

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_read_byte_data’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:46:3: warning: implicit declaration of function ‘i2c_smbus_read_byte_data’ [-Wimplicit-function-declaration]

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_read_word_data’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:51:3: warning: implicit declaration of function ‘i2c_smbus_read_word_data’ [-Wimplicit-function-declaration]

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_write_byte’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:56:3: warning: implicit declaration of function ‘i2c_smbus_write_byte’ [-Wimplicit-function-declaration]

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_write_byte_data’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:61:3: warning: implicit declaration of function ‘i2c_smbus_write_byte_data’ [-Wimplicit-function-declaration]

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_write_quick’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:66:3: warning: implicit declaration of function ‘i2c_smbus_write_quick’ [-Wimplicit-function-declaration]

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_write_word_data’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:71:3: warning: implicit declaration of function ‘i2c_smbus_write_word_data’ [-Wimplicit-function-declaration]

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_BLOCK_DATA’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:88:28: error: ‘I2C_SMBUS_BLOCK_DATA’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c:88:28: note: each undeclared identifier is reported only once for each function it appears in

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_BLOCK_MAX’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:94:28: error: ‘I2C_SMBUS_BLOCK_MAX’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_BLOCK_PROC_CALL’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:100:28: error: ‘I2C_SMBUS_BLOCK_PROC_CALL’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_BYTE’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:106:28: error: ‘I2C_SMBUS_BYTE’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_BYTE_DATA’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:112:28: error: ‘I2C_SMBUS_BYTE_DATA’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_I2C_BLOCK_BROKEN’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:118:28: error: ‘I2C_SMBUS_I2C_BLOCK_BROKEN’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_I2C_BLOCK_DATA’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:124:28: error: ‘I2C_SMBUS_I2C_BLOCK_DATA’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_PROC_CALL’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:130:28: error: ‘I2C_SMBUS_PROC_CALL’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_QUICK’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:136:28: error: ‘I2C_SMBUS_QUICK’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_READ’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:142:28: error: ‘I2C_SMBUS_READ’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_WORD_DATA’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:148:28: error: ‘I2C_SMBUS_WORD_DATA’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_WRITE’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:154:28: error: ‘I2C_SMBUS_WRITE’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_check_union_i2c_smbus_data’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:161:12: error: dereferencing pointer to incomplete type

smbus/pycache/_cffi__gd005eae8x42de6d31.c:162:12: error: dereferencing pointer to incomplete type

smbus/pycache/_cffi__gd005eae8x42de6d31.c:163:33: error: dereferencing pointer to incomplete type

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_layout_union_i2c_smbus_data’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:167:58: error: field ‘y’ has incomplete type

smbus/pycache/_cffi__gd005eae8x42de6d31.c:169:12: error: invalid application of ‘sizeof’ to incomplete type ‘union i2c_smbus_data’

smbus/pycache/_cffi__gd005eae8x42de6d31.c:171:5: error: invalid use of undefined type ‘union i2c_smbus_data’

smbus/pycache/_cffi__gd005eae8x42de6d31.c:172:39: error: dereferencing pointer to incomplete type

smbus/pycache/_cffi__gd005eae8x42de6d31.c:173:5: error: invalid use of undefined type ‘union i2c_smbus_data’

smbus/pycache/_cffi__gd005eae8x42de6d31.c:174:39: error: dereferencing pointer to incomplete type

smbus/pycache/_cffi__gd005eae8x42de6d31.c:175:5: error: invalid use of undefined type ‘union i2c_smbus_data’

smbus/pycache/_cffi__gd005eae8x42de6d31.c:176:39: error: dereferencing pointer to incomplete type

Traceback (most recent call last):

File "app_main.py", line 72, in run_toplevel

File "app_main.py", line 578, in run_it

File "", line 16, in

File "/tmp/pip-NGDOQl-build/setup.py", line 7, in

import smbus

File "smbus/init.py", line 1, in

from .smbus import ffi

File "smbus/smbus.py", line 93, in

""", ext_package='smbus')

File "/usr/local/pypy/lib_pypy/cffi/api.py", line 339, in verify

lib = self.verifier.load_library()

File "/usr/local/pypy/lib_pypy/cffi/verifier.py", line 74, in load_library

self._compile_module()

File "/usr/local/pypy/lib_pypy/cffi/verifier.py", line 139, in _compile_module

outputfilename = ffiplatform.compile(tmpdir, self.get_extension())

File "/usr/local/pypy/lib_pypy/cffi/ffiplatform.py", line 25, in compile

outputfilename = _build(tmpdir, ext)

File "/usr/local/pypy/lib_pypy/cffi/ffiplatform.py", line 50, in _build

raise VerificationError('%s: %s' % (e.__class__.__name__, e))

VerificationError: CompileError: command 'cc' failed with exit status 1


Cleaning up...

Removing temporary dir /tmp/pip_build_root... Command python setup.py egg_info failed with error code 1 in /tmp/pip-NGDOQl-build

Exception information: Traceback (most recent call last): File "/usr/local/pypy/site-packages/pip/basecommand.py", line 134, in main status = self.run(options, args) File "/usr/local/pypy/site-packages/pip/commands/install.py", line 236, in run requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) File "/usr/local/pypy/site-packages/pip/req.py", line 1134, in prepare_files req_to_install.run_egg_info() File "/usr/local/pypy/site-packages/pip/req.py", line 259, in run_egg_info command_desc='python setup.py egg_info') File "/usr/local/pypy/site-packages/pip/util.py", line 670, in call_subprocess % (command_desc, proc.returncode, cwd)) InstallationError: Command python setup.py egg_info failed with error code 1 in /tmp/pip-NGDOQl-build

bivab commented 10 years ago

Hi, thanks for reporting. Running the module from the repository for the first compiles some code that includes the i2c-dev headers that should contain the smbus definitions. If those are missing you probably are missing a dependency, like libi2c-dev or i2c-tools(-dev).

Can you check here if there is information for the distribution you are using and report back if that helps? Thanks.

bivab commented 10 years ago

I'm closing this for now, please reopen if the issue remains