Briefly: Is Linux kernel 2.6.32 compiled executable incompatible with a Linux Kernel 2.6.24 kernel?
I have a executable that I compiled in a system with linux 2.6.32 kernel. When I transfer the compiled file to a linux 2.6.24 system, I get the following error when executing:
bremm@bezier:/tmp/deployed$ ./qt-workstation
bash: ./qt-workstation: Arquivo ou diretório não encontrado
The text means “file or directory not found”, but the file exists. The output of strace:
execve("./qt-workstation", ["./qt-workstation"], [/* 46 vars */]) = -1 ENOENT (No such file or directory)
dup(2) = 3
fcntl(3, F_GETFL) = 0x8002 (flags O_RDWR|O_LARGEFILE)
fstat(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f78e84f5000
lseek(3, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
write(3, "strace: exec: No such file or di"..., 40strace: exec: No such file or directory
) = 40
close(3) = 0
munmap(0x7f78e84f5000, 4096) = 0
exit_group(1) = ?
I’m guessing this is related to dynamic linking. I believe I’ve seen errors like this from compiled executables that couldn’t find ld.so or ld-linux.so or similar.
For #!’d scripts, this can happen when the #!’d interpreter isn’t found – including when the script was transferred from windows and has a control-M at the end of the pathname.
Update
Running
strings ./qt-workstation | headI found out that my ld-linux.so was hardcoded to/lib/ld-linux-x86-64.so.2(the first output of the command), on the Ubuntu this file is located elsewhere.Creating a symbolic to
/lib/ld-linux-x86-64.so.2solves the problem.