[SciPy-user] weave problem on ubuntu 8.10

Matthieu Brucher matthieu.brucher@gmail....
Mon Nov 17 10:57:06 CST 2008


Hi,

The answer would be to replace labs by the correct C++ function abs()
(as for floating point numbers).

Matthieu

2008/11/17 Kristian Hans Sandberg <Kristian.Sandberg@colorado.edu>:
> That's exactly the problem I wrote about a couple of days ago (with topic "weave/blitz problem"). It's listed as Ticket # 739 in the scipy trac system:
>
> http://www.scipy.org/scipy/scipy/ticket/739
>
> This seems to happen with g++ version 4.3. As a temporary fix, I installed g++ version 4.2, and then it worked.
>
> I believe this problem will be more common as more people update to newer compilers.
>
> Kristian
>
> Kristian Sandberg, Ph.D.
>
>  Dept. of Applied Mathematics and
>  The Boulder Laboratory for 3-D Electron Microscopy of Cells
>  University of Colorado at Boulder
>  Campus Box 526
>  Boulder, CO 80309-0526, USA
>
>  Phone: (303) 492 0593 (work)
>        (303) 499 4404 (home)
>        (303) 547 6290 (cell)
>
>  Home page: http://amath.colorado.edu/faculty/sandberg
>
>
> ---- Original message ----
>>Date: Mon, 17 Nov 2008 11:18:30 -0500
>>From: "Bobby H. Braswell" <rob.braswell@unh.edu>
>>Subject: Re: [SciPy-user] weave problem on ubuntu 8.10
>>To: SciPy Users List <scipy-user@scipy.org>
>>
>>   Hi, thanks for the reply. Here are the first lines:
>>
>>   <weave: compiling>
>>   In file included from
>>   /usr/lib/python2.5/site-packages/scipy/weave/blitz/blitz/applics.h:400,
>>                    from
>>   /usr/lib/python2.5/site-packages/scipy/weave/blitz/blitz/vecexpr.h:32,
>>                    from
>>   /usr/lib/python2.5/site-packages/scipy/weave/blitz/blitz/vecpick.cc:16,
>>                    from
>>   /usr/lib/python2.5/site-packages/scipy/weave/blitz/blitz/vecpick.h:293,
>>                    from
>>   /usr/lib/python2.5/site-packages/scipy/weave/blitz/blitz/vector.h:449,
>>                    from
>>   /usr/lib/python2.5/site-packages/scipy/weave/blitz/blitz/tinyvec.h:430,
>>                    from
>>   /usr/lib/python2.5/site-packages/scipy/weave/blitz/blitz/array-impl.h:44,
>>                    from
>>   /usr/lib/python2.5/site-packages/scipy/weave/blitz/blitz/array.h:32,
>>                    from
>>   /home/braswell/.python25_compiled/sc_f935818f52299953943b3b48fe3685483.cpp:11:
>>   /usr/lib/python2.5/site-packages/scipy/weave/blitz/blitz/mathfunc.h:
>>   In static member function `static long int
>>   blitz::_bz_abs<long int>::apply(long int)':
>>   /usr/lib/python2.5/site-packages/scipy/weave/blitz/blitz/mathfunc.h:45:
>>   error: `labs' is not a member of `std'
>>   In file included from
>>   /usr/lib/python2.5/site-packages/scipy/weave/blitz/blitz/array/funcs.h:29,
>>                    from
>>   /usr/lib/python2.5/site-packages/scipy/weave/blitz/blitz/array/newet.h:29,
>>                    from
>>   /usr/lib/python2.5/site-packages/scipy/weave/blitz/blitz/array/et.h:27,
>>                    from
>>   /usr/lib/python2.5/site-packages/scipy/weave/blitz/blitz/array-impl.h:2515,
>>                    from
>>   /usr/lib/python2.5/site-packages/scipy/weave/blitz/blitz/array.h:32,
>>                    from
>>   /home/braswell/.python25_compiled/sc_f935818f52299953943b3b48fe3685483.cpp:11:
>>   /usr/lib/python2.5/site-packages/scipy/weave/blitz/blitz/funcs.h:
>>   In static member function `static int
>>   blitz::Fn_abs<int>::apply(int)':
>>   /usr/lib/python2.5/site-packages/scipy/weave/blitz/blitz/funcs.h:509:
>>   error: call of overloaded `abs(int&)' is ambiguous
>>   /usr/include/c++/4.3/cmath:99: note: candidates are:
>>   double std::abs(double)
>>   /usr/include/c++/4.3/cmath:103:
>>   note:                 float std::abs(float)
>>   /usr/include/c++/4.3/cmath:107:
>>   note:                 long double std::abs(long
>>   double)
>>   /usr/lib/python2.5/site-packages/scipy/weave/blitz/blitz/funcs.h:
>>   In static member function `static long int
>>   blitz::Fn_abs<long int>::apply(long int)':
>>   /usr/lib/python2.5/site-packages/scipy/weave/blitz/blitz/funcs.h:530:
>>   error: `labs' is not a member of `std'
>>   /home/braswell/.python25_compiled/sc_f935818f52299953943b3b48fe3685483.cpp:
>>   In function `char* find_type(PyObject*)':
>>   /home/braswell/.python25_compiled/sc_f935818f52299953943b3b48fe3685483.cpp:35:
>>   warning: deprecated conversion from string constant
>>   to `char*'
>>   ...
>>
>>   On Mon, 2008-11-17 at 17:08 +0100, So/ren Nielsen
>>   wrote:
>>
>>     Hi Rob,
>>
>>     What are the first lines of your error message?
>>
>>     I found the answer to my own question... I just
>>     had to add type_converters = converters.blitz
>>     under the ext_function.
>>
>>     On Mon, Nov 17, 2008 at 4:18 PM, Bobby H. Braswell
>>     <rob.braswell@unh.edu> wrote:
>>
>>       Hi-
>>
>>       By coincidence I am trying to get weave working
>>       on a new system, I had previously been using it
>>       successfully under OS X with the Fink version of
>>       SciPy. I don't want to distract from Soren's
>>       question but when I try his simple example (or
>>       any of my own) using converters.blitz, I get a
>>       very long error message, actually mostly
>>       warnings, but it ends like this:
>>
>>       >>> ravg = weave.inline(code, ['xlen', 'ylen',
>>       'test'], type_converters=converters.blitz,
>>       compiler = 'gcc')
>>       ...hundreds of lines...
>>       Traceback (most recent call last):
>>         File "<stdin>", line 2, in <module>
>>         File
>>       "/usr/lib/python2.5/site-packages/scipy/weave/inline_tools.py",
>>       line 339, in inline
>>           **kw)
>>         File
>>       "/usr/lib/python2.5/site-packages/scipy/weave/inline_tools.py",
>>       line 447, in compile_function
>>           verbose=verbose, **kw)
>>         File
>>       "/usr/lib/python2.5/site-packages/scipy/weave/ext_tools.py",
>>       line 365, in compile
>>           verbose = verbose, **kw)
>>         File
>>       "/usr/lib/python2.5/site-packages/scipy/weave/build_tools.py",
>>       line 269, in build_extension
>>           setup(name = module_name, ext_modules =
>>       [ext],verbose=verb)
>>         File
>>       "/usr/lib/python2.5/site-packages/numpy/distutils/core.py",
>>       line 184, in setup
>>           return old_setup(**new_attr)
>>         File "/usr/lib/python2.5/distutils/core.py",
>>       line 168, in setup
>>           raise SystemExit, "error: " + str(msg)
>>       scipy.weave.build_tools.CompileError: error:
>>       Command "g++ -pthread -fno-strict-aliasing
>>       -DNDEBUG -g -fwrapv -O2 -fPIC
>>       -I/usr/lib/python2.5/site-packages/scipy/weave
>>       -I/usr/lib/python2.5/site-packages/scipy/weave/scxx
>>       -I/usr/lib/python2.5/site-packages/scipy/weave/blitz
>>       -I/usr/lib/python2.5/site-packages/numpy/core/include
>>       -I/usr/include/python2.5 -c
>>       /home/braswell/.python25_compiled/sc_f8b4f30889557b51310ac43eda9472b30.cpp
>>       -o
>>       /tmp/braswell/python25_intermediate/compiler_a9bbef2f14d61f7aa8f0ba6e068e18c2/home/braswell/.python25_compiled/sc_f8b4f30889557b51310ac43eda9472b30.o"
>>       failed with exit status 1
>>
>>       Sorry if this is more of a compiler/Ubuntu
>>       problem, I'm not sure about that. I'd be
>>       grateful to hear from someone who has had or not
>>       had problems with Weave on Ubuntu 8.10.
>>
>>       Thanks very much,
>>       Rob
>>
>>       On Mon, 2008-11-17 at 15:40 +0100, So/ren
>>       Nielsen wrote:
>>
>>         Can anyone explain why this fails? This piece
>>         of code runs perfectly using weave.inline and
>>         type_converters = blitz..
>>
>>         Obviously it can't handle 2D arrays anymore.
>>         It's just a stupid example to illustrate that.
>>
>>         Thanks,
>>         Soren
>>
>>         CODE :
>>         ------------------------------------------------------------------------------------------------
>>         mod = ext_tools.ext_module('ravg_ext')
>>
>>         test = zeros((5,5))
>>         xlen = 5
>>         ylen = 5
>>
>>         code = """
>>                  int x, y;
>>
>>                  for( x = 0; x < xlen; x++)
>>                  {
>>                         for( y = 0; y < ylen; y++)
>>                         {
>>                             test(x,y) = 2;
>>                         }
>>                  }
>>
>>                 """
>>
>>         ravg = ext_tools.ext_function('ravg', code,
>>         ['xlen', 'ylen', 'test'])
>>         mod.add_function(ravg)
>>         mod.compile(compiler = 'gcc')
>>
>>         RESULT:
>>         ------------------------------------------------------------------------------------------------
>>         C:\Temp\ravg_ext.cpp: In function `PyObject*
>>         ravg(PyObject*, PyObject*, PyObject*)':
>>         C:\Temp\ravg_ext.cpp:654: error: `test' cannot
>>         be used as a function
>>         C:\Temp\ravg_ext.cpp:641: warning: unused
>>         variable 'Ntest'
>>         C:\Temp\ravg_ext.cpp:642: warning: unused
>>         variable 'Stest'
>>         C:\Temp\ravg_ext.cpp:643: warning: unused
>>         variable 'Dtest'
>>
>>         Traceback (most recent call last):
>>           File "C:\Temp\ravg_extension.py", line 132,
>>         in ?
>>             build_ravg_extension()
>>           File "C:\Temp\ravg_extension.py", line 125,
>>         in build_ravg_extension
>>             mod.compile(compiler = 'gcc')
>>           File
>>         "C:\Python24\Lib\site-packages\scipy\weave\ext_tools.py",
>>         line 365, in compile
>>             verbose = verbose, **kw)
>>           File
>>         "C:\Python24\Lib\site-packages\scipy\weave\build_tools.py",
>>         line 269, in build_extension
>>             setup(name = module_name, ext_modules =
>>         [ext],verbose=verb)
>>           File
>>         "C:\Python24\Lib\site-packages\numpy\distutils\core.py",
>>         line 184, in setup
>>             return old_setup(**new_attr)
>>           File "C:\Python24\Lib\distutils\core.py",
>>         line 166, in setup
>>             raise SystemExit, "error: " + str(msg)
>>         CompileError: error: Command "g++ -mno-cygwin
>>         -O2 -Wall
>>         -IC:\Python24\lib\site-packages\scipy\weave
>>         -IC:\Python24\lib\site-packages\scipy\weave\scxx
>>         -IC:\Python24\lib\site-packages\numpy\core\include
>>         -IC:\Python24\include -IC:\Python24\PC -c
>>         C:\Temp\ravg_ext.cpp -o
>>         c:\docume~1\ssn\locals~1\temp\ssn\python24_intermediate\compiler_894ad5ed761bb51736c6d2b7872dc212\Releas
>>
>> _______________________________________________
>> SciPy-user mailing list
>> SciPy-user@scipy.org
>> http://projects.scipy.org/mailman/listinfo/scipy-user
>>
>>       _______________________________________________
>>       SciPy-user mailing list
>>       SciPy-user@scipy.org
>>       http://projects.scipy.org/mailman/listinfo/scipy-user
>>
>> _______________________________________________
>> SciPy-user mailing list
>> SciPy-user@scipy.org
>> http://projects.scipy.org/mailman/listinfo/scipy-user
>>________________
>>_______________________________________________
>>SciPy-user mailing list
>>SciPy-user@scipy.org
>>http://projects.scipy.org/mailman/listinfo/scipy-user
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>



-- 
Information System Engineer, Ph.D.
Website: http://matthieu-brucher.developpez.com/
Blogs: http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn: http://www.linkedin.com/in/matthieubrucher


More information about the SciPy-user mailing list