[Scons-users] Directing scons to link a local install of a library instead of system version
Mats Wichmann
mats at wichmann.us
Wed Jun 4 13:29:13 EDT 2025
On 6/4/25 10:53, Olumide via Scons-users wrote:
> The "primary" SConstruct file, https://github.com/gem5/gem5/blob/stable/
> references/uses CCFLAGS and LINKFLAGS which I have tried to set as follows
>
> scons CCFLAGS="-I/home/me/.local/install/include/" LINKFLAGS="-L/home/
> me/.local/install/lib64/" EXTRAS=/home/me/repos/project ...
You don't want to put those into CCFLAGS and LINKFLAGS directly. Let
SCons construct the command line correctly.
library search dirs go in LIBPATH
include search paths go in CPPPATHS
You can even let SCons do the work of distributing the flags you want:
env = Environment()
args="-I/home/me/.local/install/include/ -L/home/me/.local/install/lib64/"
env.MergeFlags(args)
print(f"{env['LINKFLAGS']=}, {env['LIBPATH']=}, {env['CCFLAGS']=},
{env['CPPPATH']=}")
>
> Where my SConstruct file is in the EXTRAS directory.
>
> However the linker error "/usr/bin/ld: cannot find -lyaml-cpp" persists.
>
> > ... You could change those names and do something like:
> >
> > if ARGUMENTS.get('EXTRA_LIBPATH'):
> > env.Prepend(LIBPATH=ARGUMENTS.get('EXTRA_LIBPATH'))
>
> Do you mean I should change LIBPATH to EXTRA_LIBPATH on the command line
> and add those two lines to my SConscript file?
you can do that if you want to have the flexibiity of specifying on the
command line. It's obviously not *required* to do so.
>
> - Olumide
>
More information about the Scons-users
mailing list