[Scons-users] modify linker command

Gary Oberbrunner garyo at oberbrunner.com
Tue Jun 19 08:44:27 EDT 2012


On Tue, Jun 19, 2012 at 8:25 AM, F. Heitkamp <heitkamp at ameritech.net> wrote:

> I second this.  I have a rather unusual Linux system with libraries in

> certain directories.  I need to specify these (LDFLAGS,LIBS,etc).  Scons

> doesn't seem to allow an easy way to do this.  Not trying to create a flame

> war but this is very easy with autotools.  Doesn't anyone have any hints?

>  I've tried just about everything I can think of, without actually modifying

> Scons scripts.


Not sure why this is an issue. This should be trivial; we do it all
the time. You can modify LINKCOM, SHLINKCOM, LDFLAGS, and many other
vars -- see the man page. You can do it per-OS if you like:

env=Environment()
if sys.platform == 'linux2':
env.Append(LIBS=['xyz', 'pdq')
env.Append(LDFLAGS=' $EXTRA_LDFLAGS')
env['EXTRA_LDFLAGS'] = '-whatever'
if sys.platform == 'darwin':
env[LINKCOM] = '$LINK $MYSPECIALDARWINLINKFLAGS -o $TARGET
$LINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS $_FRAMEWORKPATH
$_FRAMEWORKS $FRAMEWORKSFLAGS'

etc. Here's a tip to print all the variables in a construction environment:
env=Environment()
print env.Dump()


--
Gary


More information about the Scons-users mailing list