Find the answer to your Linux question:
Results 1 to 6 of 6
Hello, I'm struggling to understand what's going on with compilation in a specific machine. When I compile this cutting edge software application: Code: #include <stdio.h> int main() { printf("hello world\n"); ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2013
    Posts
    12

    ldd: not a dynamic executable


    Hello,

    I'm struggling to understand what's going on with compilation in a specific machine. When I compile this cutting edge software application:

    Code:
    #include <stdio.h>
    
    int main()
    {
        printf("hello world\n");
        return 0;
    }
    with
    Code:
    gcc -o hello hello.c
    and execute

    Code:
    ldd ./hello
    I get "not a dynamic executable". Although

    Code:
    file ./hello
    hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
    and

    Code:
    ls -l hello
    -rwxrwxr-x 1 stefano stefano 6465 Oct 17 22:42 hello
    Also

    Code:
    gcc --version
    gcc (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4)
    Copyright (C) 2010 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    Code:
     uname -a
    Linux benny 2.6.32-279.el6.x86_64 #1 SMP Fri Jun 22 12:19:21 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
    Does anyone have any suggestion?

    Thanks

  2. #2
    Linux Enthusiast
    Join Date
    Jan 2005
    Location
    Saint Paul, MN
    Posts
    638
    I'm using gcc version 4.6.3 p1.13 and I get:
    Code:
    bash$ ldd ./hello
            linux-vdso.so.1 (0x00007fffa6d31000)
            libc.so.6 => /lib64/libc.so.6 (0x00007f9d83033000)
            /lib64/ld-linux-x86-64.so.2 (0x00007f9d833de000)
    bash$

  3. #3
    drl
    drl is offline
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Slackware, {Free, Open, Net}BSD, Solaris
    Posts
    1,286
    Hi.

    On a system similar to yours, I get much the same result as alf55:
    Code:
    OS, ker|rel, machine: Linux, 2.6.32-358.18.1.el6.centos.plus.x86_64, x86_64
    Distribution        : CentOS 6.4 (Final)
    gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
    with
    Code:
    $ ldd ./hello
    	linux-vdso.so.1 =>  (0x00007fffd8119000)
    	libc.so.6 => /lib64/libc.so.6 (0x0000003a2ac00000)
    	/lib64/ld-linux-x86-64.so.2 (0x0000003a2a400000)
    The message you cited could be elicited by mistakenly doing:
    Code:
    $ ldd ./hello.c
    ldd: warning: you do not have execution permission for `./hello.c'
    	not a dynamic executable
    Best wishes ... cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

  4. #4
    Just Joined!
    Join Date
    Sep 2013
    Posts
    12
    Thanks for your suggestions.

    drl, I tried again, just in case I was being hyper stupid, but that doesn't seem to be the case this time. Also, it happens with any compiler. I have tried with both gcc and icc.

    Code:
    [stefano@benny prova]$ gcc -o hello hello.c 
    [stefano@benny prova]$ ldd ./hello
    	not a dynamic executable
    [stefano@benny prova]$ icc -o hello hello.c
    [stefano@benny prova]$ ldd ./hello
    	not a dynamic executable
    Also, in both cases, the executable works
    Code:
    [stefano@benny prova]$ ./hello 
    hello world
    Very strange.

  5. #5
    Just Joined!
    Join Date
    Sep 2013
    Posts
    12
    Also, the same happens for every executable in the system.
    Code:
    [stefano@benny prova]$ ldd /bin/ls
    	not a dynamic executable
    Whilst, in another machine:
    Code:
    stefano@frankenstein:~$ ldd /bin/ls
    	linux-gate.so.1 =>  (0xb77af000)
    	libselinux.so.1 => /lib/i386-linux-gnu/libselinux.so.1 (0xb7778000)
    	librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb776f000)
    	libacl.so.1 => /lib/i386-linux-gnu/libacl.so.1 (0xb7765000)
    	libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb75bb000)
    	libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb75b6000)
    	/lib/ld-linux.so.2 (0xb77b0000)
    	libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb759b000)
    	libattr.so.1 => /lib/i386-linux-gnu/libattr.so.1 (0xb7595000)
    This is the ldd version
    Code:
    [stefano@benny prova]$ ldd --version
    ldd (GNU libc) 2.12
    Copyright (C) 2010 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    Written by Roland McGrath and Ulrich Drepper.

  6. #6
    Linux Enthusiast
    Join Date
    Jan 2005
    Location
    Saint Paul, MN
    Posts
    638
    maybe your system is build to only have static libraries installed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •