Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emulator initialized with ARCH_ARM64 fails to load SOs #76

Open
nk521 opened this issue Aug 7, 2024 · 0 comments
Open

Emulator initialized with ARCH_ARM64 fails to load SOs #76

nk521 opened this issue Aug 7, 2024 · 0 comments

Comments

@nk521
Copy link

nk521 commented Aug 7, 2024

Initialized the Emulator like this -

emulator = Emulator(
    vfs_root=posixpath.join(posixpath.dirname(__file__), "..", "vfs"),
    vfp_inst_set=True,
    arch=androidemu.const.emu_const.ARCH_ARM64,
    config_path=posixpath.join(posixpath.dirname(__file__), "..", "_emu.cfg")
)

lib_module = emulator.load_library("../extracted_libs/libsome.so")

Getting this error -

Traceback (most recent call last):
  File "/some/path/ExAndroidNativeEmu/proxy.py", line 91, in <module>
    lib_module = emulator.load_library("../extracted_libs/libsome.so")
  File "/some/path/ExAndroidNativeEmu/androidemu/emulator.py", line 248, in load_library
    libmod = self.modules.load_module(filename, True)
  File "/some/path/ExAndroidNativeEmu/androidemu/internal/modules.py", line 342, in load_module
    libmod = self.load_module(path)
  File "/some/path/ExAndroidNativeEmu/androidemu/internal/modules.py", line 342, in load_module
    libmod = self.load_module(path)
  File "/some/path/ExAndroidNativeEmu/androidemu/internal/modules.py", line 342, in load_module
    libmod = self.load_module(path)
  [Previous line repeated 1 more time]
  File "/some/path/ExAndroidNativeEmu/androidemu/internal/modules.py", line 334, in load_module
    so_needed = reader.get_so_need()
  File "/some/path/ExAndroidNativeEmu/androidemu/internal/elf_reader.py", line 513, in get_so_need
    return self.__so_needed

AttributeError: 'ELFReader' object has no attribute '_ELFReader__so_needed'. Did you mean: '_ELFReader__dyn_addr'?

LDD of the library -

        linux-vdso.so.1 => [vdso] (0x76d06bf000)
        liblog.so => /system/lib64/liblog.so (0x76cf2d0000)
        libc.so => /apex/com.android.runtime/lib64/bionic/libc.so (0x76cc00f000)
        libm.so => /apex/com.android.runtime/lib64/bionic/libm.so (0x76cf301000)
        libdl.so => /apex/com.android.runtime/lib64/bionic/libdl.so (0x76cf29c000)
        libc++.so => /system/lib64/libc++.so (0x76cbf53000)

I've all the libs needed in vfs/system/lib64 but it still fails. I did some digging and found that while fetching all the required library dependencies, it fails when __so_needed is never initialized when the library has no dependency. In this case, the dependency chart is somewhat like libsome.so -> liblog.so -> libc++.so -> libc.so -> ld-android.so, at the stage of parsing ld-android.so this error occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant