简体   繁体   中英

cmake: cannot execute binary file: Exec format error

I have been working with a Raspberry Pi 3 with Raspbian to control a Dynamixel motor. I am using the Dynamixel SDK and workbench gits and followed their instruction to install and run their software with c++. I have made it through all the steps and even got my motor to run one of their test programs. For my next step I have tried to add my own cpp file (barely modified from one of the test files) and added my file as an executable to the CMakeList.txt following the same format as existed (I control+pasted and changed everything to my new file). I'm a beginner to cmake, so I've been just trying to take things one step at a time. I see how CMake is building the directories and make files and (ideally) my new executable.

However CMake has suddenly stopped working. I ran it successfully earlier, but now CMake gives me an error whenever I try and run it

"$ /home/pi/.local/bin/cmake: cannot execute binary file: Exec format error"

I have found information online explaining that this error typically comes from trying to compile a file built with a different binary, but have found nothing in particular to cmake. Some of my confusion is arising because cmake worked fine once, and I didn't change anything on the system itself, so I'm unsure why it is suddenly not working. I used "file cmake" and get this message.

"cmake: ELF 32-bit LSB executable, ARM, EABI5 version 1(GNU/Linux), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1], =9ba07348bbce6ec6feeb7443248d40392d423bbf, stripped"

I believe it means that the cmake version I have is of the appropriate type for Raspbian. What I think might also be of interest is that the cmake executable resides in this directory.

"/usr/bin" but I get the error message with directory "home/pi/.local/bin/cmake"

Things I have tried:

I have tried updating cmake. I have tried cleaning out the hash of the (what I believed was) wrong path name. I have purged cmake and tried reinstalling. My first install was with wget from cliutils.gitlab.io, and my fresh install was with sudo apt-get install cmake. The same error occurs for both.

I am working on a Raspberry Pi 4 (ARM64) Ubuntu 21.10 and installing cmake for aarch64 solved it in my case. You can get it with:

$ wget -qO- "https://cmake.org/files/v3.21/cmake-3.21.2-linux-aarch64.tar.gz" \
| tar --strip-components=1 -xz -C /usr/local

Note: You can find other versions on: https://cmake.org/files/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM