cournape/Bento

Many Bento/examples are broken

pchanial opened this issue · 5 comments

Assuming my Bento installation is working, the following examples fail (0.1.x branch):

simples/conditional:

bentomaker: Error: bentomaker crashed (uncaught exception <class 'yaku.errors.TaskRunFailure'>: Command failed. Error was: 
    /usr/bin/ld: src/hellomodule.c.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
src/hellomodule.c.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
command line was
    'gcc -shared -o /home/pchanial/software/src/Bento/examples/simples/conditional/build/hello/_bar.so src/hellomodule.c.o -g').

simples/single_extension:
after applying this patch:

--- a/examples/simples/single_extension/bscript
+++ b/examples/simples/single_extension/bscript
@@ -1,6 +1,5 @@
 import os
-
-from bento.commands.context \
+from bento.backends.distutils_backend \
     import \
         DistutilsBuildContext, DistutilsConfigureContext

bentomaker fails with the same error message as above

simples/single_extension_waf: "bentomaker configure" fails with

Could not import hook file '/home/pchanial/software/src/Bento/examples/simples/single_extension_waf/bscript': caught exception ImportError('No module named extras.waf',)
Original traceback (most recent call last)
  File "/home/pchanial/software/lib/python2.7/site-packages/bento/commands/hooks.py", line 208, in create_hook_module
    exec(compile(code, main_file, 'exec'), module.__dict__)
  File "/home/pchanial/software/src/Bento/examples/simples/single_extension_waf/bscript", line 6, in <module>
    from bento.commands.extras.waf \

hooks/waf/waf16:

Could not import hook file '/home/pchanial/software/src/Bento/examples/hooks/waf/waf16/bscript': caught exception ImportError('cannot import name override',)
Original traceback (most recent call last)
  File "/home/pchanial/software/lib/python2.7/site-packages/bento/commands/hooks.py", line 208, in create_hook_module
    exec(compile(code, main_file, 'exec'), module.__dict__)
  File "/home/pchanial/software/src/Bento/examples/hooks/waf/waf16/bscript", line 5, in <module>
    from bento.commands.hooks \

hooks/simple: "bentomaker test" fails:

Could not import hook file '/home/pchanial/software/src/Bento/examples/hooks/simple/bscript': caught exception ImportError('No module named utils',)
Original traceback (most recent call last)
  File "/home/pchanial/software/lib/python2.7/site-packages/bento/commands/hooks.py", line 208, in create_hook_module
    exec(compile(code, main_file, 'exec'), module.__dict__)
  File "/home/pchanial/software/src/Bento/examples/hooks/simple/bscript", line 3, in <module>
    from bento.core.utils import pprint

The following work:

simples/single_module

simples/single_package

I haven't tried the other examples.

Hi Pierre,

All the examples should be fixed now in master

David

On Mon, Jul 2, 2012 at 1:27 PM, Pierre Chanial
reply@reply.github.com
wrote:

Assuming my Bento installation is working, the following examples fail (0.1.x branch):

simples/conditional:

bentomaker: Error: bentomaker crashed (uncaught exception <class 'yaku.errors.TaskRunFailure'>: Command failed. Error was:
        /usr/bin/ld: src/hellomodule.c.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
src/hellomodule.c.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
command line was
        'gcc -shared -o /home/pchanial/software/src/Bento/examples/simples/conditional/build/hello/_bar.so src/hellomodule.c.o -g').

simples/single_extension:
after applying this patch:

--- a/examples/simples/single_extension/bscript
+++ b/examples/simples/single_extension/bscript
@@ -1,6 +1,5 @@
 import os
-
-from bento.commands.context \
+from bento.backends.distutils_backend \
     import \
         DistutilsBuildContext, DistutilsConfigureContext

bentomaker fails with the same error message as above

simples/single_extension_waf: "bentomaker configure" fails with

Could not import hook file '/home/pchanial/software/src/Bento/examples/simples/single_extension_waf/bscript': caught exception ImportError('No module named extras.waf',)
Original traceback (most recent call last)
  File "/home/pchanial/software/lib/python2.7/site-packages/bento/commands/hooks.py", line 208, in create_hook_module
    exec(compile(code, main_file, 'exec'), module.__dict__)
  File "/home/pchanial/software/src/Bento/examples/simples/single_extension_waf/bscript", line 6, in <module>
    from bento.commands.extras.waf \

hooks/waf/waf16:

Could not import hook file '/home/pchanial/software/src/Bento/examples/hooks/waf/waf16/bscript': caught exception ImportError('cannot import name override',)
Original traceback (most recent call last)
  File "/home/pchanial/software/lib/python2.7/site-packages/bento/commands/hooks.py", line 208, in create_hook_module
    exec(compile(code, main_file, 'exec'), module.__dict__)
  File "/home/pchanial/software/src/Bento/examples/hooks/waf/waf16/bscript", line 5, in <module>
    from bento.commands.hooks \

hooks/simple: "bentomaker test" fails:

Could not import hook file '/home/pchanial/software/src/Bento/examples/hooks/simple/bscript': caught exception ImportError('No module named utils',)
Original traceback (most recent call last)
  File "/home/pchanial/software/lib/python2.7/site-packages/bento/commands/hooks.py", line 208, in create_hook_module
    exec(compile(code, main_file, 'exec'), module.__dict__)
  File "/home/pchanial/software/src/Bento/examples/hooks/simple/bscript", line 3, in <module>
    from bento.core.utils import pprint

The following work:

simples/single_module

simples/single_package

I haven't tried the other examples.


Reply to this email directly or view it on GitHub:
#116

Nice way to declare a command with a decorator.
It looks odd though to have to pick up pprint from bento.utils.utils instead of bento.utils
There are still a couple of failures, when running check_examples.py

installing bentomaker in current directory
installing bentomaker-2.7 in current directory
=============== testing examples/customizations/new_builder ==============
Succeeded
=============== testing examples/simples/single_extension_waf ==============
Succeeded
=============== testing examples/simples/conditional ==============
bentomaker: Error: bentomaker crashed (uncaught exception <class 'yaku.errors.TaskRunFailure'>: Command failed. Error was: 
    /usr/bin/ld: src/hellomodule.c.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
src/hellomodule.c.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
command line was
    'gcc -shared -o /home/pchanial/software/src/Bento/examples/simples/conditional/build/hello/_bar.so src/hellomodule.c.o -g').
Please report this on bento issue tracker:
    http://github.com/cournape/bento/issues
You can get a full traceback by setting BENTOMAKER_DEBUG=1
Looking for gcc (c compiler) ... yes
Checking whether gcc can build objects... yes
Checking whether gcc can build programs... yes
Checking whether gcc can build static libraries... yes
Checking whether gcc can link static libraries to exe... yes
Checking whether gcc can build shared libraries... yes
Checking whether gcc can link shared libraries to exe... yes
Detecting distutils CC exec ... gcc
Detecting CC type... gcc
Detecting distutils CXX exec ... g++ -pthread
Detecting CC type... gcc
Checking whether default can build python object code... yes
Checking whether default can build python extension... yes
PYCC            ../src/hellomodule.c
PYLINK          src/hellomodule.c.o

Failed
=============== testing examples/simples/executable ==============
Succeeded
=============== testing examples/simples/single_extension ==============
Succeeded
=============== testing examples/simples/single_module ==============
Succeeded
=============== testing examples/simples/single_package ==============
Succeeded
=============== testing examples/simples/datafiles ==============
Succeeded
=============== testing examples/simples/config_py ==============
Succeeded
=============== testing examples/hooks/simple ==============
Succeeded
=============== testing examples/hooks/customization ==============
Looking for cython... yes
warning: /home/pchanial/software/src/Bento/examples/hooks/customization/src/heap.pyx:38:0: 'stdlib' is deprecated, use 'libc.stdlib'
bentomaker: Error: bentomaker crashed (uncaught exception <class 'yaku.errors.TaskRunFailure'>: Command failed. Error was: 
    /usr/bin/ld: src/hellomodule.c.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
src/hellomodule.c.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
command line was
    'gcc -shared -o /home/pchanial/software/src/Bento/examples/hooks/customization/build/hello/_bar.so src/hellomodule.c.o -g').
Please report this on bento issue tracker:
    http://github.com/cournape/bento/issues
You can get a full traceback by setting BENTOMAKER_DEBUG=1
Looking for gcc (c compiler) ... yes
Checking whether gcc can build objects... yes
Checking whether gcc can build programs... yes
Checking whether gcc can build static libraries... yes
Checking whether gcc can link static libraries to exe... yes
Checking whether gcc can build shared libraries... yes
Checking whether gcc can link shared libraries to exe... yes
Detecting distutils CC exec ... gcc
Detecting CC type... gcc
Detecting distutils CXX exec ... g++ -pthread
Detecting CC type... gcc
Checking whether default can build python object code... yes
Checking whether default can build python extension... yes
CYTHON          ../src/heap.pyx
PYCC            ../src/hellomodule.c
PYCC            src/heap.c
PYLINK          src/hellomodule.c.o

Failed
=============== testing examples/hooks/distutils ==============
Succeeded
=============== testing examples/recursive/simple ==============
bentomaker: Error: bentomaker crashed (uncaught exception <class 'yaku.errors.TaskRunFailure'>: Command failed. Error was: 
    /usr/bin/ld: src/hellomodule.c.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
src/hellomodule.c.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
command line was
    'gcc -shared -o /home/pchanial/software/src/Bento/examples/recursive/simple/build/_top.so src/hellomodule.c.o -g').
Please report this on bento issue tracker:
    http://github.com/cournape/bento/issues
You can get a full traceback by setting BENTOMAKER_DEBUG=1
Top extensions: _top
All extensions: _top, foo._bottom, bar._bottom2
Local extensions for bar: _bottom2
Looking for gcc (c compiler) ... yes
Checking whether gcc can build objects... yes
Checking whether gcc can build programs... yes
Checking whether gcc can build static libraries... yes
Checking whether gcc can link static libraries to exe... yes
Checking whether gcc can build shared libraries... yes
Checking whether gcc can link shared libraries to exe... yes
Detecting distutils CC exec ... gcc
Detecting CC type... gcc
Detecting distutils CXX exec ... g++ -pthread
Detecting CC type... gcc
Checking whether default can build python object code... yes
Checking whether default can build python extension... yes
PYCC            ../src/hellomodule.c
PYCC            ../foo/src/hellomodule.c
PYCC            ../bar/src/hellomodule.c
PYLINK          src/hellomodule.c.o

Failed
=============== testing examples/recursive/deep ==============
Traceback (most recent call last):
  File "check_examples.py", line 51, in <module>
    if not test_package(test):
  File "check_examples.py", line 40, in test_package
    if _run():
  File "check_examples.py", line 32, in _run
    print(p.stdout.read().decode())
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 35: ordinal not in range(128)

I don't understand why I don't get udpates on bento issues.

Anyway, the build-related errors are caused by the internal build tool yaku that I am hoping to scrape completely soon. The decode issue keeps telling me I need to learn about this thing called unicode and to handle it correctly :)

I found this issue after I received the same error about using -fPIC trying to build numpy. This is with current bento master. User error?

simples/conditional

$ bentomaker configure
...
$ bentomaker build
Looking for gcc (c compiler) ... yes
Checking whether gcc can build objects... yes
Checking whether gcc can build programs... yes
Checking whether gcc can build static libraries... yes                          
Checking whether gcc can link static libraries to exe... yes                    
Checking whether gcc can build shared libraries... yes                          
Checking whether gcc can link shared libraries to exe... yes                    
Detecting distutils CC exec ... gcc
Detecting CC type... gcc
Detecting distutils CXX exec ... g++ -pthread
Detecting CC type... gcc
Checking whether default can build python object code... yes
Checking whether default can build python extension... yes
PYCC            ../src/hellomodule.c
PYLINK          src/hellomodule.c.o
bentomaker: Error: bentomaker crashed (uncaught exception <class 'yaku.errors.TaskRunFailure'>: Command failed. Error was: 
        /usr/bin/ld: src/hellomodule.c.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
src/hellomodule.c.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
command line was
        'gcc -shared -o /home/skipper/src/bento/examples/simples/conditional/build/hello/_bar.so src/hellomodule.c.o -Wl,-Bsymbolic-functions -Wl,-z,relro').
Please report this on bento issue tracker:
    http://github.com/cournape/bento/issues
You can get a full traceback by setting BENTOMAKER_DEBUG=1

For completeness the whole check_examples

|18 $ python check_examples.py 
installing bentomaker in current directory
installing bentomaker-2.7 in current directory
=============== testing examples/build_customization ==============
Succeeded
=============== testing examples/hooks/simple ==============
Succeeded
=============== testing examples/hooks/customization ==============
Looking for cython... yes
bentomaker: Error: bentomaker crashed (uncaught exception <type 'exceptions.KeyError'>: 'PYTHONPATH').
Please report this on bento issue tracker:
    http://github.com/cournape/bento/issues
You can get a full traceback by setting BENTOMAKER_DEBUG=1
Looking for gcc (c compiler) ... yes
Checking whether gcc can build objects... yes
Checking whether gcc can build programs... yes
Checking whether gcc can build static libraries... yes
Checking whether gcc can link static libraries to exe... yes
Checking whether gcc can build shared libraries... yes
Checking whether gcc can link shared libraries to exe... yes
Detecting distutils CC exec ... gcc
Detecting CC type... gcc
Detecting distutils CXX exec ... g++ -pthread
Detecting CC type... gcc
Checking whether default can build python object code... yes
Checking whether default can build python extension... yes

Failed
=============== testing examples/hooks/distutils ==============
Succeeded
=============== testing examples/var_example ==============
bentomaker: Error: bentomaker crashed (uncaught exception <class 'yaku.errors.TaskRunFailure'>: Command failed. Error was: 
        /usr/bin/ld: _foo.c.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
_foo.c.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
command line was
        'gcc -shared -o /home/skipper/src/bento/examples/var_example/build/_foo.so _foo.c.o -Wl,-Bsymbolic-functions -Wl,-z,relro').
Please report this on bento issue tracker:
    http://github.com/cournape/bento/issues
You can get a full traceback by setting BENTOMAKER_DEBUG=1
Looking for gcc (c compiler) ... yes
Checking whether gcc can build objects... yes
Checking whether gcc can build programs... yes
Checking whether gcc can build static libraries... yes
Checking whether gcc can link static libraries to exe... yes
Checking whether gcc can build shared libraries... yes
Checking whether gcc can link shared libraries to exe... yes
Detecting distutils CC exec ... gcc
Detecting CC type... gcc
Detecting distutils CXX exec ... g++ -pthread
Detecting CC type... gcc
Checking whether default can build python object code... yes
Checking whether default can build python extension... yes
PYCC            ../_foo.c
PYLINK          _foo.c.o

Failed
=============== testing examples/customizations/new_builder ==============
Succeeded
=============== testing examples/recursive/deep ==============
../foo/bar2/src/foo.c: In function ‘foo’:
../foo/bar2/src/foo.c:3:1: warning: control reaches end of non-void function [-Wreturn-type]
bentomaker: Error: bentomaker crashed (uncaught exception <class 'yaku.errors.TaskRunFailure'>: Command failed. Error was: 
        /usr/bin/ld: src/hellomodule.c.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
src/hellomodule.c.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
command line was
        'gcc -shared -o /home/skipper/src/bento/examples/recursive/deep/build/foo/bar3/_hello.so src/hellomodule.c.o -Wl,-Bsymbolic-functions -Wl,-z,relro').
Please report this on bento issue tracker:
    http://github.com/cournape/bento/issues
You can get a full traceback by setting BENTOMAKER_DEBUG=1
Looking for gcc (c compiler) ... yes
Checking whether gcc can build objects... yes
Checking whether gcc can build programs... yes
Checking whether gcc can build static libraries... yes
Checking whether gcc can link static libraries to exe... yes
Checking whether gcc can build shared libraries... yes
Checking whether gcc can link shared libraries to exe... yes
Detecting distutils CC exec ... gcc
Detecting CC type... gcc
Detecting distutils CXX exec ... g++ -pthread
Detecting CC type... gcc
Checking whether default can build python object code... yes
Checking whether default can build python extension... yes
Configure: /home/skipper/src/bento/examples/recursive/deep/foo/bar2/fubar/bscript
Src dir is /home/skipper/src/bento/examples/recursive/deep/foo/bar2/fubar
Configure: /home/skipper/src/bento/examples/recursive/deep/foo/bar2/bscript
Configure: /home/skipper/src/bento/examples/recursive/deep/foo/bar1/bscript
PYCC            ../src/hellomodule.c
PYCC            ../foo/src/hellomodule.c
PYCC            ../foo/bar2/fubar/src/hellomodule.c
CC              ../foo/bar2/src/foo.c
CC_STLINK       foo/bar2/src/foo.c.o
PYLINK          src/hellomodule.c.o

Failed
=============== testing examples/recursive/simple ==============
../foo/src/hellomodule.c: In function ‘hello’:
../foo/src/hellomodule.c:5:17: warning: unused parameter ‘self’ [-Wunused-parameter]
../foo/src/hellomodule.c:5:33: warning: unused parameter ‘args’ [-Wunused-parameter]
bentomaker: Error: bentomaker crashed (uncaught exception <class 'yaku.errors.TaskRunFailure'>: Command failed. Error was: 
        /usr/bin/ld: src/hellomodule.c.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
src/hellomodule.c.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
command line was
        'gcc -shared -o /home/skipper/src/bento/examples/recursive/simple/build/_top.so src/hellomodule.c.o -Wl,-Bsymbolic-functions -Wl,-z,relro').
Please report this on bento issue tracker:
    http://github.com/cournape/bento/issues
You can get a full traceback by setting BENTOMAKER_DEBUG=1
Top extensions: _top
All extensions: _top, foo._bottom, bar._bottom2
Local extensions for bar: _bottom2
Looking for gcc (c compiler) ... yes
Checking whether gcc can build objects... yes
Checking whether gcc can build programs... yes
Checking whether gcc can build static libraries... yes
Checking whether gcc can link static libraries to exe... yes
Checking whether gcc can build shared libraries... yes
Checking whether gcc can link shared libraries to exe... yes
Detecting distutils CC exec ... gcc
Detecting CC type... gcc
Detecting distutils CXX exec ... g++ -pthread
Detecting CC type... gcc
Checking whether default can build python object code... yes
Checking whether default can build python extension... yes
PYCC            ../src/hellomodule.c
PYCC            ../foo/src/hellomodule.c
PYCC            ../bar/src/hellomodule.c
PYLINK          src/hellomodule.c.o

Failed
=============== testing examples/simples/conditional ==============
bentomaker: Error: bentomaker crashed (uncaught exception <class 'yaku.errors.TaskRunFailure'>: Command failed. Error was: 
        /usr/bin/ld: src/hellomodule.c.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
src/hellomodule.c.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
command line was
        'gcc -shared -o /home/skipper/src/bento/examples/simples/conditional/build/hello/_bar.so src/hellomodule.c.o -Wl,-Bsymbolic-functions -Wl,-z,relro').
Please report this on bento issue tracker:
    http://github.com/cournape/bento/issues
You can get a full traceback by setting BENTOMAKER_DEBUG=1
Looking for gcc (c compiler) ... yes
Checking whether gcc can build objects... yes
Checking whether gcc can build programs... yes
Checking whether gcc can build static libraries... yes
Checking whether gcc can link static libraries to exe... yes
Checking whether gcc can build shared libraries... yes
Checking whether gcc can link shared libraries to exe... yes
Detecting distutils CC exec ... gcc
Detecting CC type... gcc
Detecting distutils CXX exec ... g++ -pthread
Detecting CC type... gcc
Checking whether default can build python object code... yes
Checking whether default can build python extension... yes
PYCC            ../src/hellomodule.c
PYLINK          src/hellomodule.c.o

Failed
=============== testing examples/simples/single_extension ==============
Succeeded
=============== testing examples/simples/executable ==============
Succeeded
=============== testing examples/simples/config_py ==============
Succeeded
=============== testing examples/simples/single_module ==============
Succeeded
=============== testing examples/simples/single_package ==============
Succeeded
=============== testing examples/simples/datafiles ==============
Succeeded
=============== testing examples/simples/single_extension_waf ==============
Succeeded
5 / 16 example failed