Docker Community Forums

Share and learn in the Docker community.

Executing linaro gcc yields ENOENT but file content is fine


(Rejean Groleau) #1

Abstract: I am unable to execute a specific gcc version inside docker

Issue type
Bug? Not sure. I may just have misunderstood how basic stuff works inside docker.

OS Version/build
Ubuntu 16.04 LTS

App version

Client:
 Version:      1.11.2
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   b9f10c9
 Built:        Wed Jun  1 22:00:43 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.11.2
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   b9f10c9
 Built:        Wed Jun  1 22:00:43 2016
 OS/Arch:      linux/amd64

Steps to reproduce

sudo docker run -ti ubuntu:trusty
apt-get update
apt-get install wget xz-utils
wget https://launchpad.net/linaro-toolchain-binaries/trunk/2013.04/+download/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux.tar.xz
tar -xf gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux.tar.xz
cd gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux
cd arm-linux-gnueabihf
cd bin
./gcc -v

This results in:

bash: ./gcc: No such file or directory

So I tried cat ./gcc:

[binaryjunk...]
GCC: (GNU) 4.1.3 20080704 (prerelease) (Ubuntu 4.1.2-27ubuntu1)GCC: (Ubuntu 4.4.3-4ubuntu5.1)
[...binaryjunk]

And the content seems just fine. Let’s see the content of that folder using ls -alh:

total 13M
drwxr-xr-x 2 1001 1001  4.0K Apr 17  2013 .
drwxr-xr-x 7 1001 1001  4.0K Apr 17  2013 ..
-rwxr-xr-x 2 1001 1001  610K Apr 17  2013 ar
-rwxr-xr-x 2 1001 1001  1.1M Apr 17  2013 as
-rwxr-xr-x 2 1001 1001  470K Apr 17  2013 c++
-rwxr-xr-x 2 1001 1001  470K Apr 17  2013 g++
-rwxr-xr-x 1 1001 1001  467K Apr 17  2013 gcc
-rwxr-xr-x 1 1001 1001  470K Apr 17  2013 gfortran
-rwxr-xr-x 3 1001 1001 1018K Apr 17  2013 ld
-rwxr-xr-x 3 1001 1001 1018K Apr 17  2013 ld.bfd
-rwxr-xr-x 2 1001 1001  3.4M Apr 17  2013 ld.gold
-rwxr-xr-x 2 1001 1001  595K Apr 17  2013 nm
-rwxr-xr-x 2 1001 1001  731K Apr 17  2013 objcopy
-rwxr-xr-x 2 1001 1001  902K Apr 17  2013 objdump
-rwxr-xr-x 2 1001 1001  610K Apr 17  2013 ranlib
-rwxr-xr-x 2 1001 1001  731K Apr 17  2013 strip

Whatever I do, I seem to be unable to execute these files.
I tried using a volume, using --privileged=true, using --security-opt=seccomp=unconfined, but nothing seems to work.

Any idea or help would be appreciated, I am sure I just missed some basic simple thing here.

Thanks!


(David Maze) #2

This usually means one of a couple of things:

  • (Most likely) You’re missing some shared library. ldd ./gcc runs successfully but prints one or more shared libraries are not found. Install them (or, if they’re included in the tar file you downloaded, set LD_LIBRARY_PATH to point to their directory).
  • The binary isn’t actually an x86_64 binary. file would tell you, if you had it installed. In principle you can run an i386 32-bit x86 binary on an x86_64 64-bit x86 system, but you need to install the relevant 32-bit libraries.
  • (Least likely) The binary is actually a script, and you don’t have or can’t run the specific interpreter listed in the “shebang” line at the start of the file. (Given what you’ve done so far, you’d know if this is the case.)

(Rejean Groleau) #3

Thanks David for this fast reply, that was it:
ldd returned "not a dynamic executable"
and after searching a little while I found that I was missing “gcc-multilib”.