Mali GPU debbuger

Hello, I’m trying to run mali gpu debbuger with lumberyard and it asks me to include the mgd library

include $(LOCAL_PATH)/../android-non-root/MGD.mk

in Android.mk file and then later load it

  try {
System.loadLibrary("MGD");
}
catch( UnsatisfiedLinkError e )
{
// Feel free to remove this log message.
Log.i("[ MGD ]", "libMGD.so not loaded.");
}

in Main activity file. My question is - where exactly do i put these lines. Lumberyard contains many entry points/modules and i’m not sure if Android.mk files even work with waf builds.

Hi @Vidas_Maslauskas,

To include the shared library in the APK, you will need to edit either compile_settings_android_armv7.py or compile_settings_android_armv8.py from <engine_root>/Tools/build/waf-1.7.13/lmbrwaflib depending on your target device.

The following code template should probably only be included in the debug and profile variant functions within the above files but could be applied to the common_settings function if desired:

        conf.env['EXT_LIBS'] += [
conf.add_to_android_cache(os.path.join(<path_to_mali_install>, 'target', 'android', 'arm', 'unrooted', <architecture>, 'libMGD.so'))
]

Where is:

  • ‘armeabi-v7a’ for armv7
  • ‘arm64-v8a’ for armv8
    NOTE: The paths to the libraries is based off the latest version of the debugger, 5.1.0, and may be different if using another version.

Now to load the library, the try/catch code you mentioned will need to be added inside the static block of <engine_root>/Code/Launcher/AndroidLauncher/ProjectBuilder/ProjectActivity.java

Example:

    static
{
Log.d("LMBR", "BootStrap: Starting Library load");
System.loadLibrary("c++_shared");
try {
System.loadLibrary("MGD");
}
catch(UnsatisfiedLinkError e)
{
Log.i("LMBR", "libMGD.so not loaded.");
}
Log.d("LMBR", "BootStrap: Finished Library load");
}

After making these edits, run the configure WAF command and rebuild.