Bug 13880 - gfortran fail to link programs: undefined reference 'get_mem'
Summary: gfortran fail to link programs: undefined reference 'get_mem'
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 3
Hardware: All Linux
Priority: Normal major
Target Milestone: ---
Assignee: QA Team
QA Contact:
URL: https://forums.mageia.org/en/viewtopi...
Whiteboard: has_procedure advisory mga3-32-ok mga...
Keywords: validated_update
Depends on:
Blocks:
 
Reported: 2014-08-08 13:16 CEST by Stephen Usher
Modified: 2014-08-27 01:05 CEST (History)
4 users (show)

See Also:
Source RPM: gcc-4.7.2-8.2.mga3.src.rpm
CVE:
Status comment:


Attachments

Description Stephen Usher 2014-08-08 13:16:33 CEST
gfortran fails to build and link programs giving the error:

/usr/lib/gcc/x86_64-mageia-linux-gnu/4.7.2/libgfortran.so: undefined reference to `get_mem'
collect2: error: ld returned 1 exit status

To reproduce:

cat << EOF > hello.f
        PROGRAM TEST

        WRITE(*,*) "Hello world!"

        END
EOF
gfortran -o hello hello.f


Reproducible: 

Steps to Reproduce:
Comment 1 Thierry Vignaud 2014-08-12 00:06:38 CEST
For the record, this works fine with gcc-4.9 in Mageia Cauldron

URL: (none) => https://forums.mageia.org/en/viewtopic.php?f=7&t=8219
CC: (none) => tmb

Comment 2 Stephen Usher 2014-08-12 10:28:50 CEST
The problem only arose in the latest update. gcc-gfortran-4.7.2-8.1.mga3 worked so it must have been something in the latest patch build which broke the library.
Comment 3 Edward d'Auvergne 2014-08-20 14:05:54 CEST
I see this problem too, and it's rather fatal for python-numpy:

$ python
Python 2.7.6 (default, Jun 28 2014, 19:32:28) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/numpy/__init__.py", line 137, in <module>
    import add_newdocs
  File "/usr/lib64/python2.7/site-packages/numpy/add_newdocs.py", line 9, in <module>
    from numpy.lib import add_newdoc
  File "/usr/lib64/python2.7/site-packages/numpy/lib/__init__.py", line 13, in <module>
    from polynomial import *
  File "/usr/lib64/python2.7/site-packages/numpy/lib/polynomial.py", line 17, in <module>
    from numpy.linalg import eigvals, lstsq
  File "/usr/lib64/python2.7/site-packages/numpy/linalg/__init__.py", line 48, in <module>
    from linalg import *
  File "/usr/lib64/python2.7/site-packages/numpy/linalg/linalg.py", line 23, in <module>
    from numpy.linalg import lapack_lite
ImportError: /lib64/libgfortran.so.3: undefined symbol: get_mem
>>> 


Hence this will break a huge amount of Python software!  Something is seriously wrong with the current fortran library!

CC: (none) => true.bugman

Comment 4 Edward d'Auvergne 2014-08-20 14:08:14 CEST
This also breaks the dependencies python-scipy and python-matplotlib:

$ python
Python 2.7.6 (default, Jun 28 2014, 19:32:28) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/scipy/__init__.py", line 78, in <module>
    from numpy import show_config as show_numpy_config
  File "/usr/lib64/python2.7/site-packages/numpy/__init__.py", line 137, in <module>
    import add_newdocs
  File "/usr/lib64/python2.7/site-packages/numpy/add_newdocs.py", line 9, in <module>
    from numpy.lib import add_newdoc
  File "/usr/lib64/python2.7/site-packages/numpy/lib/__init__.py", line 13, in <module>
    from polynomial import *
  File "/usr/lib64/python2.7/site-packages/numpy/lib/polynomial.py", line 17, in <module>
    from numpy.linalg import eigvals, lstsq
  File "/usr/lib64/python2.7/site-packages/numpy/linalg/__init__.py", line 48, in <module>
    from linalg import *
  File "/usr/lib64/python2.7/site-packages/numpy/linalg/linalg.py", line 23, in <module>
    from numpy.linalg import lapack_lite
ImportError: /lib64/libgfortran.so.3: undefined symbol: get_mem
>>> 



$ python
Python 2.7.6 (default, Jun 28 2014, 19:32:28) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 151, in <module>
    from matplotlib.rcsetup import (defaultParams,
  File "/usr/lib64/python2.7/site-packages/matplotlib/rcsetup.py", line 20, in <module>
    from matplotlib.colors import is_color_like
  File "/usr/lib64/python2.7/site-packages/matplotlib/colors.py", line 52, in <module>
    import numpy as np
  File "/usr/lib64/python2.7/site-packages/numpy/__init__.py", line 137, in <module>
    import add_newdocs
  File "/usr/lib64/python2.7/site-packages/numpy/add_newdocs.py", line 9, in <module>
    from numpy.lib import add_newdoc
  File "/usr/lib64/python2.7/site-packages/numpy/lib/__init__.py", line 13, in <module>
    from polynomial import *
  File "/usr/lib64/python2.7/site-packages/numpy/lib/polynomial.py", line 17, in <module>
    from numpy.linalg import eigvals, lstsq
  File "/usr/lib64/python2.7/site-packages/numpy/linalg/__init__.py", line 48, in <module>
    from linalg import *
  File "/usr/lib64/python2.7/site-packages/numpy/linalg/linalg.py", line 23, in <module>
    from numpy.linalg import lapack_lite
ImportError: /lib64/libgfortran.so.3: undefined symbol: get_mem
>>>
Comment 5 Thomas Backlund 2014-08-20 14:13:20 CEST
Hm,

seems I screwed up the CVE backport... I wonder why the build didn't break :/

I will try and look into this today

Status: NEW => ASSIGNED
Assignee: bugsquad => tmb

Comment 6 Thomas Backlund 2014-08-24 18:20:06 CEST
Sorry for the delay...

Seems I missed one get_mem to xmalloc conversion :/

I've pushed a fix to the buildsystem in gcc-4.7.2-8.3.mga3
Comment 7 Thomas Backlund 2014-08-24 20:33:52 CEST
Testcase in comment 0

Advisory:
The CVE-2014-5044 fix for libgfortran released as MGASA-2014-0306 was
incomplete and broke gfortran compiler. This update resolves the issue.

  

SRPM:
gcc-4.7.2-8.3.mga3.src.rpm

i586:
gcc-4.7.2-8.3.mga3.i586.rpm
gcc-c++-4.7.2-8.3.mga3.i586.rpm
gcc-cpp-4.7.2-8.3.mga3.i586.rpm
gcc-doc-4.7.2-8.3.mga3.noarch.rpm
gcc-doc-pdf-4.7.2-8.3.mga3.noarch.rpm
gcc-gfortran-4.7.2-8.3.mga3.i586.rpm
gcc-gnat-4.7.2-8.3.mga3.i586.rpm
gcc-java-4.7.2-8.3.mga3.i586.rpm
gcc-objc-4.7.2-8.3.mga3.i586.rpm
gcc-objc++-4.7.2-8.3.mga3.i586.rpm
gcc-plugins-4.7.2-8.3.mga3.i586.rpm
gcj-tools-4.7.2-8.3.mga3.i586.rpm
libgcc1-4.7.2-8.3.mga3.i586.rpm
libgcj13-4.7.2-8.3.mga3.i586.rpm
libgcj13-base-4.7.2-8.3.mga3.i586.rpm
libgcj13-src-4.7.2-8.3.mga3.i586.rpm
libgcj_bc1-4.7.2-8.3.mga3.i586.rpm
libgcj-devel-4.7.2-8.3.mga3.i586.rpm
libgcj-static-devel-4.7.2-8.3.mga3.i586.rpm
libgfortran3-4.7.2-8.3.mga3.i586.rpm
libgnat1-4.7.2-8.3.mga3.i586.rpm
libgomp1-4.7.2-8.3.mga3.i586.rpm
libgomp-devel-4.7.2-8.3.mga3.i586.rpm
libitm1-4.7.2-8.3.mga3.i586.rpm
libitm-devel-4.7.2-8.3.mga3.i586.rpm
libmudflap0-4.7.2-8.3.mga3.i586.rpm
libmudflap-devel-4.7.2-8.3.mga3.i586.rpm
libobjc4-4.7.2-8.3.mga3.i586.rpm
libquadmath0-4.7.2-8.3.mga3.i586.rpm
libquadmath-devel-4.7.2-8.3.mga3.i586.rpm
libstdc++6-4.7.2-8.3.mga3.i586.rpm
libstdc++-devel-4.7.2-8.3.mga3.i586.rpm
libstdc++-docs-4.7.2-8.3.mga3.noarch.rpm
libstdc++-static-devel-4.7.2-8.3.mga3.i586.rpm

x86_64:
gcc-4.7.2-8.3.mga3.x86_64.rpm
gcc-c++-4.7.2-8.3.mga3.x86_64.rpm
gcc-cpp-4.7.2-8.3.mga3.x86_64.rpm
gcc-doc-4.7.2-8.3.mga3.noarch.rpm
gcc-doc-pdf-4.7.2-8.3.mga3.noarch.rpm
gcc-gfortran-4.7.2-8.3.mga3.x86_64.rpm
gcc-gnat-4.7.2-8.3.mga3.x86_64.rpm
gcc-java-4.7.2-8.3.mga3.x86_64.rpm
gcc-objc-4.7.2-8.3.mga3.x86_64.rpm
gcc-objc++-4.7.2-8.3.mga3.x86_64.rpm
gcc-plugins-4.7.2-8.3.mga3.x86_64.rpm
gcj-tools-4.7.2-8.3.mga3.x86_64.rpm
lib64gcj13-4.7.2-8.3.mga3.x86_64.rpm
lib64gcj_bc1-4.7.2-8.3.mga3.x86_64.rpm
lib64gcj-devel-4.7.2-8.3.mga3.x86_64.rpm
lib64gcj-static-devel-4.7.2-8.3.mga3.x86_64.rpm
libgcc1-4.7.2-8.3.mga3.x86_64.rpm
libgcj13-base-4.7.2-8.3.mga3.x86_64.rpm
libgcj13-src-4.7.2-8.3.mga3.x86_64.rpm
libgfortran3-4.7.2-8.3.mga3.x86_64.rpm
libgnat1-4.7.2-8.3.mga3.x86_64.rpm
libgomp1-4.7.2-8.3.mga3.x86_64.rpm
libgomp-devel-4.7.2-8.3.mga3.x86_64.rpm
libitm1-4.7.2-8.3.mga3.x86_64.rpm
libitm-devel-4.7.2-8.3.mga3.x86_64.rpm
libmudflap0-4.7.2-8.3.mga3.x86_64.rpm
libmudflap-devel-4.7.2-8.3.mga3.x86_64.rpm
libobjc4-4.7.2-8.3.mga3.x86_64.rpm
libquadmath0-4.7.2-8.3.mga3.x86_64.rpm
libquadmath-devel-4.7.2-8.3.mga3.x86_64.rpm
libstdc++6-4.7.2-8.3.mga3.x86_64.rpm
libstdc++-devel-4.7.2-8.3.mga3.x86_64.rpm
libstdc++-docs-4.7.2-8.3.mga3.noarch.rpm
libstdc++-static-devel-4.7.2-8.3.mga3.x86_64.rpm

Hardware: x86_64 => All
Assignee: tmb => qa-bugs

Comment 8 claire robinson 2014-08-26 15:24:36 CEST
Edward & Stephen can you test please and report your findings, including your mageia version & arch. Thanks.
Comment 9 Edward d'Auvergne 2014-08-26 15:45:38 CEST
I cannot find the packages in any of the "* Updates" or "* Updates Testing" media, or the debugging equivalents.  Where do you find these and how do you install them?  Cheers!
Comment 10 claire robinson 2014-08-26 15:48:07 CEST
You'll need to configure your media, please see
https://wiki.mageia.org/en/Enabling_the_Testing_media#Enable_them_the_easy_way
Comment 11 Edward d'Auvergne 2014-08-26 15:54:22 CEST
That's what I've done, via Drakconf.  I have tried enabling:

Core Updates
Core Updates Debug
Core Updates Testing
Core Updates Testing Debug
Core Backports
Core Backports Testing
Nonfree Updates
Nonfree Updates Testing
Tainted Updates
Tainted Updates Testing

Therefore I can only guess that the packages have not been built/added yet.
Comment 12 Rémi Verschelde 2014-08-26 15:57:58 CEST
You should make sure your mirrors are up-to-date, either through the MCC or using "urpmi.update -a".

CC: (none) => remi

Comment 13 claire robinson 2014-08-26 15:59:49 CEST
You don't need the Debug medias enabled, you only need to enable Core Updates Testing and set it as an 'update' media. Setting it as an Update media requires the --expert switch as shown on the wiki page.

Alternatively you can enable it and use urpmi directly rather than MageiaUpdate to install the packages.
Comment 14 Thomas Backlund 2014-08-26 16:02:38 CEST
or as root:

urpmi.update "Core Updates Testing" && urpmi gcc-gfortran
Comment 15 claire robinson 2014-08-26 16:08:56 CEST
$ ./depcheck gcc-gfortran
Mageia release 3 (Official) for i586
------------------
Core Release
gcc-gfortran-4.7.2-7.mga3
------------------
Core Updates
gcc-gfortran-4.7.2-8.1.mga3
gcc-gfortran-4.7.2-8.2.mga3
------------------
Core Updates Testing
gcc-gfortran-4.7.2-8.3.mga3
------------------
Comment 16 Edward d'Auvergne 2014-08-26 16:16:53 CEST
The command "urpmi.update "Core Updates Testing" && urpmi gcc-gfortran" worked.  Anyway, the problem for python-numpy, python-scipy and python-matplotlib is fixed!  Cheers!
Comment 17 Edward d'Auvergne 2014-08-26 16:18:59 CEST
The FORTRAN code compilation example in Stephen's description also now works on my system.
Comment 18 claire robinson 2014-08-26 16:22:08 CEST
From comment 3 I'm guessing you are using mga3 64bit Edward?
Comment 19 Edward d'Auvergne 2014-08-26 16:24:16 CEST
Correct.  And from the just compiled FORTRAN program:

$ file hello
hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=6e01c3068e533449fcc509e7dc88a829b5333877, not stripped
Comment 20 Stephen Usher 2014-08-26 16:27:10 CEST
64 bit works for me now.
Comment 21 claire robinson 2014-08-26 16:28:04 CEST
Thanks both. I'll check quickly on mga3 32 before validating.
Comment 22 claire robinson 2014-08-26 16:31:00 CEST
Testing complete mga3 32 with the code from comment 0

Before
------
$ gfortran -o hello hello.f
/usr/lib/gcc/i586-mageia-linux-gnu/4.7.2/libgfortran.so: undefined reference to `get_mem'
collect2: error: ld returned 1 exit status

After
-----
$ gfortran -o hello hello.f
$ ./hello
 Hello world!

Whiteboard: (none) => has_procedure mga3-32-ok mga3-64-ok

Comment 23 claire robinson 2014-08-26 16:37:51 CEST
Validating. Advisory uploaded.

Confirmed mga4 is not affected.

Could sysadmin please push to updates

Thanks

Keywords: (none) => validated_update
Whiteboard: has_procedure mga3-32-ok mga3-64-ok => has_procedure advisory mga3-32-ok mga3-64-ok
CC: (none) => sysadmin-bugs

Comment 24 Mageia Robot 2014-08-27 01:05:24 CEST
An update for this issue has been pushed to Mageia Updates repository.

http://advisories.mageia.org/MGAA-2014-0164.html

Status: ASSIGNED => RESOLVED
Resolution: (none) => FIXED


Note You need to log in before you can comment on or make changes to this bug.