[SciPy-dev] still getting undefined symbols on scipy builds on SunOS

Pearu Peterson pearu at cens.ioc.ee
Fri Jan 24 02:23:21 CST 2003


On Fri, 24 Jan 2003, eric jones wrote:

> But, I just noticed scipy doesn't all link correctly on sun now -- at
> least the linalg library doesn't on my machine when building with Forte
> f90.  I get undefined symbols for s_stop and s_copy on calc_lwork and
> _flinalg.  I expect the others have similar problems.
> 
> bash-2.05$ nm calc_lwork.so | grep s_copy
> [236]   |         0|       0|NOTY |GLOB |0    |UNDEF  |s_copy
> 
> When looking at the object file, I don't see this symbol anywhere, which
> means it is coming from some other library?
> 
> bash-2.05$ nm -A calc_lwork.o | grep s_copy
> bash-2.05$
> 
> I added f77_compat which has:
> 
> bash-2.05$ cd /opt/SUNWspro/lib
> bash-2.05$ nm -A *.so | grep s_copy
> libf77compat.so: [1800] | 109760| 292|FUNC |GLOB |0  |9   |__s_copy
> libf77compat.so: [900]  |      0|   0|FILE |LOCL |0  |ABS |s_copy.c
> libfsu.so: [3657]       | 121972| 492|FUNC |GLOB |0  |9   |__f90_s_copy
> libfsu.so: [1168]       |      0|   0|FILE |LOCL |0  |ABS |f90s_copy.c
> 
> Do you think there is some name mangling issues occurring here, or is it
> that I need to add a different library?
> 
> Oooo.  I think I figured it out.  I bet my version of atlas was built
> with g77.  Yep:
> 
> bash-2.05$ cd /usr/lib
> bash-2.05$ nm liblapack.a | grep s_copy
> [6]     |         0|       0|NOTY |GLOB |0    |UNDEF  |s_copy
> 
> So, adding 
> 
> -L/opt/sfw/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3 -lg2c
> 
> to the link line gets everything to compile.
> 
> So, should atlas_info try and go a step further and check what compiler
> was used to build lapack and friends? 

I hope not. Instead, various user-specific mixing of compilers/libraries
should be done in site.cfg level. But see below.

> If it sees g77, it could add the library g2c and the appropriate
> library directory to the path.  The combinations are endless, but,
> since ATLAS is usually built with gcc, the given case is probably
> pretty common.

Indeed, ATLAS is often built with gcc but it does not use g77
for building its libraries (g77 is used only when running tests).
So, adding g77 specific -lg2c to non-g77 specific atlas_info is
not a proper solution.

The missing symbols s_copy,.. come from the g77 built lapack library.
IMO, the right solution is to recompiler lapack library with Forte f90
compiler if you are using the same compiler in scipy.linalg (this also
means that you have to redo lapack/atlas connection).
Then there should be no need to use -lg2c when linking. 

I have included setup_lapack.py file at the end of this message.
This might ease building lapack libraries with Forte f90 (not that it
would be so difficult) using

FC_VENDOR=Sun LAPACK_SRC=/path/to/LAPACK setup.py \
  build_flib --build-flib=/path/to/where/you/want/liblapack.a/

Pearu

#-------- setup_lapack.py ------------
from scipy_distutils.system_info
import get_info,LapackSrcNotFoundError
from scipy_distutils.misc_util import fortran_library_item

def configuration(parent_package=''):
    # Use LAPACK_SRC environment variable to indicate the location
    # of LAPACK sources.
    lapack_src_info = get_info('lapack_src')
    if not lapack_src_info:
        raise LapackSrcNotFoundError
    config = {}
    config['fortran_libraries'] = [\
        fortran_library_item('lapack',lapack_src_info['sources'])
        ]
    return config

if __name__ == '__main__':
    from scipy_distutils.core import setup
    setup(**configuration())
#--------------------------------------




More information about the Scipy-dev mailing list