yse / easy_profiler

Lightweight profiler library for c++
MIT License
2.17k stars 189 forks source link

Not building with gcc 4.8.5 - Unsupported #144

Open zyth0s opened 5 years ago

zyth0s commented 5 years ago

When I tried to compile easy_profiler with gcc 4.8.5 I encountered the following error:

profiler_gui/main_window.cpp:2163:17: note: #pragma message: Warning: in gcc 4 and lower std::stringstream has no swap()! Memory consumption may increase! Better use gcc 5 or higher instead.
 #pragma message "Warning: in gcc 4 and lower std::stringstream has no swap()! Memory consumption may increase! Better use gcc 5 or higher instead."
...
easy_profiler_converter/include/json.hpp:67:10: error: #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
         #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"

When I compile with Clang 7.0.0: profiler_gui/main_window.cpp:2166:14: error: no member named 'swap' in 'std::basic_stringstream<char>'

Both compilers are expected to work after reading the prerequisites:

Fortunately, it compiled with gcc-8.

rationalcoder commented 5 years ago

Honestly, using anything related to streams in C++ was a bad idea. I believe the first case (4.8.5) just requires better documentation saying that gcc version X is required for the json converter. If you just want core and/or the gui, then you can just not build the json converter. It's not needed for anything.

cas4ey commented 5 years ago

Oops, we haven't checked gcc-4 build after adding json-cpp :man_facepalming:
But, as @rationalcoder already mentioned, you can exclude profiler_converter when building with gcc-4.
And thanks for reporting about clang-7!

Haffon commented 5 years ago

It is good to know prerequisites is CMake >= 3.0 and GCC >= 4.8, I misunderstand compile easy_profiler may be need GCC7+ when I was reading "https://github.com/yse/easy_profiler/wiki/Known-bugs-and-issues". I will search for solution want to compile easy profiler core for embedded system which installed centos 7.4, and compile easy profiler gui for ubuntu 16.04 desktop. Any ideas?

cas4ey commented 5 years ago

When I compile with Clang 7.0.0: profiler_gui/main_window.cpp:2166:14: error: no member named 'swap' in 'std::basic_stringstream<char>'

BTW, compiled with clang-7 without errors. Also downloaded clang libc++ source code from clang.llvm.org and there is a public basic_stringstream::swap in include/sstream :man_shrugging:

I will search for solution want to compile easy profiler core for embedded system which installed centos 7.4, and compile easy profiler gui for ubuntu 16.04 desktop. Any ideas?

Faced any problems?