Symbol Look up error: undefined symbol: _ZNSt8messagesIwE2idE - linux

I have an application build using gcc 4.9.2. I have statically linked libstdc++ and libgcc for compatibility issues. The program runs fine in many linux distributions I tested. But in one system I find the following error
Symbol Look up error: undefined symbol: _ZNSt8messagesIwE2idE
I've run c++filt on the errror which gives the result
echo _ZNSt8messagesIwE2idE | c++filt
std::messages<wchar_t>::id
Running file command gives the following result
file app
app: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), for GNU/Linux 2.6.32, dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped
Running ldd gives,
ldd app
not a dynamic executable
But it is a dynamic executable. The same file runs on other similar machines.
uname gives
uname -a
Linux el-rhel5-1 2.6.18-164.el5PAE #1 SMP Tue Aug 18 15:59:11 EDT 2009 i686 i686 i386 GNU/Linux
why am I getting "not a dynamic executable" message even though it is executable?
What does this error mean and what are the ways to fix this?
Thanks.

why am I getting "not a dynamic executable" message even though it is executable?
ldd also gives that message if it doesn't recognise the file format, or some other error occurs.
Are you sure the file is exactly the same as on the other machines? You could use md5sum to verify it's the same on every machine and hasn't got corrupted on the machine where ldd can't read it and it gives the symbol lookup error.

Related

cannot execute binary file: Exec format error for a binary compiled in WSL environment

I have recently started working on WSL environment.
I have compiled one program in WSL environment which is of type "ELF 64-bit LSB shared object" but when I try to run it in the same environment, it throws an error "cannot execute binary file: Exec format error".
I am not sure about what I am missing here. How can I run the binary.
Kindly suggest.
kshitij#APL-5CD010D2WP:~/runtime/bin$ ioc_broker &
[1] 3579
kshitij#APL-5CD010D2WP:~/runtime/bin$ bash: /bin/ioc_broker: cannot execute binary file: Exec format error
^C
[1]+ Exit 126 ioc_broker
kshitij#APL-5CD010D2WP:~/runtime/bin$ file ioc_broker
ioc_broker: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=aa1e76d798d46d45f131cb53de8f947ddb4c8526, for GNU/Linux 3.2.0, not stripped
kshitij#APL-5CD010D2WP:~/runtime/bin$ uname -srv
Linux 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022
kshitij#APL-5CD010D2WP:~/runtime/bin$
kshitij#APL-5CD010D2WP:/mnt/d/src/myproject/build$ uname -a
Linux APL-5CD010D2WP 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
I have compiled the binary using cmake in which I have specified nothing specific about comiler being used.
kshitij#APL-5CD010D2WP:/mnt/d/src/myproject/build$ cmake -DCMAKE_INSTALL_PREFIX=/home/kshitij/runtime ..
-- The CXX compiler identification is GNU 9.4.0
-- Check for working CXX compiler: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Line: 57 Using COMMON_API_VERSION 3.1.12
uname -srv
Linux 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022
Try uname -a instead. It should identify the kernel as either i686 or x86_64.
I expect that your kernel says i686, in which case you've installed a 32-bit WSL2 and are trying to run a 64-bit binary on it. That doesn't work for obvious reason -- you need a 64-bit kernel to run 64-bit binaries.
Update:
I see x86_64
Ok, my guess was wrong. The other reason for Exec format error is that the file is corrupt in some way.
One possible source of corruption is if you run out of disk space and the file is truncated. Check df -h . output and if there is a lot of space, try rebuilding the binary again.
Also try eu-readelf -a ioc_broker -- eu-readelf is good at warning about corrupt ELF files.
Finally, look in /var/log/messages for any kernel warnings -- you may have a bad disk block or something else.

How do I run an extensionless (maybe ELF) file on Ubuntu?

I was given a "binary" file on linux and a seperate file for windows for a particular task. The programs is an exe on windows. A linux version of the file has the same function on linux as it had windows, too.
However, I've failed to be able to execute this. I tried (on the terminal) to execute it by just the file name, ./[filename], and even tried chmod +x [filename] and then tried the second way.
For everything... I get the result: "Command not found". (The file is definitely there, by the way).
What am I supposed to do? The file command on it yields:
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]=e805f746e65c09cc8b0c037d8a8c27ee0a6a051c
My guess is that this is 32 bit compile on a 64 bit system. I cross compiled a small c file into a binary using the -m32 option on gcc. This also needed a few extra packages. The resulting a.out looks like this.
% 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]=be02470c8337b96e7deaaff323bc53865991c3ab, not stripped
Compare this to a native system binary
% file /bin/ls
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=a0823e17cafbe5b2296346216445566840fdfd88, stripped
Running the a.out shows me this.
% ./a.out
zsh: no such file or directory: ./a.out
The specific "Command not found" message is something, I think, bash prints. I use zsh myself.
To get this to work, you can install the multilib packages. I didn't narrow it down to the exact package but installing gcc-multilib on Debian pulls in everything you need. After installing that, here's what I get.
% ./a.out
3.140523
(the program is supposed to estimate the value of PI).
Note: I actually needed to install gcc-multilib just to compile the file. I then uninstalled the packages to mimic a 64 bit system that doesn't have the 32 bit runtime libraries that the thing needs.
does the a.out have executable permission ?
check with ls -la cmd and if does no then add the permission using chmod a+x a.out an d then try executing

"No such file or directory" when running app on linux arm target

I have a development kit ( Altera Cyclon V, Cortex A9) and I'm trying to run a simple app on it.
I'm using cygwin for cross compiling my code for ARM Linux (using soureforge toolchain for Linux ).
Steps :
build within cygwin : arm-linux-gcc dd.c -s -mcpu=cortex-a9 -s -o ddb
copy ddb to target and chmod a+x
running it gives me "./ddb: No such file or directory" .
probably a mismatch between lib\tools but I'm new to Linux ( coming from QNX ).
Target is running :
root#socfpga:~/altera# cat /proc/version
Linux version 3.9.0 (jdasilva#sj-interactive3) (gcc version 4.7.3 20121106 (prerelease) (crosstool-NG linaro-1.13.1-4.7-2012.1
1-20121123 - Linaro GCC 2012.11) ) #1 SMP Fri Sep 27 22:55:43 PDT 2013
File data of my app :
ddb: ELF 32-bit LSB executable, ARM, version 1, dynamically linked (uses shared
libs), for GNU/Linux 2.6.33, stripped
File data of a sample hello_world that runs on target :
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (use
s shared libs), for GNU/Linux 2.6.31, BuildID[sha1]=0x2e8fbebd0bdab5897c0c65fb6b
563f3c34a16eb1, stripped
I can see that different DLL are being used ( 2.6.31 vs 2.6.33 ).
How can I solve this?
I've had that problem before when I tried to copy ARM binaries to an ARM android device.
You solved it, but either way, this is what I found out. The problem was the shared libraries. It is trying to load a library that doesn't exist on the target. The "file not found" error is very misleading.
Related question and answers:
"No such file or directory" but it exists
could be 64<>32bit problem.
See this

Cannot execute binary file error when running bibtex2html

I'm working on a project for a friend on a machine I'm not familiar with and I've run into some errors.
I'm running a program called bibtex2html, which is used to generate an HTML reference page. When I run the program, it gives me a "Cannot execute binary file" error.
From my preliminary research, it seems there are a number of causes to this problem, and I'm not really sure to begin.
What I've done so far:
uname -a ->
Linux baseline 2.6.38-15-generic-pae #60-Ubuntu SMP Tue May 22 11:48:17 UTC 2012 i686 i686 i386 GNU/Linux
file ~/bibtex2html/bibtex2html -> ~/bibtex2html/bibtex2html: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped
You did all the research correctly, now you just need to interpret it. It's a 64-bit executable (x86-64), and you're on a 32-bit kernel (i686). You'll need to find or compile a 32-bit version of bibtex2html.

Is this a problem with my distro or the application?

I hope someone can help me with this :)
I am running Arch Linux and am trying to get a game to work (Penumbra Overture). I have downloaded the executable, checked the md5 and they match, installed it in a directory. However when I try to execute the file an error appears saying:
bash: ./penumbra.bin: No such file or directory
It does exist, I am in the right folder and it is set as executable:
-rwxr-xr-x 1 kumagoro users 6814000 Apr 15 2010 penumbra.bin
file penumbra.bin says:
penumbra.bin: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, stripped
ldd penumbra.bin says:
not a dynamic executable
So, is this a problem with my distro or the application?
Thanks
You are missing the interpreter for the binary. Check with
readelf -a penumbra.bin | grep -i program.interp
what it wants.

Resources