dlopen failed: cannot locate symbol “__cxa_finalize” referenced by “/system/lib/libdl.so”

341 views
Skip to first unread message

ikhah...@gmail.com

unread,
Oct 22, 2015, 12:58:29 PM10/22/15
to android-ndk
Hi all,

Up until Android 6, we have loaded our libraries as shown here
System.loadLibrary("c"); //libc.so
System.loadLibrary("m"); //libm.so
System.loadLibrary("dl"); //libdl.so
System.loadLibrary("gnustl_shared"); //libgnustl_shared.so
System.loadLibrary("ourA"); //libourA.so
...
System.loadLibrary("ourZ"); //libourZ.so

this worked fine, but starting from Android 6 it shows: "dlopen failed: cannot locate symbol “__cxa_finalize” referenced by “/system/lib/libdl.so”..." error.
Then we have removed all standard libraries from loading (libc, libm, libdl), this time Android 6 started fine (but with different bug), at lease it didnt show error about __cxa_finalize
Same code we tested in Android 5, again it started fine.

Here is my question.
- Do we really need load system libraries if we depend on them? according to this thread: https://groups.google.com/forum/?fromgroups#!msg/android-ndk/J3lzK4X--bM/4YaijymZy_AJ

In a nutshell, the dynamic linker doesn't know anything about your application (e.g. where its libraries live), it only knows about the LD_LIBRARY_PATH value that was set when the process was created.

system can find its own libraries and no need to do System.loadLibrary(...) for standard libraries.

- In case our assumption is not correct about not loading system libraries, why did Android 6 shows us such an error?
libdl is system library, libc system library, they know each other, libc contains __cxa_finalize, why Android 6 gives this error?

Thanks.

Alex Cohn

unread,
Nov 9, 2015, 1:18:36 PM11/9/15
to android-ndk
No, you don't need to load manually the system libraries - that's true for all versions of Android. Regarding gnusstl_shared and your private dependencies, the rules of the game changed relatively late, about 2 years ago the "crazy inker" has been introduced. But on the modern systems there is no worry: the dependencies will be found and loaded correctly.

The root cause of your crash is that on 6, probably, the system libraries changed so that they cannot be loaded from Java anymore.

Cheers,
Alex

al hozimi khalid

unread,
Jan 26, 2016, 2:46:38 PM1/26/16
to android-ndk


بتاريخ الاثنين، 9 نوفمبر، 2015 9:18:36 م UTC + 3، كتب أليكس كوهن:
لا، أنت لا تحتاج إلى تحميل يدويا المكتبات نظام - وهذا ينطبق على كافة إصدارات أندرويد. وفيما يتعلق gnusstl_shared والتبعيات الخاصة، تغيرت قواعد اللعبة في وقت متأخر نسبيا، حوالي 2 سنوات من "المحبر مجنون"  وقد تم إدخاله. ولكن على النظم الحديثة هناك لا تقلق: سيتم العثور على تبعيات وتحميلها بشكل صحيح.

السبب الجذري للحادث الخاص بك هو أنه في 6، على الأرجح، غيرت نظام المكتبات بحيث لا يمكن تحميلها من جاوة بعد الآن.

في صحتك،
اليكس في الخميس أكتوبر 22، 2015 في 07:58:29 UTC + 3، ikhah ... @ gmail.com كتب:

مرحبا كل شيء، حتى الروبوت 6، فإننا قد حملت مكتباتنا كما هو موضح هنا


System . loadLibrary ( "c" ); //libc.so
System . loadLibrary ( "m" ); //libm.so
System . loadLibrary ( "dl" ); //libdl.so
System . loadLibrary ( "gnustl_ shared" ); //libgnustl_shared.so
System . loadLibrary ( "ourA" ); //libourA.sس
...
النظام. فشل LoadLibrary ("ourZ")؛ //libourZ.so

هذا عمل جيد، ولكن بدءا من الروبوت 6 هذا يظهر: "dlopen فشل: لا يمكن تحديد موقع رمز" __cxa_finalize "المشار إليه من قبل" /system/lib/libdl.so "...." الخطأ
ثم قمنا بإزالة كافة المكتبات القياسية من تحميل ( LIBC، libm، libdl)، وهذه المرة الروبوت 6 بدأ غرامة (ولكن مع علة مختلفة)، في عقد الإيجار هو لم تظهر خطأ حول __cxa_finalize
نفس رمز اختبرنا في الروبوت 5، مرة أخرى أنها بدأت على ما يرام. هنا هو سؤالي. - هل نحن حقا تحتاج المكتبات نظام الحمل إذا نحن نعتمد عليها؟ وفقا لهذا الموضوع: https://groups.google.com/؟! منتدى / fromgroups # جي اس / الروبوت NDK / J3lzK4X - BM / 4YaijymZy_AJ




باختصار، رابط ديناميكي لا يعرف شيئا عن التطبيق الخاص بك (على سبيل المثال حيث يعيش مكتباتها)، فهو يعرف فقط حول قيمة LD_LIBRARY_PATH التي تم تعيينها عندما تم إنشاء هذه العملية.

نظام يمكن أن تجد المكتبات الخاصة، وهناك حاجة للقيام System.loadLibrary (...) للمكتبات القياسية. - في حال افتراضنا غير صحيح حول عدم تحميل مكتبات النظام، لماذا الروبوت 6 يبين لنا مثل هذا الخطأ؟ libdl هو نظام مكتبة، مكتبة النظام LIBC، وهم يعرفون يحتوي بعضها البعض، LIBC __cxa_finalize، لماذا الروبوت 6 يعطي هذا الخطأ؟ شكرا.






Reply all
Reply to author
Forward
0 new messages