[opus] dlopen failed: cannot locate symbol "opus_projection_encoder_ctl" referenced by "libopusenc.so"

Alice Li Alice_lee0927 at hotmail.com
Tue May 7 20:32:28 UTC 2019


Hi Opus Experts,

I am working on a JNI library which depends on libopusenc which in turn depends on libopus. However, during runtime, I encountered a linking error while loading the library:

java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "opus_projection_encoder_ctl" referenced by "libopusenc.so"


Here is how to reproduce the issue:

Build procedure
===============

  1.  Pre-build the libopus, libopusenc following the wiki: https://developer.android.com/ndk/guides/other_build_systems, I built libopus.so and libopusenc.so for all mentioned target ABIs in the wiki.
  2.  When building libopusenc.so, this is command I run, the host option varies depending on the target ABI: ./configure DEPS_LIBS="-L/path/to/opus-1.3.1/.libs -lopus" DEPS_CFLAGS="-I/path/to/opus-1.3.1/include" --host x86_64-linux-android

  3.  ​For my native JNI library, attached the Android.mk file at the end of the email.

  4.  The failure is seen as soon as System.loadLibrary("mynative_jni"); is called.

Questions

==========

Does anyone know if this a known issue?

or did I miss anything during the build procedure?


This issue is seen with libopus 1.3.1/libopus1.3 and libopusenc 0.2.1. This issue is not seen with libopus 1.1.3.


I've also tried to use static prebuilt library (.a file instead of .so), however, I am getting undefined reference error on "opus_projection_encoder_ctl".


Appreciate any inputs on this issue. If this is not the right forum, please direct me to the right forum to discuss this issue.


Thanks,

Alice


Android.mk:

=============

LOCAL_PATH:= $(call my-dir)

#===========================
# Pre-build libopus Library.
#===========================
include $(CLEAR_VARS)

LOCAL_MODULE := libopus
LOCAL_SRC_FILES := path/to/prebuilt/$(TARGET_ARCH_ABI)/libopus.so

include $(PREBUILT_SHARED_LIBRARY)

#==============================
# Pre-build libopusenc Library.
#==============================
include $(CLEAR_VARS)

LOCAL_MODULE := libopusenc
LOCAL_SRC_FILES := path/to/prebuilt/$(TARGET_ARCH_ABI)/libopusenc.so

include $(PREBUILT_SHARED_LIBRARY)

#=======================================
# Build my native Library.
#=======================================
include $(CLEAR_VARS)

LOCAL_MODULE           := libmynative_jni

CPP_FILES              := \
    src/ogg_opus_jni_OGGEncoderJNIImpl.cpp \
    src/ogg_opus_jni_OGGDecoderJNIImpl.cpp

LOCAL_SRC_FILES        := $(CPP_FILES:$(LOCAL_PATH)/%=%)
LOCAL_C_INCLUDES       := $(LOCAL_PATH)/opus
LOCAL_CFLAGS           := -Wno-gnu-designator -Wformat=0
LOCAL_CPPFLAGS         += -std=c++11 -Wformat=0
LOCAL_LDFLAGS          := -llog
LOCAL_SHARED_LIBRARIES := libopus libopusenc
LOCAL_ASSET_DIR        := $(LOCAL_PATH)/assets

include $(BUILD_SHARED_LIBRARY)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xiph.org/pipermail/opus/attachments/20190507/364d3f49/attachment-0001.html>


More information about the opus mailing list