scipy.weave.inline compilation fails with gcc 4.3

Bug #302649 reported by Sameer Morar on 2008-11-27
52
This bug affects 5 people
Affects Status Importance Assigned to Milestone
SciPy
New
Unknown
blitz++ (Debian)
Fix Released
Unknown
python-scipy (Debian)
Fix Released
Unknown
python-scipy (Ubuntu)
Medium
Sameer Morar
Lucid
Low
Sameer Morar

Bug Description

Binary package hint: python-scipy

The compiler fails with the following error:

<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/smorar/.python25_compiled/sc_b1d4a37f384bb7ae593fe0b86178e5990.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/smorar/.python25_compiled/sc_b1d4a37f384bb7ae593fe0b86178e5990.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’

This problem can be worked around by changing /usr/bin/g++ from g++-4.3 to point to g++-4.2

I am using Intrepid
root@spider:/usr/bin# dpkg -l|grep python-scipy
ii python-scipy 0.6.0-11 scientific tools for Python

Sameer Morar (smorar) wrote :

Attached is some python code which demonstrates the bug. To reproduce, please follow the following steps:
1) Ensure that gcc-4.3 is installed:

root@spider:/usr/bin# ls -la g++
lrwxrwxrwx 1 root root 7 2008-11-27 02:37 g++ -> g++-4.3

2) Remove pre-compiled python snippets

smorar@spider:~$ rm -rf /home/smorar/.python25_compiled/

3) Run code

smorar@spider:~$ python weave_test.py
The compilation will fail with the above error.

To demonstrate that this is related to the latest gcc:
1) Ensure that gcc-4.2 is installed

root@spider:/usr/bin# rm g++
root@spider:/usr/bin# ln -s g++-4.2 g++

2) Remove pre-compiled python snippets

smorar@spider:~$ rm -rf /home/smorar/.python25_compiled/

3) Run code

smorar@spider:~$ python weave_test.py
The compilation will succeed (with many compiler warnings), and the python / c code produces the expected output.

Sameer Morar (smorar) on 2008-11-27
description: updated
Matthias Klose (doko) wrote :

an include of cstdlib seems to be missing.

Benjamin Horstman (yodenss) wrote :

I can confirm the bug and workaround of linking g++-4.2.

For reference, here is the upstream ticket:
http://www.scipy.org/scipy/scipy/ticket/739

What Matthias has noted is present in the debian patch.

And the original (as far as I can tell) mention of this problem on the debian list, more than a year ago:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=455661

Changed in scipy:
status: Unknown → Fix Released
Luca Falavigna (dktrkranz) wrote :

Fixed upstream with new 0.7.0.

Changed in python-scipy:
importance: Undecided → Medium
status: New → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-scipy - 0.7.0-0ubuntu1

---------------
python-scipy (0.7.0-0ubuntu1) jaunty; urgency=low

  * New upstream version (LP: #285936, #299375, #302649).
  * Apply changes from Debian's python-modules team, thanks!
  * debian/rules: make python-scipy ready for Python 2.6 (LP: #336239):
    - Include /usr/share/python/python.mk.
    - Pass $(py_setup_install_args) macro to setup.py install.
    - Remove some files present in new dist-packages directory too.

 -- Luca Falavigna <email address hidden> Mon, 02 Mar 2009 17:28:08 +0100

Changed in python-scipy:
status: Fix Committed → Fix Released
Changed in python-scipy:
status: Unknown → Fix Released
Benjamin Horstman (yodenss) wrote :

Note that according to the scipy bug tracker, this isn't going to be fixed until scipy 0.7.1, which means that this bug still exists in ubuntu 9.04.

Sameer Morar (smorar) wrote :

This bug also exists in ubuntu 9.10:

smorar@spud:~/$ dpkg -l|grep scipy
ii python-scipy 0.7.0-2

Changed in python-scipy (Ubuntu):
status: Fix Released → Incomplete
Sameer Morar (smorar) wrote :

I have changed the status in python-scipy (ubuntu) to incomplete, as it should only be tagged as fixed when scipy 0.7.1 is available in the ubuntu repository.

Jakob Runge (jakobrunge) wrote :
Download full text (7.0 KiB)

The weave bug seems to be still present in scipy 0.7.1

I am running Ubuntu 9.10 (Karmic) and have scipy installed from source (since it is not in the repos) without problems, the required Atlas, ... libraries were installed using synaptic

ipython:
In [2]: scipy.__version__
Out[2]: '0.7.1'

Running a weave.blitz test routine:
"...
weave.inline(code, vars, type_converters = weave.converters.blitz)
..."

Output is:
starting weavefunc..
In file included from /usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/applics.h:394,
                 from /usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/vecexpr.h:26,
                 from /usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/vecpick.cc:16,
                 from /usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/vecpick.h:287,
                 from /usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/vector.h:443,
                 from /usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/tinyvec.h:424,
                 from /usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/array-impl.h:38,
                 from /usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/array.h:26,
                 from /home/jakob/.python26_compiled/sc_6211de8cbbdd4538661eae1a48c2a9890.cpp:11:
/usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/mathfunc.h: In static member function ‘static long int blitz::_bz_abs<long int>::apply(long int)’:
/usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/mathfunc.h:45: error: ‘labs’ is not a member of ‘std’
In file included from /usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/array/funcs.h:23,
                 from /usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/array/newet.h:23,
                 from /usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/array/et.h:21,
                 from /usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/array-impl.h:2509,
                 from /usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/array.h:26,
                 from /home/jakob/.python26_compiled/sc_6211de8cbbdd4538661eae1a48c2a9890.cpp:11:
/usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/funcs.h: In static member function ‘static int blitz::Fn_abs<int>::apply(int)’:
/usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/funcs.h:503: error: call of overloaded ‘abs(int&)’ is ambiguous
/usr/include/c++/4.4/cmath:94: note: candidates are: double std::abs(double)
/usr/include/c++/4.4/cmath:98: note: float std::abs(float)
/usr/include/c++/4.4/cmath:102: note: long double std::abs(long double)
/usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/funcs.h: In static member function ‘static long int blitz::Fn_abs<long int>::apply(long int)’:
/usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/funcs.h:524: error: ‘labs’ is not a member of ‘std’
In file included from /usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/applics.h:394,
                 from /usr/local/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/vecexpr.h:26...

Read more...

Jakob Runge (jakobrunge) wrote :

changing the compiler to g++-4.2 it works... Karmic comes with g++-4.4 though

Changed in scipy:
status: Fix Released → New
Sameer Morar (smorar) wrote :

This bug still exists in ubuntu 10.10:

smorar@spud:~/$ dpkg -l|grep scipy
ii python-scipy 0.7.2-2

Changed in python-scipy (Ubuntu):
status: Incomplete → Confirmed
Matthias Klose (doko) wrote :

Sameer, Stefano, what is the problem in maverick?

Changed in python-scipy (Ubuntu):
status: Confirmed → Incomplete
Stefano Rivera (stefanor) wrote :

Matthias: Haven't had a proper look at these headers, but the test case attached to this bug seems to show up some bugs in them.

Full output attached

In file included from /usr/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/applics.h:394,
                 from /usr/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/vecexpr.h:26,
                 from /usr/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/vecpick.cc:16,
                 from /usr/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/vecpick.h:287,
                 from /usr/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/vector.h:443,
                 from /usr/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/tinyvec.h:424,
                 from /usr/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/array-impl.h:38,
                 from /usr/lib/python2.6/dist-packages/scipy/weave/blitz/blitz/array.h:26,
                 from /home/stefanor/.python26_compiled/sc_3ec397f0c53c3b3e50e2375deba7b7ed1.cpp:11:
/usr/lib/python2.6/dist-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.6/dist-packages/scipy/weave/blitz/blitz/mathfunc.h:45: error: ‘labs’ is not a member of ‘std’

Changed in python-scipy (Ubuntu):
status: Incomplete → Confirmed
Stefano Rivera (stefanor) wrote :

Err, meant to add, obviously this is now an issue with 4.4

Sameer Morar (smorar) wrote :

The fix for this bug is simple. As per the debian patch linked to below, one needs to add an include for cstdlib above the BZ_NAMESPACE(blitz) call in the following files:
/usr/share/pyshared/scipy/weave/blitz/blitz/blitz.h
/usr/share/pyshared/scipy/weave/blitz/blitz/mathfunc.h

http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=10;filename=blitz%2B%2B.patch;att=1;bug=455661

This fix works for me by manually editing those files.

Sameer Morar (smorar) wrote :

Patch to fix this bug

Changed in python-scipy (Ubuntu):
assignee: nobody → Stefano Rivera (stefanor)
Sameer Morar (smorar) wrote :

Updated patch - added an cstdlib include to prettyprint.h
Change reference to launchpad bug number.
Updated the Patch Tags to only use a description and bug-ubuntu fields.

Stefano Rivera (stefanor) wrote :

Thanks for the patch, I'll forward this to Debian

Changed in python-scipy (Ubuntu):
assignee: Stefano Rivera (stefanor) → Sameer Morar (smorar)
status: Confirmed → Fix Committed
Sameer Morar (smorar) on 2010-09-29
Changed in python-scipy (Ubuntu Lucid):
assignee: nobody → Sameer Morar (smorar)
Sameer Morar (smorar) wrote :

Here is a patch for lucid

Sameer Morar (smorar) wrote :

Here is a patch for lucid

affects: python-scipy (Debian) → blitz++ (Debian)
tags: added: patch
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-scipy - 0.7.2-2ubuntu1

---------------
python-scipy (0.7.2-2ubuntu1) maverick; urgency=low

  * debian/patches/blitz++.patch:
    - Fix scipy.weave.inline compilations (LP: #302649)
 -- Sameer Morar <email address hidden> Wed, 29 Sep 2010 13:42:10 +0200

Changed in python-scipy (Ubuntu):
status: Fix Committed → Fix Released
Stefano Rivera (stefanor) wrote :

Uploaded to lucid-proposed, pending SRU team verification.

Changed in python-scipy (Ubuntu Lucid):
importance: Undecided → Low
status: New → Fix Committed

Accepted python-scipy into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Sameer Morar (smorar) wrote :

The new package works for me.

Sameer Morar (smorar) wrote :

Addendum to comment 24:

To verify the fix, python-dev needs to be installed. Will open this as a separate bug, as python-scipy does not recommend or suggest python-dev to be installed.

tags: added: verification-done
removed: verification-needed
Changed in python-scipy (Debian):
status: Unknown → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-scipy - 0.7.0-2ubuntu0.1

---------------
python-scipy (0.7.0-2ubuntu0.1) lucid-proposed; urgency=low

  * Fix scipy.weave.inline compilations (LP: #302649)
 -- Sameer Morar <email address hidden> Thu, 30 Sep 2010 15:32:13 +0200

Changed in python-scipy (Ubuntu Lucid):
status: Fix Committed → Fix Released
Changed in python-scipy (Debian):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.