Clang default in README
dingiso opened this issue · comments
CMake initially use GCC as compiler. Howerver, GCC was causing some false compilation errors. When I switched to Clang, Sparta compiled successfully.
So I highly suggest setting clang as the default compiler, especially since it has already been included in the Conda environment.
The compile command in the README need to be updated accordingly.
CC=clang CXX=clang++ cmake .. -DCMAKE_BUILD_TYPE=Release
Sparta should compile cleanly with almost any compiler given. What are the false errors you've observed? Which version of gcc
did you use?
Hi Knute,
These are some errors I got, I'm rethinking that some of them is not false.
I'm using gcc 11.3.0
gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04.1)
- Constructor in RegisterBits.
map/sparta/sparta/functional/RegisterBits.hpp
Lines 79 to 82 in 7b7f842
Using local_storage_
to assign local_data_
without constructing it first
I fix it by adding local_storage_() between line 79 and 80, the compilation passed
- ss never be NULL in LexicalCast.hpp
map/sparta/sparta/utils/LexicalCast.hpp
Lines 78 to 87 in 60dd030
I fix it by deleting the line 85-87, it passed.
- fall through at switch in ConfigApplicators.hpp
map/sparta/sparta/app/ConfigApplicators.hpp
Lines 310 to 316 in 60dd030
The last case and default fall through the switch without break.
But I think the first param in assert is 0 so it may be a false error
I change the compiler to clang and it all gone.
- Looks like a good fix
- I have no idea what that cast does. I did some research and I think the intent was to check for a bad
stringstream
, but the code should look like this:
if(false == ss.fail()){
return tmp;
}
- I think adding a
break
before line 314 will fix it
Do you mind making these patches and submitting a PR?
Hi Knute,
Great , I will making these patches and submitting a PR
Thanks,
Dingisoul
Issues addressed.