rocprofiler
rocprofiler copied to clipboard
[Build error] Missing string header
When I compile the 3.5.0 release of rocprofiler I get the following build error which I could fix by adding
#include <string>
to test/ctrl/test_kernel.h:
[ 36%] Linking C executable c_test
cd /tmp/rocprofiler-rocm-3.5.0/build/test && /usr/bin/cmake -E cmake_link_script CMakeFiles/c_test.dir/link.txt --verbose=1
/usr/bin/cc -Wall -g -march=native -O2 -O3 -DNDEBUG -rdynamic CMakeFiles/c_test.dir/app/c_test.c.o -o c_test
make[2]: Leaving directory '/tmp/rocprofiler-rocm-3.5.0/build'
[ 36%] Built target c_test
In file included from /tmp/rocprofiler-rocm-3.5.0/test/simple_convolution/simple_convolution.h:29,
from /tmp/rocprofiler-rocm-3.5.0/test/simple_convolution/simple_convolution.cpp:23:
/tmp/rocprofiler-rocm-3.5.0/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/rocprofiler-rocm-3.5.0/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/rocprofiler-rocm-3.5.0/test/ctrl/test_kernel.h: In member function ‘bool TestKernel::SetHostDescr(const uint32_t&, const TestKernel::des_id_t&, const uint32_t&)’:
/tmp/rocprofiler-rocm-3.5.0/test/ctrl/test_kernel.h:105:19: error: ‘malloc’ was not declared in this scope
105 | descr.ptr = malloc(size);
| ^~~~~~
/tmp/rocprofiler-rocm-3.5.0/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/rocprofiler-rocm-3.5.0/test/simple_convolution/simple_convolution.cpp:23:
/tmp/rocprofiler-rocm-3.5.0/test/simple_convolution/simple_convolution.h: At global scope:
/tmp/rocprofiler-rocm-3.5.0/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/rocprofiler-rocm-3.5.0/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 |
Coudl you use roc-3.5 branch. I don't see the issue there, the include is in place: https://github.com/ROCm-Developer-Tools/rocprofiler/blob/roc-3.5/test/ctrl/test_kernel.h#L26
Hey @eshcherb, <string.h> refers to the C header but does not include the C++ header (string class) that is needed for the test.
OK, will fix it
Closing this issue as the #include <string> header has since been added to test/ctrl/test_kernel.h.