[SciPy-User] Weave compilation woes: 'multiple definition of '_end''

Patrick Mineault patrick.mineault at gmail.com
Sat Apr 20 20:01:24 EDT 2013


I'm trying to get weave running on a 64-bit Ubuntu 11.10 install, as I'm
using a library (spearmint) which depends on it. The library refuses to
run, giving me a g++ error, so I checked the weave configuration. Running
weave.test works fine:


>>> import scipy.weave
> >>> scipy.weave.test()
> Running unit tests for scipy.weave
> NumPy version 1.5.1
> NumPy is installed in /usr/lib/pymodules/python2.7/numpy
> SciPy version 0.12.0
> SciPy is installed in /usr/local/lib/python2.7/dist-packages/scipy
> Python version 2.7.2+ (default, Jul 20 2012, 22:15:08) [GCC 4.6.1]
> nose version 1.0.0
>
> ........................................................................................................................................
> ----------------------------------------------------------------------
> Ran 136 tests in 1.658s
>
> OK
> <nose.result.TextTestResult run=136 errors=0 failures=0>
>


Some of the examples in scipy/weave/examples work too, like binary_search,
albeit with a few warnings:

patrick at packpatricklinux:/usr/local/lib/python2.7/dist-packages/scipy/weave$
> python
> /usr/local/lib/python2.7/dist-packages/scipy/weave/examples/binary_search.py
>
> Binary search for 50000 items in 100000 length list of integers:
>  speed in python: 0.193926095963
>  speed of bisect: 0.0424749851227
>  speed up: 4.57
> <weave: compiling>
> running build_ext
> running build_src
> build_src
> building extension "sc_ed14cc6c23f0bead753206178f55fedf1" sources
> build_src: building npy-pkg config files
> customize UnixCCompiler
> customize UnixCCompiler using build_ext
> customize UnixCCompiler
> customize UnixCCompiler using build_ext
> building 'sc_ed14cc6c23f0bead753206178f55fedf1' extension
> compiling C++ sources
> C compiler: g++ -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -fPIC
>
> compile options: '-I/usr/local/lib/python2.7/dist-packages/scipy/weave
> -I/usr/local/lib/python2.7/dist-packages/scipy/weave/scxx
> -I/usr/lib/pymodules/python2.7/numpy/core/include -I/usr/include/python2.7
> -c'
> g++: /usr/local/lib/python2.7/dist-packages/scipy/weave/scxx/weave_imp.cpp
> g++:
> /home/patrick/.python27_compiled/sc_ed14cc6c23f0bead753206178f55fedf1.cpp
> g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
> -Wl,-Bsymbolic-functions
> /tmp/patrick/python27_intermediate/compiler_aa001b8a6f0e3d090bc9a3710745b2f8/home/patrick/.python27_compiled/sc_ed14cc6c23f0bead753206178f55fedf1.o
> /tmp/patrick/python27_intermediate/compiler_aa001b8a6f0e3d090bc9a3710745b2f8/usr/local/lib/python2.7/dist-packages/scipy/weave/scxx/weave_imp.o
> -o /home/patrick/.python27_compiled/sc_ed14cc6c23f0bead753206178f55fedf1.so
> running scons
>  speed in c: 0.0843539237976
>  speed up: 2.30
>  speed in c(no asserts): 0.0844378471375
>  speed up: 2.30
> <weave: compiling>
> running build_ext
> running build_src
> build_src
> building extension "sc_cc760b308ce9a978d2eb41b2f6b4f0d11" sources
> build_src: building npy-pkg config files
> customize UnixCCompiler
> customize UnixCCompiler using build_ext
> customize UnixCCompiler
> customize UnixCCompiler using build_ext
> building 'sc_cc760b308ce9a978d2eb41b2f6b4f0d11' extension
> compiling C++ sources
> C compiler: g++ -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -fPIC
>
> compile options: '-I/usr/local/lib/python2.7/dist-packages/scipy/weave
> -I/usr/local/lib/python2.7/dist-packages/scipy/weave/scxx
> -I/usr/lib/pymodules/python2.7/numpy/core/include -I/usr/include/python2.7
> -c'
> g++:
> /home/patrick/.python27_compiled/sc_cc760b308ce9a978d2eb41b2f6b4f0d11.cpp
> g++: /usr/local/lib/python2.7/dist-packages/scipy/weave/scxx/weave_imp.cpp
> g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
> -Wl,-Bsymbolic-functions
> /tmp/patrick/python27_intermediate/compiler_aa001b8a6f0e3d090bc9a3710745b2f8/home/patrick/.python27_compiled/sc_cc760b308ce9a978d2eb41b2f6b4f0d11.o
> /tmp/patrick/python27_intermediate/compiler_aa001b8a6f0e3d090bc9a3710745b2f8/usr/local/lib/python2.7/dist-packages/scipy/weave/scxx/weave_imp.o
> -o /home/patrick/.python27_compiled/sc_cc760b308ce9a978d2eb41b2f6b4f0d11.so
> running scons
>  speed for scxx: 0.105831861496
>  speed up: 1.83
>  speed for scxx(no asserts): 0.0926380157471
>  speed up: 2.09
> <weave: compiling>
> running build_ext
> running build_src
> build_src
> building extension "sc_498c4885708b1863d6add0a5eadc8a7c1" sources
> build_src: building npy-pkg config files
> customize UnixCCompiler
> customize UnixCCompiler using build_ext
> customize UnixCCompiler
> customize UnixCCompiler using build_ext
> building 'sc_498c4885708b1863d6add0a5eadc8a7c1' extension
> compiling C++ sources
> C compiler: g++ -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -fPIC
>
> compile options: '-I/usr/local/lib/python2.7/dist-packages/scipy/weave
> -I/usr/local/lib/python2.7/dist-packages/scipy/weave/scxx
> -I/usr/lib/pymodules/python2.7/numpy/core/include -I/usr/include/python2.7
> -c'
> extra options: '-O2 -G6'
> g++:
> /home/patrick/.python27_compiled/sc_498c4885708b1863d6add0a5eadc8a7c1.cpp
> g++: error: unrecognized option ‘-G6’
> g++: error: unrecognized option ‘-G6’
> search(a,3450) 3450 3450 3450
> search(a,-1) -1 -1 0
> search(a,10001) 10001 10001 10001
>

However, there appears to be something wrong with blitz inline, as running
the array3d.py example shows:

patrick at packpatricklinux:/usr/local/lib/python2.7/dist-packages/scipy/weave$
> python
> /usr/local/lib/python2.7/dist-packages/scipy/weave/examples/array3d.py
> numpy:
> [[[ 0  1  2  3]
>   [ 4  5  6  7]
>   [ 8  9 10 11]]
>
>  [[12 13 14 15]
>   [16 17 18 19]
>   [20 21 22 23]]]
> Pure Inline:
> img[  0][  0]=   0   1   2   3
> img[  0][  1]=   4   5   6   7
> img[  0][  2]=   8   9  10  11
> img[  1][  0]=  12  13  14  15
> img[  1][  1]=  16  17  18  19
> img[  1][  2]=  20  21  22  23
> Blitz Inline:
> /usr/bin/ld: error: linker defined: multiple definition of '_end'
> /usr/bin/ld:
> /tmp/patrick/python27_intermediate/compiler_aa001b8a6f0e3d090bc9a3710745b2f8/home/patrick/.python27_compiled/sc_49e94d1bdd1ad16917064c910093194f1.o:
> previous definition here
> collect2: ld returned 1 exit status
> /usr/bin/ld: error: linker defined: multiple definition of '_end'
> /usr/bin/ld:
> /tmp/patrick/python27_intermediate/compiler_aa001b8a6f0e3d090bc9a3710745b2f8/home/patrick/.python27_compiled/sc_49e94d1bdd1ad16917064c910093194f1.o:
> previous definition here
> collect2: ld returned 1 exit status
> Traceback (most recent call last):
>   File
> "/usr/local/lib/python2.7/dist-packages/scipy/weave/examples/array3d.py",
> line 106, in <module>
>     main()
>   File
> "/usr/local/lib/python2.7/dist-packages/scipy/weave/examples/array3d.py",
> line 102, in main
>     blitz_inline(arr)
>   File
> "/usr/local/lib/python2.7/dist-packages/scipy/weave/examples/array3d.py",
> line 90, in blitz_inline
>     weave.inline(code, ['arr'], type_converters=converters.blitz)
>   File
> "/usr/local/lib/python2.7/dist-packages/scipy/weave/inline_tools.py", line
> 357, in inline
>     **kw)
>   File
> "/usr/local/lib/python2.7/dist-packages/scipy/weave/inline_tools.py", line
> 484, in compile_function
>     verbose=verbose, **kw)
>   File "/usr/local/lib/python2.7/dist-packages/scipy/weave/ext_tools.py",
> line 369, in compile
>     verbose = verbose, **kw)
>   File
> "/usr/local/lib/python2.7/dist-packages/scipy/weave/build_tools.py", line
> 273, in build_extension
>     setup(name = module_name, ext_modules = [ext],verbose=verb)
>   File "/usr/lib/pymodules/python2.7/numpy/distutils/core.py", line 186,
> in setup
>     return old_setup(**new_attr)
>   File "/usr/lib/python2.7/distutils/core.py", line 169, in setup
>     raise SystemExit, "error: " + str(msg)
> scipy.weave.build_tools.CompileError: error: Command "g++ -pthread -shared
> -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions
> /tmp/patrick/python27_intermediate/compiler_aa001b8a6f0e3d090bc9a3710745b2f8/home/patrick/.python27_compiled/sc_49e94d1bdd1ad16917064c910093194f1.o
> /tmp/patrick/python27_intermediate/compiler_aa001b8a6f0e3d090bc9a3710745b2f8/usr/local/lib/python2.7/dist-packages/scipy/weave/scxx/weave_imp.o
> -o
> /home/patrick/.python27_compiled/sc_49e94d1bdd1ad16917064c910093194f1.so"
> failed with exit status 1
>


I get a very similar error ('multiple definitions of _end') with the
package I'm interested in, so I assume the source is the same. I searched
on the archives and google and couldn't find a solution. What could be the
source of the error?

Patrick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20130420/1db77154/attachment.html>


More information about the SciPy-User mailing list