compiling coreutils


 
Thread Tools Search this Thread
Top Forums Programming compiling coreutils
# 1  
Old 03-07-2011
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  
Old 03-07-2011
If you tell us what it actually did, maybe we can actually help you. But my crystal ball is still in for maintenance so I can't tell you why those errors were happening, or what they even were. "some header file dependency problem" doesn't cut it. There might be reasons you're missing a specific header. I can't tell you why you might be missing any random header.

Please don't throw random symlinks into /usr/include. Take out the ones you put before you forget where they are. They'll come back to haunt you later.
# 3  
Old 03-08-2011
Quote:
Originally Posted by Corona688
If you tell us what it actually did, maybe we can actually help you. But my crystal ball is still in for maintenance so I can't tell you why those errors were happening, or what they even were. "some header file dependency problem" doesn't cut it. There might be reasons you're missing a specific header. I can't tell you why you might be missing any random header.

Please don't throw random symlinks into /usr/include. Take out the ones you put before you forget where they are. They'll come back to haunt you later.
Thank you for reply
symlinks from /usr/include is removed.



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.

# 4  
Old 03-08-2011
Are you sure that ./configure succeeded? config.h is one of the files that ought to be autogenerated by it. Run ./configure again and check closely if it bombs out.

Also, run 'make' from the base directory where you extracted that, not basedir/src. The base makefile might have exported something important.
# 5  
Old 03-10-2011
Quote:
Originally Posted by wakatana
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
would be nice if you paste the result of the configure script. Also check the exit status and try to locate the "missing header" using a simple find if you can find it.
# 6  
Old 03-13-2011
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 07:34 AM..
# 7  
Old 03-13-2011
Quote:
Originally Posted by wakatana
- is it possible to compile only specific binary ? (id.c uniq.c cat.c etc) and not whole package ?
id.c, cat.c, and uniq.c aren't binaries so you're barking up the wrong tree. You're also assuming all the source code for id resides in id.c and so forth, which isn't necessarily true, they may have other source files in common.

You might try 'cd src ; make id'


Quote:
- where to find another packages that I can compile from source ? for example passwd command ?
Just as the 'id' utility doesn't reside in id-0.78-1.fc14.i686.tar.gz, not every individual program has its own tiny individual package. I think passwd belongs to the shadow password tools.

Last edited by Corona688; 03-13-2011 at 03:00 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Programming

Error with compiling

Hi guys. I have a header file: unp.h like this: #ifndef _UNP_H_ #define _UNP_H_ extern ssize_t readn(int filedes, void *buff, size_t nbytes); extern ssize_t writen(int filedes, const void *buff, size_t nbytes); extern void err_quit(const char *msg); #define TRUE 1 #define FALSE 0 ... (2 Replies)
Discussion started by: majid.merkava
2 Replies

2. UNIX for Dummies Questions & Answers

Installing SU coreutils from BSD to unix AIX

Dear all Good day. Can any one advice me how to install the SU tool coreutils from BSD installed with linux on AIX unix ??? Thx in advance (0 Replies)
Discussion started by: islam.said
0 Replies

3. UNIX for Dummies Questions & Answers

doubt while compiling using cc

I was trying to compile a proc code. All steps when fine, except the last step which threw an error - I was just trying to compile it manually. Any ideas what this error means. Does it mean I am using the wrong library? (3 Replies)
Discussion started by: ranj@chn
3 Replies

4. UNIX for Advanced & Expert Users

re-compiling

I have a problem. How can I be sure that the binary currently in production is the binary originally produced by the compiler? I ask because recompiling the sources (ALL sources + stripping away the metadata: strip ...) does not give the same result. I am pretty sure that I wasn't hacked! ... (5 Replies)
Discussion started by: aViking
5 Replies

5. Programming

compiling

I am new to unix so please forgive ignorance. I am running openbsd-2.9 and need some help. All the software I run was added via the package system openbsd has. There have been times when I need an app. But it was not in the openbsd ports and or packages system. I usually just wait for it to show up... (1 Reply)
Discussion started by: Blunt_Killer
1 Replies

6. UNIX for Dummies Questions & Answers

compiling qt

i am trying to compile and install free qt for x11 2.2.4 in order to use kde 2.1. i'm using freebsd 4.3 i currently have XFree86 installed and working. i followed these instructions: ftp://ftp.trolltech.com/qt/source/INSTALL i get through the unpacking fine and i set my .profile. --... (2 Replies)
Discussion started by: nydel
2 Replies

7. UNIX for Dummies Questions & Answers

compiling

would anyone know of a good online tutorial on compiling and installing tarballs? i'm looking for one that assumes that you know very little to nothing about unix. (3 Replies)
Discussion started by: nydel
3 Replies

8. Programming

C compiling

I recently loaded SuSE on my intel comp. I am presently taking a walk down memory lane from my days at UofT. I was fiddling round with cc and the gcc compilers. I wrote a basic basic basic program . I tried to compile it as I remember doing in Uni. The problem is that it can't find the header... (5 Replies)
Discussion started by: cantcatchme
5 Replies
Login or Register to Ask a Question