GPUOpen-Tools / radeon_compute_profiler

The Radeon Compute Profiler (RCP) is a performance analysis tool that gathers data from the API run-time and GPU for OpenCL™ and ROCm/HSA applications. This information can be used by developers to discover bottlenecks in the application and to find ways to optimize the application's performance.
MIT License
84 stars 19 forks source link

Build failure in AMDTActivityLoggerProfileControl #28

Open baerbock opened 5 years ago

baerbock commented 5 years ago

I'm building with gcc 9.1.0 at Ubuntu. All ROCm present. The paths were shortened. This is from RCP_Build.log:

g++ -o ./rcp/src/Common/Src/AMDTActivityLogger/AMDTActivityLogger.os -c -fPIC -Wall -Werror -Wextra -g -fmessage-length=0 -Wno-unknown-pragmas -pthread -std=c++11 -D_LINUX -Wno-expansion-to-defined -Wno-ignored-attributes -Wno-implicit-fallthrough -O3 -DNDEBUG -fvisibility=hidden -Wno-maybe-uninitialized -DAMDT_PUBLIC -std=c++11 -fno-strict-aliasing -D_LINUX -DAMDT_BUILD_SUFFIX= -DAMDT_DEBUG_SUFFIX= -I./rcp/src/Common/Src/AMDTActivityLogger -I./rcp/src/Common/Src -I./rcp/src/Common/Src/TSingleton -I./rcp/src/Common/Lib/Ext/utf8cpp/source -I./rcp/src/Common/Src ./rcp/src/Common/Src/AMDTActivityLogger/AMDTActivityLogger.cpp
g++ -o ./rcp/src/Common/Src/AMDTActivityLogger/AMDTActivityLoggerProfileControl.os -c -fPIC -Wall -Werror -Wextra -g -fmessage-length=0 -Wno-unknown-pragmas -pthread -std=c++11 -D_LINUX -Wno-expansion-to-defined -Wno-ignored-attributes -Wno-implicit-fallthrough -O3 -DNDEBUG -fvisibility=hidden -Wno-maybe-uninitialized -DAMDT_PUBLIC -std=c++11 -fno-strict-aliasing -D_LINUX -DAMDT_BUILD_SUFFIX= -DAMDT_DEBUG_SUFFIX= -I./rcp/src/Common/Src/AMDTActivityLogger -I./rcp/src/Common/Src -I./rcp/src/Common/Src/TSingleton -I./rcp/src/Common/Lib/Ext/utf8cpp/source -I./rcp/src/Common/Src ./rcp/src/Common/Src/AMDTActivityLogger/AMDTActivityLoggerProfileControl.cpp
./rcp/src/Common/Src/AMDTActivityLogger/AMDTActivityLoggerProfileControl.cpp: In member function 'bool AMDTActivityLoggerProfileControl::CallProfileControlEntryPointFromLibraryWithMode(void*&, const wchar_t*, void (*&)(amdtProfilingControlMode), const char*, amdtProfilingControlMode)':
./rcp/src/Common/Src/AMDTActivityLogger/AMDTActivityLoggerProfileControl.cpp:176:98: error: cast between incompatible function types from 'osProcedureAddress' {aka 'int (*)()'} to 'ProfilingControlProcWithMode' {aka 'void (*)(amdtProfilingControlMode)'} [-Werror=cast-function-type]
  176 |                 profilingControlProc = reinterpret_cast<ProfilingControlProcWithMode>(procAddress);
      |                                                                                                  ^
cc1plus: all warnings being treated as errors
scons: *** [./rcp/src/Common/Src/AMDTActivityLogger/AMDTActivityLoggerProfileControl.os] Error 1
scons: building terminated because of errors.
*** ERROR during the build of the 64 bit framework ***
chesik-amd commented 5 years ago

We'll take a look at this, but in the meantime, can you try adding "-W-no-cast-function-type" to this line in the SConscript file, and see if that allows you to compile using gcc 9?

https://github.com/GPUOpen-Tools/common-src-AMDTActivityLogger/blob/master/SConscript#L19

baerbock commented 5 years ago

@chesik-amd Hi Chris, the common-src-AMDTActivityLogger code alone doesn't compile with scons.

So I've tried to fix it by

initCXLVars(CXL_vars)

CXL_env = Environment( variables = CXL_vars, ENV = {'PATH':os.environ['PATH']})


- changed filename from SConscript to SConstruct

Now only `env['CXL_lib_dir']` is undefined!
chesik-amd commented 5 years ago

AMDTActivityLogger isn't configured to build by itself. It is built as part of the RCP build process. If you make the change I suggested in the clone the that is brought down as a result of running RCP's UpdateCommon script, and then try rebuilding RCP, does it help?

justxi commented 5 years ago

I had the same problem while compiling RCP, adding "-Wno-cast-function-type" to SConscript file, lets GCC 9.1 build this successfully.