[Scons-users] SCons / Make object files get mixed up
Petteri Hintsanen
petterih at iki.fi
Tue Dec 8 11:41:47 EST 2015
Hello,
I'm working on a C++ project that uses both Make and SCons. Makefiles
compile object code into the same directory where the corresponding
sources are. Most of the modules are built with either Make or SCons,
not both. But there is one module that can be build with Make or SCons.
With this module, if Make has executed before SCons, SCons tries to use
an object file produced by Make. For example:
~$ scons -Q build/debug/radarsimu/playback
gcc -o build/debug/radarsimu/playback radarsimu/Playback.o
/usr/bin/ld: radarsimu/Playback.o: undefined reference to symbol
'__cxa_free_exception@@CXXABI_1.3'
//usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO
missing from command line
collect2: error: ld returned 1 exit status
scons: *** [build/debug/radarsimu/playback] Error 1
Here radarsimu is the module I'm trying to build with variant_dir =
"build/debug", and playback is one of binaries in that module. The
object file radarsimu/Playback.o has been compiled by Make. (For
clarity I have trimmed out libraries and other flags from the gcc
command line.) Another strange thing is that scons is executing gcc
instead of g++.
With --tree switch I get:
~$ scons -Q --tree=all,status build/debug/radarsimu/playback
gcc -o build/debug/radarsimu/playback radarsimu/Playback.o
/usr/bin/ld: radarsimu/Playback.o: undefined reference to symbol
'__cxa_free_exception@@CXXABI_1.3'
//usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO
missing from command line
collect2: error: ld returned 1 exit status
scons: *** [build/debug/radarsimu/playback] Error 1
E = exists
R = exists in repository only
b = implicit builder
B = explicit builder
S = side effect
P = precious
A = always build
C = current
N = no clean
H = no cache
[ RB ]+-build/debug/radarsimu/playback
[ RB C ] +-build/debug/radarsimu/Playback.o
[ R C ] | +-radarsimu/Playback.cpp
[E C ] | +-/usr/bin/g++
[E C ] +-/usr/bin/gcc
( ... snipped off libraries ... )
There are no files in build/debug/radarsimu but, if I understand the
above correctly, SCons assumes that radarsimu/Playback.o is actually
under the (variant) directory build/debug.
If I remove radarsimu/Playback.o, everything goes well:
~$ rm radarsimu/Playback.o
~$ scons -Q build/debug/radarsimu/playback
g++ -o build/debug/radarsimu/Playback.o -c radarsimu/Playback.cpp
g++ -o build/debug/radarsimu/playback build/debug/radarsimu/Playback.o
It might very well be that the reason for this odd behaviour is
somewhere else in the build configuration, especially since I have not
been able to reproduce this problem with a simpler example. But I would
be grateful if someone more experienced SCons user could point out what
could cause this kind of behaviour.
SCons version is 2.3.0.
Thanks,
Petteri.
More information about the Scons-users
mailing list