farhany
farhany

Reputation: 1521

How to point scons to a different compiler installed in my home directory?

I have tried editing SConstruct to point to a different gcc compiler but it always seems to use the one defined in /usr/bin/gcc and /usr/bin/g++.

env = DefaultEnvironment()
env['CC'] = '/home/aaron/devel/bin/gcc'
env['CXX'] = '/home/aaron/devel/bin/g++'

What am I doing wrong? Also, is there a way to specify a different compiler on the command line using something like:

scons cxx=/home/aaron/devel/bin/g++

I've gone crazy trying to make this work. Thanks!

Upvotes: 3

Views: 7647

Answers (2)

Alex Martelli
Alex Martelli

Reputation: 881805

There is a suggestion in "Why doesn't SCons find my compiler/linker/etc.?" in the SCons wiki? For your case, that would be

path = ['/path/to/other/compiler/bin', '/bin', '/usr/bin',]
env = Environment(ENV = {'PATH' : path})

i.e., make your own environment with exactly the content you want, such as the $PATH (other bits of useful advice about environments are close by in the same wiki page).

To add your own options to scons' command line, per the docs, you should be able to use AddOption, see section 12.1.5 (but, I have not tried this one myself).

Upvotes: 3

Troels
Troels

Reputation: 1

A "dirty trick" is "just" to make a symbolic link to the new interpretor in the folder where you issue the scons command

Upvotes: 0

Related Questions