I'm pretty new to SCons and noticed that CCCOMSTR and LINKCOMSTR will not work when I'm building a shared library in the SConscript.
Here is the simplified version of my SConstruct:
CFLAGS = ["-Wall", "-pedantic", "-std=c99"]
# building environment
env = Environment(CFLAGS = CFLAGS, CPPDEFINES = ["DEBUG"])
# checking dependencies
conf = env.Configure()
conf.CheckHeader("stdlib.h")
conf.CheckHeader("string.h")
conf.CheckLib("libdl")
env["CCCOMSTR"] = "Compiling $SOURCE ..."
env["LINKCOMSTR"] = "Linking $TARGET ..."
SConscript(dirs = ["lib1", "lib2"], exports=["env", "conf"], name = "SConscript")
# main function
env.Program(target = "prog", LIBS=["libdl"], source = Glob("*.c"))
and the library SConscript would look like:
Import("env", "conf")
env.SharedLibrary(target = "test1", source = Glob("*.c"))
My expectation is that the env["CCCOMSTR"]
and env["LINKCOMSTR"]
should be propagated via Import and displayed properly. This however isn't happening and I see a gcc/clang command instead.
Setting these variables in the SConscript does not make any difference either.
The output is as follows:
scons: Reading SConscript files ...
Checking for C header file stdlib.h... (cached) yes
Checking for C header file string.h... (cached) yes
Checking for C library libdl... (cached) yes
scons: done reading SConscript files.
scons: Building targets ...
Compiling log.c ...
Compiling main.c ...
clang -o lib1/test1.os -c -Wall -pedantic -std=c99 -g -fPIC -DDEBUG lib1/test1.c
clang -o lib1/libtest1.so -shared lib1/test1.os -ldl
clang -o lib2/test2.os -c -Wall -pedantic -std=c99 -g -fPIC -DDEBUG lib2/test2.c
clang -o lib2/libtest2.so -shared lib2/test2.os -ldl
Compiling xalloc.c ...
Linking prog ...
scons: done building targets.
Is it just a SCons bug or something that I am doing wrong here? Could not find much info about it in the net, hence asking here. :)
(SCONS versions that I've tried and that displayed the behaviour above are v2.1.0, v2.3.4)