Derecho-Project / derecho

The main code repository for the Derecho project.
BSD 3-Clause "New" or "Revised" License
187 stars 47 forks source link

Problems during compiling derecho demo apps #230

Closed Steamgjk closed 2 years ago

Steamgjk commented 2 years ago

Hi, Derecho staff. I am studying Derecho and I followed the instructions and I can successsfully compile drecho and install it to my VM.

Then I continued to compile the app in , but ecnounted a problem. I am just using some typical command:

cd demo mkdir build cd build cmake .. make

图片 图片 图片

I attach the whole error logs

error-log-derecho.txt

Then I turn to use the method from the Readme

g++ -std=c++1z -o simple_replicated_objects simple_replicated_objects.cpp -lderecho -pthread -lcrypto

(After adding -lcrypto, I can successfully compile the application simple_replicated_objects, so I think the failure of cmake method is also related to missing some dependent libs) I can continue to study the application with g++. But would you please check why cmake method cannot work? (I think cmake is more convenient than g++, because I donot need to compile apps one by one with cmake)

KenBirman commented 2 years ago

The thing that jumps out to me is that you used std=C++1z and then got a g++ complaint about features defined only in C++17 and later. My speculation would be that C++1z somehow isn't a true, complete, C++17. Try again but tell it to actually use C++17. I'm saying this because (1) Derecho requires C++17 or later, and (2) from the error message, it obviously doesn't think it was told to use C++17.

When working from source and compiling using your own commands, you may run into issues such as this, tied to how you've configured your toolchain (meaning the compiler standard, the linker, etc). All of them need to be C++17 or later.

Steamgjk commented 2 years ago

The thing that jumps out to me is that you used std=C++1z and then got a g++ complaint about features defined only in C++17 and later. My speculation would be that C++1z somehow isn't a true, complete, C++17. Try again but tell it to actually use C++17. I'm saying this because (1) Derecho requires C++17 or later, and (2) from the error message, it obviously doesn't think it was told to use C++17.

When working from source and compiling using your own commands, you may run into issues such as this, tied to how you've configured your toolchain (meaning the compiler standard, the linker, etc). All of them need to be C++17 or later.

Hi, @KenBirman I am afraid that is not the reason.

图片

Even if I change from -std=c++1z to -std=c++17, if I do not add -lcrypto, it will report the same error. Besides, I am just using a clean VM from Google Cloud with Ubuntu 20.04. I just followed the derecho ReadMe to install the dependencies. After that, I did not have any other configurations ( the compiler standard, the linker, etc). I think it satisfies "All of them need to be C++17 or later".

But that is not a big issue. So long as I add -lcrypto in the g++ command, I can successfully compile the app.

Regarding the issue with cmake, I think I found the reasons. I have configured cmake -DCMAKE_BUILD_TYPE=Release, so I can only make applications in the Release folder. I can successfully built the apps now. If I create a different folder and make there, maybe the path configuration will be wrong, causing some missing deps.

图片 图片

By the way, in the ReadMe, you staff suggest using -std=c++1z.

图片

I feel there is no much difference between c++17 and c++1z in practice, any special consideration about that? Which one is recommended?

songweijia commented 2 years ago

Hi @Steamgjk, the demo applications compile along with the derecho source code tree as a whole. You should build from the root of the derecho source tree instead of build it from a subdirectory. Please let me know if this solve your issue.

Steamgjk commented 2 years ago

This problem has been solved. Thanks Weijia.