ROCm / rocprofiler

ROC profiler library. Profiling with perf-counters and derived metrics.
https://rocm.docs.amd.com/projects/rocprofiler/en/latest/
MIT License
126 stars 46 forks source link

C to C++ includes, fix build issue with gcc 9 #50

Closed haampie closed 1 year ago

haampie commented 3 years ago

Fix a build issue with GCC 9.x:

[ 34%] Built target rocprof-link
[ 36%] Linking C executable c_test
cd /tmp/spack-stage/spack-stage-rocprofiler-dev-4.2.0-rqkv3pj2nvni3zgkn56e3juksrrq37eq/spack-build-rqkv3pj/test && /opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0/cmake-3.20.5-suunrvsam7gab4li77k2dw4vjy5zhowc/bin/cmake -E cmake_link_script CMakeFiles/c_test.dir/link.txt --verbose=1
/lib/spack/env/gcc/gcc -O3 -DNDEBUG -rdynamic CMakeFiles/c_test.dir/app/c_test.c.o -o c_test
make[2]: Leaving directory '/tmp/spack-stage/spack-stage-rocprofiler-dev-4.2.0-rqkv3pj2nvni3zgkn56e3juksrrq37eq/spack-build-rqkv3pj'
[ 36%] Built target c_test
In file included from /tmp/spack-stage/spack-stage-rocprofiler-dev-4.2.0-rqkv3pj2nvni3zgkn56e3juksrrq37eq/spack-src/test/simple_convolution/simple_convolution.h:29,
                 from /tmp/spack-stage/spack-stage-rocprofiler-dev-4.2.0-rqkv3pj2nvni3zgkn56e3juksrrq37eq/spack-src/test/simple_convolution/simple_convolution.cpp:23:
/tmp/spack-stage/spack-stage-rocprofiler-dev-4.2.0-rqkv3pj2nvni3zgkn56e3juksrrq37eq/spack-src/test/ctrl/test_kernel.h:81:16: error: 'string' in namespace 'std' does not name a type
   81 |   virtual std::string Name() const = 0;
      |                ^~~~~~
/tmp/spack-stage/spack-stage-rocprofiler-dev-4.2.0-rqkv3pj2nvni3zgkn56e3juksrrq37eq/spack-src/test/ctrl/test_kernel.h:28:1: note: 'std::string' is defined in header '<string>'; did you forget to '#include <string>'?
   27 | #include <stdint.h>
  +++ |+#include <string>
   28 | #include <map>
/tmp/spack-stage/spack-stage-rocprofiler-dev-4.2.0-rqkv3pj2nvni3zgkn56e3juksrrq37eq/spack-src/test/ctrl/test_kernel.h:84:16: error: 'string' in namespace 'std' does not name a type
   84 |   virtual std::string SymbName() { return Name() + ".kd"; }
      |                ^~~~~~
/tmp/spack-stage/spack-stage-rocprofiler-dev-4.2.0-rqkv3pj2nvni3zgkn56e3juksrrq37eq/spack-src/test/ctrl/test_kernel.h:84:11: note: 'std::string' is defined in header '<string>'; did you forget to '#include <string>'?
   84 |   virtual std::string SymbName() { return Name() + ".kd"; }
      |           ^~~
/tmp/spack-stage/spack-stage-rocprofiler-dev-4.2.0-rqkv3pj2nvni3zgkn56e3juksrrq37eq/spack-src/test/ctrl/test_kernel.h: In member function 'bool TestKernel::SetHostDescr(const uint32_t&, const TestKernel::des_id_t&, const uint32_t&)':
/tmp/spack-stage/spack-stage-rocprofiler-dev-4.2.0-rqkv3pj2nvni3zgkn56e3juksrrq37eq/spack-src/test/ctrl/test_kernel.h:108:19: error: 'malloc' was not declared in this scope
  108 |       descr.ptr = malloc(size);
      |                   ^~~~~~
/tmp/spack-stage/spack-stage-rocprofiler-dev-4.2.0-rqkv3pj2nvni3zgkn56e3juksrrq37eq/spack-src/test/ctrl/test_kernel.h:28:1: note: 'malloc' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
   27 | #include <stdint.h>
  +++ |+#include <cstdlib>
   28 | #include <map>
In file included from /tmp/spack-stage/spack-stage-rocprofiler-dev-4.2.0-rqkv3pj2nvni3zgkn56e3juksrrq37eq/spack-src/test/simple_convolution/simple_convolution.cpp:23:
/tmp/spack-stage/spack-stage-rocprofiler-dev-4.2.0-rqkv3pj2nvni3zgkn56e3juksrrq37eq/spack-src/test/simple_convolution/simple_convolution.h: At global scope:
/tmp/spack-stage/spack-stage-rocprofiler-dev-4.2.0-rqkv3pj2nvni3zgkn56e3juksrrq37eq/spack-src/test/simple_convolution/simple_convolution.h:50:8: error: 'string' in namespace 'std' does not name a type
   50 |   std::string Name() const { return std::string("SimpleConvolution"); }
      |        ^~~~~~
/tmp/spack-stage/spack-stage-rocprofiler-dev-4.2.0-rqkv3pj2nvni3zgkn56e3juksrrq37eq/spack-src/test/simple_convolution/simple_convolution.h:30:1: note: 'std::string' is defined in header '<string>'; did you forget to '#include <string>'?
   29 | #include "ctrl/test_kernel.h"
  +++ |+#include <string>
   30 |
make[2]: *** [test/CMakeFiles/ctrl.dir/build.make:135: test/CMakeFiles/ctrl.dir/simple_convolution/simple_convolution.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/tmp/spack-stage/spack-stage-rocprofiler-dev-4.2.0-rqkv3pj2nvni3zgkn56e3juksrrq37eq/spack-build-rqkv3pj'
make[1]: *** [CMakeFiles/Makefile2:327: test/CMakeFiles/ctrl.dir/all] Error 2