0

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 ?

Jerikc XIONG
  • 3,517
  • 5
  • 42
  • 71

1 Answers1

1

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.

mstorsjo
  • 12,983
  • 2
  • 39
  • 62
  • I simply use `NDK-BUILD` to start building. So how to build with version? – Jerikc XIONG Nov 10 '15 at 14:52
  • It picks the version to build your application code for from `jni/Application.mk` or `AndroidManifest.xml`. Also, for OpenH264, you can choose a version when you build it, e.g. `make OS=android NDKLEVEL=3` (where the default is 9). – mstorsjo Nov 10 '15 at 19:04
  • Which property should be set in `jni/Application.mk` ? – Jerikc XIONG Nov 11 '15 at 01:51
  • In this case, set `APP_PLATFORM := android-9` in `jni/Application.mk`; then it should avoid this issue. If your application actually is supposed to run on Android versions lower than that, you need to rebuild OpenH264 to target a lower version instead. – mstorsjo Nov 11 '15 at 06:54
  • It works fine for me after set `APP_PLATFORM := android-15` in `jni/Application.mk`. So accept and upvote the answer. Thanks. – Jerikc XIONG Nov 12 '15 at 04:40