I am currently trying to link 3 prebuilt shared libraries to a native JNI shared library. The shared libraries were built on linux. When I link one of the libraries to native JNI i got an unsatisfactory link error, attached below.
Loading the library normally failed: java.lang.UnsatisfiedLinkError: dlopen failed: library "libc.so.6" not found.
the runtime dependency of my shared library (libdivsufsort) is shown below
Dynamic section at offset 0x9e00 contains 25 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x000000000000000e (SONAME) Library soname [libdivsufsort.so.3]
0x000000000000000c (INIT) 0x8b8
0x000000000000000d (FINI) 0x85c8
0x0000000000000019 (INIT_ARRAY) 0x209de8
0x000000000000001b (INIT_ARRAYSZ) 8 (bytes)
0x000000000000001a (FINI_ARRAY) 0x209df0
0x000000000000001c (FINI_ARRAYSZ) 8 (bytes)
0x000000006ffffef5 (GNU_HASH) 0x1f0
0x0000000000000005 (STRTAB) 0x510
0x0000000000000006 (SYMTAB) 0x258
0x000000000000000a (STRSZ) 375 (bytes)
0x000000000000000b (SYMENT) 24 (bytes)
0x0000000000000003 (PLTGOT) 0x20a000
0x0000000000000002 (PLTRELSZ) 216 (bytes)
0x0000000000000014 (PLTREL) RELA
0x0000000000000017 (JMPREL) 0x7e0
0x0000000000000007 (RELA) 0x708
0x0000000000000008 (RELASZ) 216 (bytes)
0x0000000000000009 (RELAENT) 24 (bytes)
0x000000006ffffffe (VERNEED) 0x6c8
0x000000006fffffff (VERNEEDNUM) 1
0x000000006ffffff0 (VERSYM) 0x688
0x000000006ffffff9 (RELACOUNT) 3
0x0000000000000000 (NULL) 0x0
Similar problems occur to my other libraries. The linkage works fine on linux cuz libc.so.6 is in library path.
It seems android does not support dynamic linking with versioned library, nor does it contain versioned libraries in system/lib. How can I resolve this issue?
Related
I am currently attempting to develop a cross-platform mobile app using Xamarin.forms. As a part of this application I need to include a 3rd party .framework in my Xamarin.iOS project. I have successfully created a Xamarin.iOS Bindings Library .dll and included it in my project. I am able to reference the library and compile without errors, however when I attempt to deploy the app to the iPhone simulator the app will start and then crash with a “Failed to install” message.
Error Message
If I remove any lines of code which reference this .dll the app will run fine.
Does anyone have any insight on how to solve this?
Potentially useful information:
I am developing in Visual Studio for Windows
Xamarin version: 16.7.000.440
Xamarin.iOS version: 13.20.2.2
XCode version: 12.0.1
iOS version: 14.0
Device Crash Log:
Incident Identifier: 882D82AB-5511-48C1-AFCD-4B86933B2A5C
CrashReporter Key: 1cc59f0bc819c0d806e2c1ccdf7b24a413699a4f
Hardware Model: iPad7,11
Process: MyApp.iOS [452]
Path: /private/var/containers/Bundle/Application/A31E102C-4BB8-431A-ABDF-E17A503E1778/MyApp.iOS.app/MyApp.iOS
Identifier: com.Crossroads.MyApp
Version: 1.0 (1.0)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.Crossroads.MyApp [614]
Date/Time: 2020-10-16 09:46:53.9542 -0500
Launch Time: 2020-10-16 09:46:53.9106 -0500
OS Version: iPhone OS 13.5.1 (17F80)
Release Type: User
Baseband Version: n/a
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Description: DYLD, dependent dylib '#rpath/MyFramework.framework/MyFramework' not found for '/private/var/containers/Bundle/Application/A31E102C-4BB8-431A-ABDF-E17A503E1778/MyApp.iOS.app/MyApp.iOS', tried but didn't find: '#rpath/MyFramework.framework/MyFramework' '/System/Library/Frameworks/MyFramework.framework/MyFramework'
Highlighted by Thread: 0
Backtrace not available
Unknown thread crashed with ARM Thread State (64-bit):
x0: 0x0000000000000006 x1: 0x0000000000000001 x2: 0x000000016b701390 x3: 0x00000000000000c7
x4: 0x000000016b700f90 x5: 0x0000000000000000 x6: 0x0000000000000000 x7: 0x0000000000000000
x8: 0x0000000000000020 x9: 0x0000000000000009 x10: 0x6f4d706163617461 x11: 0x656b6f54656c6962
x12: 0x6f77656d6172662e x13: 0x63617461442f6b72 x14: 0x656c69626f4d7061 x15: 0x0020276e656b6f54
x16: 0x0000000000000209 x17: 0x0000000000000000 x18: 0x0000000000000000 x19: 0x0000000000000000
x20: 0x000000016b700f90 x21: 0x00000000000000c7 x22: 0x000000016b701390 x23: 0x0000000000000001
x24: 0x0000000000000006 x25: 0x0000000106cd4000 x26: 0x0000000000000001 x27: 0x0000000106cd4000
x28: 0x0000000000000000 fp: 0x000000016b700f60 lr: 0x0000000106cbbee8
sp: 0x000000016b700f20 pc: 0x0000000106cb4f68 cpsr: 0x00000000
esr: 0x00000000 Address size fault
Binary images description not available
Error Formulating Crash Report:
Failed to create CSSymbolicatorRef - corpse still valid ¯\_(ツ)_/¯
EOF
From the apple document, the errors means you have linked the frame while does not ember it.
The app crashes at launch, because the dynamic linker can’t locate the
missing framework.
So what you need to do is ember the framework and here is the document you can refer:
Linking the dependencies
binding-objective-c
I have a problem figuring out why ASAN gives this output, why I can't see where and in what line the bug is in my code, is this bug even in my code as it says or is it in some libraries that is used by the program?
This is how I build my project :
CC=clang CXX=clang++ meson -Db_sanitize=address -Db_lundef=false
build-clang
and then I configure the env values and run the executable like this :
ASAN_OPTIONS=symbolize=1
ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer ./executable
And yes that is a valid path for llvm-sybolizer
So is there a way for me to know what does executable+0x431340 mean and where it points to in my code?
=================================================================
==13110==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 16384 byte(s) in 1 object(s) allocated from:
#0 0x4e1340 in __interceptor_malloc (/home/maysara/Desktop/testscreen/build-clang/src/excutable+0x4e1340)
#1 0x7ff16a2ccab8 in g_malloc (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x51ab8)
Direct leak of 4352 byte(s) in 17 object(s) allocated from:
#0 0x4e1340 in __interceptor_malloc (/home/maysara/Desktop/testscreen/build-clang/src/excutable+0x4e1340)
#1 0x7ff165e518ed (/usr/lib/x86_64-linux-gnu/libfontconfig.so.1+0x1d8ed)
Direct leak of 3840 byte(s) in 6 object(s) allocated from:
#0 0x4e17c0 in realloc (/home/maysara/Desktop/testscreen/build-clang/src/excutable+0x4e17c0)
#1 0x7ff165e51998 (/usr/lib/x86_64-linux-gnu/libfontconfig.so.1+0x1d998)
Direct leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x4e1340 in __interceptor_malloc (/home/maysara/Desktop/testscreen/build-clang/src/excutable+0x4e1340)
#1 0x7ff16a2ccab8 in g_malloc (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x51ab8)
#2 0x7ff168b5910c in g_closure_invoke (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x1010c)
Indirect leak of 10016 byte(s) in 313 object(s) allocated from:
#0 0x4e1340 in __interceptor_malloc (/home/maysara/Desktop/testscreen/build-clang/src/excutable+0x4e1340)
#1 0x7ff165e3ffef (/usr/lib/x86_64-linux-gnu/libfontconfig.so.1+0xbfef)
Indirect leak of 4887 byte(s) in 405 object(s) allocated from:
#0 0x43db60 in strdup (/home/maysara/Desktop/testscreen/build-clang/src/excutable+0x43db60)
#1 0x7ff165e512f4 in FcValueSave (/usr/lib/x86_64-linux-gnu/libfontconfig.so.1+0x1d2f4)
Indirect leak of 4320 byte(s) in 135 object(s) allocated from:
#0 0x4e1568 in calloc (/home/maysara/Desktop/testscreen/build-clang/src/excutable+0x4e1568)
#1 0x7ff165e51fd8 (/usr/lib/x86_64-linux-gnu/libfontconfig.so.1+0x1dfd8)
Indirect leak of 2400 byte(s) in 75 object(s) allocated from:
#0 0x4e1568 in calloc (/home/maysara/Desktop/testscreen/build-clang/src/excutable+0x4e1568)
#1 0x7ff165e515c4 (/usr/lib/x86_64-linux-gnu/libfontconfig.so.1+0x1d5c4)
Indirect leak of 576 byte(s) in 18 object(s) allocated from:
#0 0x4e1568 in calloc (/home/maysara/Desktop/testscreen/build-clang/src/excutable+0x4e1568)
#1 0x7ff165e51440 (/usr/lib/x86_64-linux-gnu/libfontconfig.so.1+0x1d440)
Indirect leak of 144 byte(s) in 3 object(s) allocated from:
#0 0x4e1340 in __interceptor_malloc (/home/maysara/Desktop/testscreen/build-clang/src/excutable+0x4e1340)
#1 0x7ff165e4bacd in FcLangSetCreate (/usr/lib/x86_64-linux-gnu/libfontconfig.so.1+0x17acd)
SUMMARY: AddressSanitizer: 46943 byte(s) leaked in 974 allocation(s).
In order to resolve the code addresses to source code locations, you need to compile the code with debug symbols enabled, e.g. with -g on the compiler command line or the commonly with build systems the environment variables CFLAGS and CXXFLAGS set accordingly:
CFLAGS="-g"
CXXFLAGS="-g"
That needs to be done for the code actually referenced, meaning here for example not only the code of executable, but also the linked libraries like glib, fontconfig, etc. if you want all addresses resolved.
Since these libraries are probably installed through a system package manager, you would need to look in your distribution's documentation how to install debug symbols. For Ubuntu, for example, there are usually variants of packages with an -dbg suffix.
In any case your stack traces do not look very helpful anyway, so it is not clear that finding the source code locations will be any help to you. You might want to recompile your executable with -fno-omit-frame-pointer and/or set the environment variable ASAN_OPTIONS=fast_unwind_on_malloc=0 when running the executable to try and improve them. See also the ASAN faq.
I'm trying to boot a custom kernel on a BeagleBoneBlack. u-boot works, and loads stuff as follows:
U-Boot 2016.03 (Apr 26 2016 - 11:32:30 +0000)
Watchdog enabled
I2C: ready
DRAM: 512 MiB
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
*** Warning - bad CRC, using default environment
Net: <ethaddr> not set. Validating first E-fuse MAC
cpsw, usb_ether
Press SPACE to abort autoboot in 2 seconds
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found /boot/extlinux/extlinux.conf
Retrieving file: /boot/extlinux/extlinux.conf
278 bytes read in 39 ms (6.8 KiB/s)
1: Linux grsec
Retrieving file: /boot/initramfs-grsec
5875398 bytes read in 349 ms (16.1 MiB/s)
Retrieving file: /boot/vmlinuz-4.4.8-grsec
3140944 bytes read in 211 ms (14.2 MiB/s)
append: BOOT_IMAGE=/boot/vmlinuz-4.4.8-grsec modules=loop,squashfs,sd-mod,usb-storage modloop=/boot/modloop-grsec console=ttyO0,115200n8
Retrieving file: /boot/dtbs/am335x-boneblack.dtb
31516 bytes read in 426 ms (71.3 KiB/s)
Kernel image # 0x82000000 [ 0x000000 - 0x2fed50 ]
## Flattened Device Tree blob at 88000000
Booting using the fdt blob at 0x88000000
Loading Ramdisk to 8fa65000, end 8ffff6c6 ... OK
Loading Device Tree to 8fa5a000, end 8fa64b1b ... OK
Starting kernel ...
Everything looks good so far, I think. But the kernel fails to load. I can't get access to anything from the kernel with low level debugging enabled in the kernel options either.
I've attached a J-Link JTAG debugger and was hoping to trace through to the problem, but I'm having trouble tying the System.map through to the disassembly.
Here for example is the start of the System.Map:
00000000 t __vectors_start
00000024 A cpu_ca8_suspend_size
00000024 A cpu_v7_suspend_size
0000002c A cpu_ca9mp_suspend_size
00001000 t __stubs_start
00001004 t vector_rst
00001020 t vector_irq
000010a0 t vector_dabt
00001120 t vector_pabt
000011a0 t vector_und
00001220 t vector_addrexcptn
00001240 t vector_fiq
00001240 T vector_fiq_offset
80204000 A swapper_pg_dir
80208000 T _text
80208000 T stext
8020808c t __create_page_tables
8020813c t __turn_mmu_on_loc
80208148 t __fixup_smp
802081b0 t __fixup_smp_on_up
802081d4 t __fixup_pv_table
80208228 t __vet_atags
80208280 T __idmap_text_start
80208280 T __turn_mmu_on
80208280 T _stext
So taking __create_page_tables, I grep in the source code under ./arch/arm/kernel with:
.../arm/arm/kernel$ grep __create_page_tables -rn
Binary file head.o matches
head.S:128: bl __create_page_tables
head.S:180:__create_page_tables:
head.S:355:ENDPROC(__create_page_tables)
So we're looking for the following at the symbol address:
__create_page_tables:
pgtbl r4, r8 # page table address
But the disassembler shows something different at the address I'm translating too give the Kernel is loaded at 0x82000000:
How can I translate the kernel symbols to the debugger addresses?
I am developing an Android app using NDK.
I have built OpenSSL as static libraries, libcrypto.a and libssl.a, which I linked with my custom C code.
When I try to load the library at runtime I get:
dlopen failed: cannot locate symbol "signal"...
Any idea how to fix this?
Thanks!
Update:
This comes from libcrypto:
libcrypto.a:
00000000 *UND* 00000000 signal
In my .so I see:
libtest.so:
NEEDED libc.so
...
00040240 <signal#plt>:
40240: e28fc601 add ip, pc, #1048576 ; 0x100000
40244: e28cca80 add ip, ip, #128, 20 ; 0x80000
40248: e5bcfd64 ldr pc, [ip, #3428]! ; 0xd64
So why is it complaining about "signal"?
I'm using a PowerBook Pro running Mac OSX 10.6.6 (Snow Leopard). I have been connecting to a client server using the built in VPN connector for months. Yesterday my connection wouldn't connect and was timing out. I checked with other remote developers and they had the same issue. The resolved it by killing the "racoon" process. I did the same and VPN connected.
I googled Racon to discover that it is an IPsec tool (http://ipsec-tools.sourceforge.net/)
This morning I had the same issue. I decided to first try to flush the info by using the racoonctl app to run:
sudo racoonctl flush-sa ipsec
That didn;t work, so I decided to just kill the process. Sadly, I do not have a racoon process running now. So I rebooted. Still not process. I rebooted again and ran fsck. Still nothing.
I looked in the logs and it seems that racoon is crashing every 10 seconds (see below).
Anybody have any ideas on what I need to do to get this back up and running? This has seemed to happen out of the blue and it is eating up my time seriously at this point.
System Error:
__TEXT [0x100000000 - 0x10008f000) __eh_frame [0x1000821e8 - 0x10008eff8) /usr/sbin/racoon
Mar 9 12:35:11 pmolaro com.apple.launchd[1] (com.apple.racoon[2458]): Job appears to have crashed: Segmentation fault
Mar 9 12:35:11 pmolaro com.apple.launchd[1] (com.apple.racoon): Throttling respawn: Will start in 10 seconds
Mar 9 12:35:11 pmolaro com.apple.ReportCrash.Root[2454]: 2011-03-09 12:35:11.638 ReportCrash[2454:301b] Saved crash report for racoon[2458] version ??? (???) to /Library/Logs/DiagnosticReports/racoon_2011-03-09-123511_localhost.crash
Crash Report:
Process: racoon [720]
Path: /usr/sbin/racoon
Identifier: racoon
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: launchd [1]
Date/Time: 2011-03-09 10:42:19.831 -0500
OS Version: Mac OS X 10.6.6 (10J567)
Report Version: 6
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: 0x000000000000000d, 0x0000000000000000
Crashed Thread: 0
Thread 0 Crashed:
0 dyld 0x00007fff5fc01723 dyld::setNewProgramVars(ProgramVars const&) + 64
1 dyld 0x00007fff5fc0d8d9 ImageLoaderMachO::setupLazyPointerHandler(ImageLoader::LinkContext const&) + 297
2 dyld 0x00007fff5fc18a19 ImageLoaderMachOCompressed::doBind(ImageLoader::LinkContext const&, bool) + 57
3 dyld 0x00007fff5fc0b5a2 ImageLoader::recursiveBind(ImageLoader::LinkContext const&, bool) + 122
4 dyld 0x00007fff5fc0c81b ImageLoader::link(ImageLoader::LinkContext const&, bool, bool, ImageLoader::RPathChain const&) + 171
5 dyld 0x00007fff5fc04d48 dyld::link(ImageLoader*, bool, ImageLoader::RPathChain const&) + 118
6 dyld 0x00007fff5fc068d6 dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**) + 2822
7 dyld 0x00007fff5fc016d2 dyldbootstrap::start(macho_header const*, int, char const**, long) + 799
8 dyld 0x00007fff5fc01052 _dyld_start + 42
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000001 rbx: 0x00000001000003c8 rcx: 0x0000000000000000 rdx: 0x0921b00000000100
rdi: 0x000000010008fac0 rsi: 0x00007fff5fc277c1 rbp: 0x00007fff5fbfdac0 rsp: 0x00007fff5fbfdac0
r8: 0x00007fff5fc444b0 r9: 0x0000000000000001 r10: 0x00007fff893d5d3f r11: 0x00007fff5fc0d6aa
r12: 0x00000001000002e0 r13: 0x0000000000000002 r14: 0x0000000100000000 r15: 0x00007fff5fc43be8
rip: 0x00007fff5fc01723 rfl: 0x0000000000010206 cr2: 0x000000010008f048
Binary Images:
0x100000000 - 0x10008eff7 +racoon ??? (???) /usr/sbin/racoon
0x1000a0000 - 0x1000a5fef libipsec.A.dylib 300.0.0 (compatibility 1.0.0) /usr/lib/libipsec.A.dylib
0x7fff5fc00000 - 0x7fff5fc3bdef dyld 132.1 (???) /usr/lib/dyld
0x7fff80008000 - 0x7fff8000dfff libpam.2.dylib 3.0.0 (compatibility 3.0.0) /usr/lib/libpam.2.dylib
0x7fff8125e000 - 0x7fff8141ffff libSystem.B.dylib 125.2.1 (compatibility 1.0.0) /usr/lib/libSystem.B.dylib
0x7fff81528000 - 0x7fff817aefff com.apple.security 6.1.1 (37594) /System/Library/Frameworks/Security.framework/Versions/A/Security
0x7fff817d8000 - 0x7fff81815fff com.apple.LDAPFramework 2.0 (120.1) /System/Library/Frameworks/LDAP.framework/Versions/A/LDAP
0x7fff81c85000 - 0x7fff81c89ff7 libmathCommon.A.dylib 315.0.0 (compatibility 1.0.0) /usr/lib/system/libmathCommon.A.dylib
0x7fff81fcf000 - 0x7fff81fefff7 com.apple.DirectoryService.Framework 3.6 (621.9) /System/Library/Frameworks/DirectoryService.framework/Versions/A/DirectoryService
0x7fff8259a000 - 0x7fff82617fef libstdc++.6.dylib 7.9.0 (compatibility 7.0.0) /usr/lib/libstdc++.6.dylib
0x7fff82618000 - 0x7fff827d6fff libicucore.A.dylib 40.0.0 (compatibility 1.0.0) /usr/lib/libicucore.A.dylib
0x7fff82831000 - 0x7fff82952fe7 libcrypto.0.9.8.dylib 0.9.8 (compatibility 0.9.8) /usr/lib/libcrypto.0.9.8.dylib
0x7fff829cf000 - 0x7fff82a85fff libobjc.A.dylib 227.0.0 (compatibility 1.0.0) /usr/lib/libobjc.A.dylib
0x7fff82cca000 - 0x7fff82cebfff libresolv.9.dylib 41.0.0 (compatibility 1.0.0) /usr/lib/libresolv.9.dylib
0x7fff84b80000 - 0x7fff84b91ff7 libz.1.dylib 1.2.3 (compatibility 1.0.0) /usr/lib/libz.1.dylib
0x7fff84c47000 - 0x7fff84c59fe7 libsasl2.2.dylib 3.15.0 (compatibility 3.0.0) /usr/lib/libsasl2.2.dylib
0x7fff85fb4000 - 0x7fff86000fff libauto.dylib ??? (???) /usr/lib/libauto.dylib
0x7fff862a8000 - 0x7fff862e2fff libssl.0.9.8.dylib 0.9.8 (compatibility 0.9.8) /usr/lib/libssl.0.9.8.dylib
0x7fff86ac2000 - 0x7fff86ac3ff7 com.apple.TrustEvaluationAgent 1.1 (1) /System/Library/PrivateFrameworks/TrustEvaluationAgent.framework/Versions/A/TrustEvaluationAgent
0x7fff8735e000 - 0x7fff87374fef libbsm.0.dylib ??? (???) /usr/lib/libbsm.0.dylib
0x7fff87375000 - 0x7fff8746dff7 libiconv.2.dylib 7.0.0 (compatibility 7.0.0) /usr/lib/libiconv.2.dylib
0x7fff87593000 - 0x7fff875d4fff com.apple.SystemConfiguration 1.10.5 (1.10.2) /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration
0x7fff87ae1000 - 0x7fff87c58fe7 com.apple.CoreFoundation 6.6.4 (550.42) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
0x7fff87e02000 - 0x7fff87ebbfff libsqlite3.dylib 9.6.0 (compatibility 9.0.0) /usr/lib/libsqlite3.dylib
0x7fff883a0000 - 0x7fff8844ffff edu.mit.Kerberos 6.5.10 (6.5.10) /System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos
0x7fffffe00000 - 0x7fffffe01fff libSystem.B.dylib ??? (???) /usr/lib/libSystem.B.dylib
I finally resolved my own issue. I used TimeMachine to replace the /usr/sbin/racoon and /usr/sbin/racoonctl files and rebooted my system. Now VPN works as expected. I am guessing that one of those files (probably racoon) was corrupted somehow.
On a side note, I did call Apple to get some help. I was willing to pay the support fee to get this issue resolved. After they read my information on this page I was informed that this issue was "beyond their technical training." I asked if I could speak to a higher level tech who would know something about the underpinnings of the OS and was told that wasn't an option. The tech finally recommended that I spend an hour and re-install my OS to fix the issue. Never once suggested TimeMachine either.
Moral of that story: Unless you need to know how to connect your printer or surf the web in an iPad, you probably don;t want to waste your time or money with Apple support. Sorry Apple, in this you have failed me! :(