Bug 188114 - math/py-numpy: Broken on 9.2-STABLE - gcc48/libgfortran.so.3 not found
Summary: math/py-numpy: Broken on 9.2-STABLE - gcc48/libgfortran.so.3 not found
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Many People
Assignee: freebsd-python mailing list
URL:
Keywords:
: 188327 192598 (view as bug list)
Depends on:
Blocks: 193505
  Show dependency treegraph
 
Reported: 2014-03-31 08:40 UTC by vladimir.chukharev
Modified: 2016-08-12 08:06 UTC (History)
6 users (show)

See Also:


Attachments
This patch re-adds LDFLAGS to fix the problem. (1.36 KB, patch)
2014-09-17 22:03 UTC, Thierry Thomas
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description vladimir.chukharev 2014-03-31 08:40:01 UTC
math/py-numpy is broken on 9.2-STABLE by the change of the default gcc version to 4.7. I tried to compile everything related to numpy with gcc48 as recommended by someone, but the error stays the same (sans version in the path in ImportError line below):

 $ python -c "import numpy"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/numpy/__init__.py", line 153, in <module>
    from . import add_newdocs
  File "/usr/local/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/usr/local/lib/python2.7/site-packages/numpy/lib/__init__.py", line 18, in <module>
    from .polynomial import *
  File "/usr/local/lib/python2.7/site-packages/numpy/lib/polynomial.py", line 19, in <module>
    from numpy.linalg import eigvals, lstsq, inv
  File "/usr/local/lib/python2.7/site-packages/numpy/linalg/__init__.py", line 50, in <module>
    from .linalg import *
  File "/usr/local/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 29, in <module>
    from numpy.linalg import lapack_lite, _umath_linalg
ImportError: /lib/libgcc_s.so.1: version GCC_4.6.0 required by /usr/local/lib/gcc48/libgfortran.so.3 not found

I have seen the discussions in December in preparations for the GCC version change. It seems the patch proposed in there, is in place (/usr/ports/math/py-numpy/files/patch-numpy-distutils-fcompiler-gnu.py), but apparently it's not enough...

I also tried to rebuild all my ports. I did it with portmaster in-place method, though, which is not totally free from inheriting problems of previous builds.

How-To-Repeat: I see the discussions of the same bug, e.g. as py-scipy build problems. So I guess it's easy to reproduce with fresh ports on 9.2-STABLE...
Comment 1 Edwin Groothuis freebsd_committer 2014-03-31 08:40:04 UTC
Responsible Changed
From-To: freebsd-ports-bugs->freebsd-python

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Vladimir Chukharev 2014-04-04 12:30:22 UTC
There is a workaround given in the discussions of similar problem with ipython. Just define an environment variable:

LD_LIBRARY_PATH=/usr/local/lib/gcc48 python -c "import numpy"

No errors. This is an indication that the problem might be easier to solve in lang/gcc* ports or
in Mk/bsd.gcc.mk

-- 
Vladimir Chukharev
Comment 3 Vladimir Chukharev 2014-04-08 11:38:17 UTC
Note a related PR ports/188327 'math/py-numpy: Numpy is broken'.

Seems that setting LD_LIBRARY_PATH variable helps in 10.0-RELEASE too.

-- 
Vladimir Chukharev
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2014-08-13 06:08:42 UTC
*** Bug 192598 has been marked as a duplicate of this bug. ***
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2014-08-13 06:11:51 UTC
Canonicalize assignee, add gerald@ to CC for help/expertise
Comment 6 Kubilay Kocak freebsd_committer freebsd_triage 2014-08-13 07:08:45 UTC
*** Bug 188327 has been marked as a duplicate of this bug. ***
Comment 7 Gerald Pfeifer freebsd_committer 2014-08-30 21:05:43 UTC
Is LDFLAGS properly used by this port?
Comment 8 Thierry Thomas freebsd_committer 2014-09-15 21:51:06 UTC
Same problem with the port math/py-matplotlib:

$ python -c "import matplotlib as m; print(m.__version__); print(m.__path__[0]);"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/matplotlib/__init__.py", line 151, in <module>
    from matplotlib.rcsetup import (defaultParams,
  File "/usr/local/lib/python2.7/site-packages/matplotlib/rcsetup.py", line 20, in <module>
    from matplotlib.colors import is_color_like
  File "/usr/local/lib/python2.7/site-packages/matplotlib/colors.py", line 52, in <module>
    import numpy as np
  File "/usr/local/lib/python2.7/site-packages/numpy/__init__.py", line 153, in <module>
    from . import add_newdocs
  File "/usr/local/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/usr/local/lib/python2.7/site-packages/numpy/lib/__init__.py", line 18, in <module>
    from .polynomial import *
  File "/usr/local/lib/python2.7/site-packages/numpy/lib/polynomial.py", line 19, in <module>
    from numpy.linalg import eigvals, lstsq, inv
  File "/usr/local/lib/python2.7/site-packages/numpy/linalg/__init__.py", line 50, in <module>
    from .linalg import *
  File "/usr/local/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 29, in <module>
    from numpy.linalg import lapack_lite, _umath_linalg
ImportError: /lib/libgcc_s.so.1: version GCC_4.6.0 required by /usr/local/lib/gcc48/libgfortran.so.3 not found
Comment 9 Thierry Thomas freebsd_committer 2014-09-17 22:03:44 UTC
Created attachment 147418 [details]
This patch re-adds LDFLAGS to fix the problem.

$LDFLAGS was intentionally removed with the hereunder comment:

# ignore LDFLAGS from env, as it overrides internal flags (e.g. -shared) for some reason

This proposed patch re-adds it (with the needed '-shared'), so that it takes the value set by 'USES= fortran', which fixes the reported problem.

Indirectly this fixes some dependent ports like math/py-matplotlib and cad/freecad (resurrection in progress).
Comment 10 Gerald Pfeifer freebsd_committer 2014-09-18 07:54:39 UTC
(In reply to Thierry Thomas from comment #9)
> $LDFLAGS was intentionally removed with the hereunder comment:
> 
> # ignore LDFLAGS from env, as it overrides internal flags (e.g. -shared) for
> some reason

Ouch!  That was a truely bad move.

No wonder this port, and some related ones, have been causing troubles
for user various times since then.

Thank you so much for catching and fixing this, Thierry!
Comment 11 commit-hook freebsd_committer 2014-09-28 10:41:31 UTC
A commit references this bug:

Author: demon
Date: Sun Sep 28 10:40:55 UTC 2014
New revision: 369447
URL: https://svnweb.freebsd.org/changeset/ports/369447

Log:
  Fix
  ImportError: /lib/libgcc_s.so.1: version GCC_4.6.0 required by /usr/local/lib/gcc48/libgfortran.so.3 not found
  error when importing numpy module.

  PR:		188114
  Patch by Thierry Thomas <thierry@FreeBSD.org>

Changes:
  head/math/py-numpy/Makefile