Accessing a corrupted shared library
程序员文章站
2022-03-08 21:09:22
...
源:https://*.com/questions/30419857/accessing-a-corrupted-shared-library
评:
As you've sort of realized, you're trying to compile assembly for a 32 bit machine, on a 64 bit machine. With the commands you copied and pasted, you're letting as and ld know that you're compiling something 32 bit.
The issue you've run into is that you don't have a 32 bit version of libc available to link against.
apt-get install libc6:i386 libc6-dev-i386
Then assemble the code with:
as --32 -o cpuid2.o cpuid2.s
and finally link it with:
ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o cpuid2 -lc cpuid2.o
Then it should work:
[jkominek@kyatt /tmp]$ ./cpuid2
The processor Vendor ID is 'GenuineIntel'
评:
As you've sort of realized, you're trying to compile assembly for a 32 bit machine, on a 64 bit machine. With the commands you copied and pasted, you're letting as and ld know that you're compiling something 32 bit.
The issue you've run into is that you don't have a 32 bit version of libc available to link against.
apt-get install libc6:i386 libc6-dev-i386
Then assemble the code with:
as --32 -o cpuid2.o cpuid2.s
and finally link it with:
ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o cpuid2 -lc cpuid2.o
Then it should work:
[jkominek@kyatt /tmp]$ ./cpuid2
The processor Vendor ID is 'GenuineIntel'
推荐阅读
-
java.lang.NoClassDefFoundError和INSTALL_FAILED_MISSING_SHARED_LIBRARY
-
android 安装apk时出现INSTALL_FAILED_MISSING_SHARED_LIBRARY错误
-
[20190319]shared pool latch与library cache latch的简单探究.txt
-
解决 pynvml 报错 NVML Shared Library Not Found / WinError 126
-
Eclipse无法打开,提示“Failed to load the JNI shared library”
-
android 安装apk时出现INSTALL_FAILED_MISSING_SHARED_LIBRARY错误
-
Accessing a corrupted shared library
-
Accessing a corrupted shared library