当我运行我的应用程序时:
./a.out
bash: ./a.out: No such file or directory
和
bash ./a.out
./a.out: ./a.out: cannot execute binary file
我开始觉得这是一个架构问题。
文件架构:
file ./a.out
./a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=1ddfecde2ce3df37f6fe3b30f1abc853dc3a9f74, with debug_info, not stripped
虚拟机架构:
cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 158
model name : Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
stepping : 9
cpu MHz : 2904.004
cache size : 8192 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq monitor ssse3 cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase avx2 invpcid rdseed clflushopt md_clear flush_l1d
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit srbds
bogomips : 5808.00
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:
操作系统:
lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOSStream
Description: CentOS Stream release 8
Release: 8
Codename: n/a
和
uname -a
Linux localhost.localdomain 4.18.0-305.el8.x86_64 #1 SMP Tue May 18 14:52:12 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
您能验证一下这是架构不兼容吗?
如果是,如何解决这个问题?
答案1
对我来说有效的解决方案
sudo dnf upgrade --allowerasing --best
sudo yum -y install glibc.i686
sudo yum install libstdc++.i686