<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Opus Experts,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
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:</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "opus_projection_encoder_ctl" referenced by "libopusenc.so"</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Here is how to reproduce the issue:</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Build procedure</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
===============</div>
<div id="Signature">
<div>
<div>
<ol>
<li>Pre-build the libopus, libopusenc following the wiki: <a href="https://developer.android.com/ndk/guides/other_build_systems">https://developer.android.com/ndk/guides/other_build_systems</a>, I built libopus.so and libopusenc.so for all mentioned target
ABIs in the wiki.</li><li>When building libopusenc.so, this is command I run, the host option varies depending on the target ABI:
<p style="margin: 0px; font: 12px "Helvetica Neue"; color: rgb(69, 69, 69); margin: 0px">
./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</p>
</li><li>
<p style="margin: 0px; font: 12px "Helvetica Neue"; color: rgb(69, 69, 69); margin: 0px">
<span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;">For my native JNI library, attached the Android.mk file at the end of the email.</span></p>
</li><li>
<p style="font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; line-height: normal; color: rgb(69, 69, 69); margin: 0px;">
<font face="Calibri, Helvetica, sans-serif">The failure is seen as soon as </font><span style="color: rgb(0, 0, 0); font-family: Menlo; font-size: 9pt; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal;">System.</span><span style="color: rgb(0, 0, 0); font-family: Menlo; font-size: 9pt; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-style: italic;">loadLibrary</span><span style="color: rgb(0, 0, 0); font-family: Menlo; font-size: 9pt; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal;">(</span><span style="font-family: Menlo; font-size: 9pt; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; color: rgb(0, 128, 0); font-weight: bold;">"<span style="color: rgb(0, 0, 0); font-family: Menlo; font-size: 9pt; font-weight: 400; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal;">mynative_jni</span>"</span><span style="color: rgb(0, 0, 0); font-family: Menlo; font-size: 9pt; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal;">);
</span><span style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal;">is called.</span></p>
</li></ol>
</div>
<div><font color="#454545" face="Calibri, Helvetica, sans-serif">
<pre style="background-color:#ffffff; color:#000000; font-family:'Menlo'; font-size:9.0pt"><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;">Questions</span></pre>
<pre style="background-color:#ffffff; color:#000000; font-family:'Menlo'; font-size:9.0pt"><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;">==========</span></pre>
<pre style="background-color:#ffffff; color:#000000; font-family:'Menlo'; font-size:9.0pt"><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;">Does anyone know if this a known issue? <pre style="background-color: rgb(255, 255, 255); font-family: Menlo; font-size: 9pt"><span style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif"><span style="margin: 0px; background-color: rgb(255, 255, 255); display: inline !important">or did I miss anything during the build procedure? </span></span></pre><span style="font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255); display: inline !important"><pre style="background-color:#ffffff; color:#000000; font-family:'Menlo'; font-size:9.0pt"><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;"><span style="font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255); display: inline !important"><br></span></span></pre>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. </span></span></pre>
<pre style="background-color:#ffffff; color:#000000; font-family:'Menlo'; font-size:9.0pt"><br></pre>
<pre style="background-color:#ffffff; color:#000000; font-family:'Menlo'; font-size:9.0pt"><span style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;">I've also tried to use static prebuilt library (.a file instead of .so), however, I am getting undefined reference error on "</span><span style="color: rgb(0, 0, 0); font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;">opus_projection_encoder_ctl".</span><br></pre>
<pre style="background-color:#ffffff; color:#000000; font-family:'Menlo'; font-size:9.0pt"><br></pre>
<pre style="background-color:#ffffff; color:#000000; font-family:'Menlo'; font-size:9.0pt"><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;">Appreciate any inputs on this issue. If this is not the right forum, please direct me to the right forum to discuss this issue.</span></pre>
<pre style="background-color:#ffffff; color:#000000; font-family:'Menlo'; font-size:9.0pt"><br></pre>
<pre style="background-color:#ffffff; color:#000000; font-family:'Menlo'; font-size:9.0pt"><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;"><span style="font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255); display: inline !important">Thanks,</span></span></pre>
<pre style="background-color:#ffffff; color:#000000; font-family:'Menlo'; font-size:9.0pt"><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;"><span style="font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255); display: inline !important">Alice</span></span></pre>
<pre style="background-color:#ffffff; color:#000000; font-family:'Menlo'; font-size:9.0pt"><br></pre>
<pre style="background-color:#ffffff; color:#000000; font-family:'Menlo'; font-size:9.0pt">Android.mk:</pre>
<pre style="background-color:#ffffff; color:#000000; font-family:'Menlo'; font-size:9.0pt">=============</pre>
<pre style="background-color:#ffffff; color:#000000; font-family:'Menlo'; font-size:9.0pt">LOCAL_PATH:= $(call my-dir)<br><br>#===========================<br># Pre-build libopus Library.<br>#===========================<br>include $(CLEAR_VARS)<br><br>LOCAL_MODULE := libopus<br>LOCAL_SRC_FILES := path/to/prebuilt/$(TARGET_ARCH_ABI)/libopus.so<br><br>include $(PREBUILT_SHARED_LIBRARY)<br><br>#==============================<br># Pre-build libopusenc Library.<br>#==============================<br>include $(CLEAR_VARS)<br><br>LOCAL_MODULE := libopusenc<br>LOCAL_SRC_FILES := path/to/prebuilt/$(TARGET_ARCH_ABI)/libopusenc.so<br><br>include $(PREBUILT_SHARED_LIBRARY)</pre>
<pre style="background-color:#ffffff; color:#000000; font-family:'Menlo'; font-size:9.0pt"><pre style="background-color:#ffffff; color:#000000; font-family:'Menlo'; font-size:9.0pt">#=======================================<br># Build my native Library.<br>#=======================================<br>include $(CLEAR_VARS)<br><br>LOCAL_MODULE := libmynative_jni<br><br>CPP_FILES := \<br> src/ogg_opus_jni_OGGEncoderJNIImpl.cpp \<br> src/ogg_opus_jni_OGGDecoderJNIImpl.cpp<br><br>LOCAL_SRC_FILES := $(CPP_FILES:$(LOCAL_PATH)/%=%)<br>LOCAL_C_INCLUDES := $(LOCAL_PATH)/opus<br>LOCAL_CFLAGS := -Wno-gnu-designator -Wformat=0<br>LOCAL_CPPFLAGS += -std=c++11 -Wformat=0<br>LOCAL_LDFLAGS := -llog<br>LOCAL_SHARED_LIBRARIES := libopus libopusenc<br>LOCAL_ASSET_DIR := $(LOCAL_PATH)/assets<br><br>include $(BUILD_SHARED_LIBRARY)</pre></pre>
</font></div>
<br>
</div>
</div>
</body>
</html>