Android NDK build failing in Linux due to a gmsl error

I have installed the PowerVR SDK from the Android SDK Manager and I see the following error while trying to build a native project:

Invalid attribute name:

package […]/android-ndk-r8d/build/gmsl/__gmsl:512: *** non-numeric second argument to `wordlist’ function: ‘’. Stop.

This is a known problem due to the r8d NDK not picking up properly the android:minSdkVersion property from the AndroidManifest.xml.

To work around that issue chenge the line 512 of the file /android-ndk-r8d/build/gmsl/__gmsl to:

int_encode = $(__gmsl_tr1)$(wordlist 1,$(words $1),$(__gmsl_input_int))