Find the answer to your Linux question:
Results 1 to 8 of 8
Hi gurus I am trying to compile coreutils for studying purposes. I downloaded package (exact version which target system already contains) and tried following: Code: ./configure make but compiling ands ...
  1. #1
    Just Joined!
    Join Date
    Jul 2009
    Posts
    49

    [SOLVED] compiling coreutils

    Hi gurus
    I am trying to compile coreutils for studying purposes. I downloaded package (exact version which target system already contains) and tried following:

    Code:
    ./configure
    make
    but compiling ands with some header file dependency problem. Then I tried compile particular binary

    Code:
    cd src
    gcc id.c -o id
    also tried

    Code:
    export CFLAGS="-static -02 -g"
    ./configure
    cd src
    gcc -std=gnu99 -I../lib -static -O2 -g -MT uniq.o -MD -MP -MF .deps/uniq.Tpo -c -o uniq.o uniq.c
    But there was also missing header files problem.

    So I tried to find particular file on system and link to /usr/include location for example:
    Code:
    ln -s /usr/lib/syslinux/com32/include/syslinux/config.h /usr/include/config.h
    ln -s /usr/lib/syslinux/com32/include/com32.h /usr/include/com32.h
    ln -s /usr/lib/syslinux/com32/include/klibc/compiler.h /usr/include/klibc/compiler.h
    ln -s /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/plugin/include/system.h /usr/include/system.h
    ln -s /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/plugin/include/safe-ctype.h /usr/include/safe-ctype.h
    ln -s /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/plugin/include/hwint.h /usr/include/hwint.h
    ln -s /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/plugin/include/filenames.h /usr/include/filenames.h
    maybe further more header files I dont know - but the result is the same header file problem.
    I tried the metioned procedure on Archbang and Fedora (on both the coreutils was the same version whih is already installed and is working properly)

    Thanks a lot

  2. #2
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    955
    In Linux, libraries typically come in two parts: the library proper and the development package (headers and documentation). Programs will work on your system if the necessary libraries are installed but you can't compile them form source without the corresponding development packages. Typically if the library is called libfoo, the headers will be in libfoo-dev or libfoo-devel. Install them and then build your coreutils package.
    "I'm just a little old lady; don't try to dazzle me with jargon!"

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Quote Originally Posted by hazel View Post
    In Linux, libraries typically come in two parts: the library proper and the development package (headers and documentation). Programs will work on your system if the necessary libraries are installed but you can't compile them form source without the corresponding development packages. Typically if the library is called libfoo, the headers will be in libfoo-dev or libfoo-devel. Install them and then build your coreutils package.
    Hazel, you are a woman after my heart! Unfortunately, I already have a wife (with a PhD in particle physics)...
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. #4
    Just Joined!
    Join Date
    Jul 2009
    Posts
    49
    Thank you for reply

    Quote Originally Posted by hazel View Post
    Typically if the library is called libfoo, the headers will be in libfoo-dev or libfoo-devel. Install them and then build your coreutils package.
    So how to know libraries required for coreutils ? coreutils-devel or coreutils-dev did not exists, or am I using wrong repo ?

    Code:
    [cepido@localhost ~]$ sudo yum list coreutils
    Installed Packages
    coreutils.i686                        8.5-7.fc14                        @updates
    
    
    [cepido@archbang ~]$ pacman -Ss coreutils
    core/coreutils 8.10-1 [1.92 MB] (base) [installed]
        The basic file, shell and text manipulation utilities of the GNU operating
        system

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Interesting. The coreutils package on RHEL/Fedora seems to have two parts, but neither is the -devel version. One is coreutils, and the other (installed as dependency) is cureutils-libs. In any case, creating file linkages like you did isn't the way to go. Better to add the include directive "-I header-dir" to your Makefile. That way, all #include <foo.h> in your source will find foo in the normal directories, such as /usr/include, as well as in the one you specify. You can do this for more than one header directory as well.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  6. #6
    Just Joined!
    Join Date
    Jul 2009
    Posts
    49
    Triet this:

    Code:
    ARCHBANG
    [cepido@archbang ~]$ pacman -Q | grep coreutils
    coreutils 8.10-1
    [cepido@archbang ~]$ cd coreutils-8.10/src/
    [cepido@archbang src]$ gcc -std=gnu99 -I../lib -static -O2 -g -MT uniq.o -MD -MP -MF .deps/uniq.Tpo -c -o uniq.o uniq.c
    In file included from uniq.c:24:0:
    system.h:49:24: fatal error: configmake.h: No such file or directory
    compilation terminated.
    [cepido@archbang src]$ gcc uniq.c -o uniq
    uniq.c:19:20: fatal error: config.h: No such file or directory
    compilation terminated.
    
    
    FEDORA
    [cepido@localhost /]$ yum list installed | grep core
    coreutils.i686      8.5-7.fc14      @updates
    coreutils-libs.i686 8.5-7.fc14      @updates
    [cepido@localhost ~]$ cd coreutils-8.5/src/
    [cepido@localhost src]$ gcc -std=gnu99 -I../lib -static -O2 -g -MT uniq.o -MD -MP -MF .deps/uniq.Tpo -c -o uniq.o uniq.c
    uniq.c:19:20: fatal error: config.h: No such file or directory
    compilation terminated.
    [cepido@localhost src]$ gcc uniq.c -o uniq
    uniq.c:19:20: fatal error: config.h: No such file or directory
    compilation terminated.

  7. #7
    Just Joined!
    Join Date
    Jul 2009
    Posts
    49
    Hi people - sorry for long response
    I tried that:
    Code:
    [root@localhost coreutils-8.5]# tar -xvzf coreutils-8.5.tar.gz
    [root@localhost coreutils-8.5]# cd coreutils-8.5
    [root@localhost coreutils-8.5]# ./configure
    long output
    long output
    long output
    configure: WARNING: libgmp development library was not found or not usable.
    configure: WARNING: GNU coreutils will be built without GMP support.
    long output
    long output
    [root@localhost coreutils-8.5]# echo $0
    0
    [root@localhost coreutils-8.5]# make
    long utput
    long utput
    long utput
    make[4]: Entering directory `/root/coreutils-8.5/gnulib-tests'
    make[4]: Nothing to be done for `all-am'.
    make[4]: Leaving directory `/root/coreutils-8.5/gnulib-tests'
    make[3]: Leaving directory `/root/coreutils-8.5/gnulib-tests'
    make[2]: Leaving directory `/root/coreutils-8.5/gnulib-tests'
    make[2]: Entering directory `/root/coreutils-8.5'
    make[2]: Nothing to be done for `all-am'.
    make[2]: Leaving directory `/root/coreutils-8.5'
    make[1]: Leaving directory `/root/coreutils-8.5'
    [root@localhost coreutils-8.5]# echo $?
    0
    [root@localhost coreutils-8.5]# src/whoami
    root
    Seems make works. This package has been installed since last post.

    Code:
    [root@localhost src]# yum list installed coreutils-debuginfo
    Loaded plugins: auto-update-debuginfo
    Installed Packages
    coreutils-debuginfo.i686                                                    8.5-7.fc14                                                     @updates-debuginfo
    Also two questions
    - is it possible to compile only specific binary ? (id.c uniq.c cat.c etc) and not whole package ?
    - where to find another packages that I can compile from source ? for example passwd command ?

    I tried to search for passwd-0.78-1.fc14.i686 tar gz but no luck
    Last edited by wakatana; 03-13-2011 at 10:33 AM.

  8. #8
    Just Joined!
    Join Date
    Jul 2009
    Posts
    49
    Hi guys and sorry for very long reply and for weird questions
    My goal was to modify particular binary from package and compile only particular binary, because this is less time consuming than compile whole package.
    Now I am able to do it: ./configure && make && cd src && change something in binary.c and compile it via make binary_name.
    Thanks all for patience and sorry again for weird questions.

Posting Permissions

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