Results 1 to 2 of 2

Thread: how to compile the sorcecode of the offical ls.c source code ?

  1. #1
    Join Date
    Nov 2017
    Beans
    1

    how to compile the sorcecode of the offical ls.c source code ?

    Hey guys,
    this is the offical ls.c code :
    http://git.savannah.gnu.org/cgit/cor...plain/src/ls.c

    i downloaded it and i tried to compile this source code with gcc.
    The problem was that the gcc showed me a lot of errors.


    Code:
    $ gcc ls.c -o ls
    ls.c:38:20: fatal error: config.h:
    i did fix a lot of those errors by searching with the find command into my dictonarys

    Code:
    $ find /usr/src/ -name "nameofthelibary" 2> /dev/null
    for some libarys i found the correct path, so for example i could place them into the #include <config.h> => #include </usr/src/linuxheader.../config.h>
    as i mentioned this method worked for some libarys but not for the header for example #include "die.h"


    so my question is now: is there any way to compile this ls.c ? cz i want to learn how it works by modifying it

    sry for the bad english btw

  2. #2
    Join Date
    Aug 2011
    Location
    52.5° N 6.4° E
    Beans
    6,824
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: how to compile the sorcecode of the offical ls.c source code ?

    You can tell gcc in which directories to look for those header files (use the -I (capital i) option), but the default location for header files (/usr/include) is used automatically, so you don't have to add that. Whenever the source code says
    Code:
    #include <foo.h>
    gcc will search the include directories for foo.h. To make sure you have foo.h, the header file for libfoo, installed on your system, you have to install the development version of libfoo:
    Code:
    sudo apt install libfoo-dev
    Whenever the source code says
    Code:
    #include "bar.h"
    gcc will search for bar.h in the same directory as the source code.

Tags for this Thread

Bookmarks

Posting Permissions

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