What is the proper development environment setup to compile this on?
leimath opened this issue · 3 comments
I was trying to read the code in include directory.
Currently, running WSL2 Ubuntu-24.04. With both clang (18.1.3) and g++(13.2.0) however both result in too many errors being thrown via clangd (vim + YCM) setup. I did discuss possibilities of what is going wrong there ycm-core/YouCompleteMe#4268 but couldn't fix/think of any other way. Any ideas on what I can try would be good.
I would like to know what is the setup that this project was built on so probably I can replicate it and see if it works for me?
Hello,
I don’t have personal experience with YCM, but one thing I'ven noticed right away is ensuring you have the flag -std=c++23 set to enable support for std::expected.
We should also confirm, that you can compile it manually. Try compiling the Fibonacci example with the following command in the examples directory:
g++ -std=c++23 -I../include fib.cpp -o fib
Personally, I've used VIM with clangd and everything worked. I also noticed you mentioned that the compile commands are in the /include directory, but they should ideally be in the root directory of your project (where the CMakeLists.txt is located) if I am not mistaken. Also, double-check that the compile commands include the correct path to the Coros library.
Let me know if this helps, and if not, we can look at it further.
Running g++ -std=c++23 -I../include fib.cpp -o fib
gives:
In file included from ../include/thread_pool.h:10,
from ../include/wait_tasks.h:10,
from ../include/start_tasks.h:7,
from fib.cpp:3:
../include/deque.h:204:11: warning: use of ‘std::hardware_destructive_interference_size’ [-Winterference-size]
204 | alignas(hardware_destructive_interference_size) std::atomic<uint_fast64_t> top_;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/deque.h:204:11: note: its value can vary between compiler versions or with different ‘-mtune’ or ‘-mcpu’ flags
../include/deque.h:204:11: note: if this use is part of a public ABI, change it to instead use a constant variable you define
../include/deque.h:204:11: note: the default value for the current CPU tuning is 64 bytes
../include/deque.h:204:11: note: you can stabilize this value with ‘--param hardware_destructive_interference_size=64’, or disable this warning with ‘-Wno-interference-size’
../include/deque.h:205:11: warning: use of ‘std::hardware_destructive_interference_size’ [-Winterference-size]
205 | alignas(hardware_destructive_interference_size) std::atomic<uint_fast64_t> bottom_;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Just for clarity, I ran the project under QtCreator as well.
Currently there is an error : 'cstddef' file not found
which is strange since -stdlib=libc++
is passed to the compiler. I also made sure libstdc++-13-dev
is also present on my system. EDIT: Adding all the deps from https://github.com/google/filament/blob/main/BUILDING.md#linux fixes this.
Still cannot figure out why <expected>
is not found and other errors
I have tried before & now to place compile_commands.json in the root directory. Also -std=c++23
as per the CMakeLists.txt so I am pretty sure I am not messing that part up.
Finally fixed everything.
Ok so to summarize. The deps mentioned here were needed for half the errors https://github.com/google/filament/blob/main/BUILDING.md#linux
.
After that due to clang stdlib being using the libc++-dev
(strangely clang used the gcc version and did not complain about not the correct one) and it being not installed with default sudo apt install clang
resulted with the errors.
Simply doing the following command fixes this and any other issue.
sudo apt install libc++-dev libc++abi-dev
I also did set(CMAKE_CXX_STANDARD_REQUIRED ON)
in the clang branch of the CMakeLists.txt.
For anyone else trying to set this up. You can also follow the Github Actions Workflow file mostly for easier installation.