Open aacirino opened 6 years ago
You have to specify TEMP
manually if you want to use it. Cevelop/Scons has a limited default environment. To use environment variables from your system/starting shell, pass it as shown in the following image (project settings).
The more pythonic way would be to access dictionaries using non-failing access methods and a reasonable fallback:
env = Environment(ENV={'PATH': os.environ['PATH'], 'TEMP' : os.environ.get('TEMP','/tmp')})
Hi Marcel, the TEMP dir issue is solved, but then another problem surfaced. It seems that somehow Scons is truncating the compiler invocation:
scons: building associated VariantDir targets: Debug/src
o Debug/src/test.o -c -I/usr/local/include src/test.cpp
scons:
src' is up to date.
sh: o: command not found`
Can you attach your SConstruct file? The current output does not help much.
Sure. I didn't edit the file, it is as generated by Cevelop.
Thank you for the hint. We probably need to update the default generated 'scons' files regarding the env variable access and python3 changes.
It looks as scons is not able to detect a default compiler for your macos/darwin environment. As the tools clang
and clangxx
are not default added to the tools list for any of the known scons platforms, they will not be found by default. See SConstruct lines 30 and 31 in the following image if you want to add clang/clangxx to your tools list.
The main thing is, that in a generated and managed cevelop/scons project, compiler name and settings will be taken from the cevelop project settings stored in SConfig.py
. Check your SConfig.py
file for a COMPILER_NAME
entry which will be used in my SConstruct at line 36. I guess it will currently be empty if you did not set it or did not clean and build the scons project.
I did override my default detected g++
with clang++
and it compiled using clang++
.
Hi Marcel, it seems to me that the Scons generator doesn't use the project settings in the case of LLVM toolchain (or any toolchain other then standard GCC, perhaps). Please take a look at the original and edited SConfig files I've attached. The original just leaves blank the fields that should have been set with the settings I have in my project configuration. With the edited (correct) SCconfig in the command line I am able to build the project, the problem is that Cevelop will keep substituting the edited file with a new one, with empty fields.
As far as I can see, the Scons generator needs to be updated for the case of a LLVM toolchain, of for non default toolchains. It is weird, because the C/C++ Build -> Settings -> LLVM Clang++ -> Includes
path is correctly passed on to the SConfig.py file, but, for instance, C/C++ Build -> Settings -> LLVM Clang++ linker -> Libraries -> Library search path
is not, as well as other settings like the compiler name. That's a good question, to debug the generator and see why just one of the settings is being used.
Update:
In the SCons preferences setting SCons options to
CXX_FLAGS=-std=c++17
COMPILER_NAME=clang++
LIBRARY_PATHS=/usr/local/opt/llvm/lib
didn't help.
PS: shouldn't this issue be marked as open?
Update:
I created a GCC toolchain project to test it with GCC 7.2 and SCons. Unfortunately the global LLVM preferences were injected in the GCC project even if I removed them from the project settings. Each time I built the project the LLVM would be copied to the project settings so that I was forced to remove the specific LLVM global settings to be able to compile with GCC. The good news is that the project did build with GCC 7.2 and was then successfully converted to SCons that works as intended. Seems to me that having LLVM and GCC in Cevelop is causing the issues.
By either creating a new Scons-based project or converting an existing one to Scons the build has this error:
KeyError: 'TEMP':
File "/Users/aacirino/cevelop/test/SConstruct", line 30:
env = Environment(ENV={'PATH': os.environ['PATH'], 'TEMP' : os.environ['TEMP']})
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py", line 23:
raise KeyError(key)
My system: macOS 10.11.6 El Capitan Cevelop 1.8.0-201707131430 Scons v3.0.0.rel_3.0.0:4395:8972f6a2f699 installed with homebrew