/usr/bin/ld: cannot find -latlas

Tag: compilation , fedora , ld , scons , atlas Author: chast Date: 2012-08-01

I'm trying to install code which I've successfully installed in the past on a new computer, and am running into problems.

This is on Fedora, using scons. The previous successful installation was on Ubuntu.

When I type scons, it gives the following error:

/usr/bin/ld: cannot find -latlas

I have successfully installed atlas-devel via yum.

If it helps, you'll find below the top level SConstruct File (--- indicates redacted code)


BUILD_LIB_DIR     = '#build/lib'
BUILD_INCLUDE_DIR = '#build/include'
BUILD_BIN_DIR     = '#build/bin'

import os

default_env = Environment(ENV        = os.environ,             # use the system $PATH variable
                          CCFLAGS    = ['-pipe', '-Wall'],
                          CXXFLAGS   = ['-std=c++0x'],
                          CPPPATH    = [BUILD_INCLUDE_DIR, '#src/'],
                          LIBPATH    = [BUILD_LIB_DIR],
                          CPPDEFINES = ['_USE_LCM_'])

default_env.Append(LIBS = [---, 'lapack', 'blas', 'atlas', 'armadillo', 'rt'])

default_env.Alias('install', [BUILD_LIB_DIR, BUILD_INCLUDE_DIR, BUILD_BIN_DIR])

# Create the command-line options along with help text
vars = Variables()
vars.Add(BoolVariable('debug', 'Compile in debug mode with -g and -pg', 0))
vars.Add(EnumVariable('---'))
vars.Add(BoolVariable('log-data', 'Define LOG_DATA in the preprocessor so internal state of modules will be written to log files', 0))
Help(vars.GenerateHelpText(default_env))

debug = ARGUMENTS.get('debug', 0)
log   = ARGUMENTS.get('log-data', 0)

if int(debug):
    default_env.Append(CCFLAGS = ['-g', '-pg'])
    default_env.Append(LINKFLAGS = ['-pg'])
else:
    default_env.Append(CCFLAGS = ['-O3'])

if int(log):
    default_env.Append(CPPDEFINES = ['LOG_DATA'])

log_env = default_env.Clone();
log_env.Append(LIBS=['global', 'readlog', 'z'])

Export(['default_env', 'log_env', 'BUILD_LIB_DIR', 'BUILD_INCLUDE_DIR', 'BUILD_BIN_DIR', ---])

SConscript(['src/SConscript',
            'docs/SConscript'])
It turns out the issue was that atlas puts the libatlas.so in /usr/lib(64)/**atlas**/... how do I tell the SConstruct file to look there?
Add /usr/lib/atlas to the LIBPATH array in your default_env: LIBPATH = [BUILD_LIB_DIR, /usr/lib/atlas]

Best Answer

It turns out the issue was that atlas puts the libatlas.so in /usr/lib(64)/atlas/... Thanks to @Dave_Bacher for information on how to deal with this, namely

Add /usr/lib/atlas to the LIBPATH array in your default_env:

LIBPATH = [BUILD_LIB_DIR, /usr/lib/atlas]