androidandroid-ndkjava-native-interfaceopenh264

build error on Android: "error: undefined reference to 'pthread_setname_np'"


I always got the build error while compiling the Openh264:

libopenh264.a(WelsThreadLib.o):WelsThreadLib.cpp:function WelsThreadSetName: error: undefined reference to 'pthread_setname_np'

How to fix it ?


Solution

  • You get this error if you've built OpenH264 targeting an android version >= 9 (2.3), but try to link your own shared library targeting an older version. You need build OpenH264 targeting at least as old version as your own application is targeting.