LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-14-2011, 05:34 AM   #16
wakatana
Member
 
Registered: Jul 2009
Location: Slovakia
Posts: 141

Original Poster
Rep: Reputation: 16

Quote:
Originally Posted by knudfl View Post
When coreutils-<version>/lib/configmake.h and ///src/version.h are generated,
just then it is possible to compile a standalone object, like :
gcc -std=gnu99 -I../lib -static -O2 -g -MT uniq.o -MD -MP -MF .deps/uniq.Tpo -c -o uniq.o uniq.c

But you can of course do make in the top directory, then you have the two files :
configmake.h, version.h, which you can use in another coreutils-<version>, same version.
So when I want compile particular binary I always must use ./configure && make in top of directory right ?
I tried just run ./configure in top of directory and neither configmake.h, version.h and neither *.o objects were generated.
It is strange for me that I also must compile whole package and only then I can compile particular binary.




Quote:
Originally Posted by gnashley View Post
Yes you can compile individual bins from coreutils.
Jzs run configure, then cd into the various subdirs in the right order !-search the Makefile for the string 'subdir' to find the order.
Probably po m4 etc, the main ones are 'lib' which needs to be done before 'src'. Once lib and all other required ones are done, cd into src and run 'make stat(or whichever pro you want).
This is not always the case, but coreutils does have a separate Makefile rule for each binary.
What do you mean cd into various subdirs in the right order ? What is mp4 ?

Code:
[cepido@localhost coreutils-8.5]$ cat Makefile | grep subdir | head -3
subdir = .
# This directory's subdirectories are mostly independent; you can cd
        list='$(SUBDIRS)'; for subdir in $$list; do \
[cepido@localhost coreutils-8.5]$ cat Makefile | grep SUBDIR | head -3
DIST_SUBDIRS = $(SUBDIRS)
SUBDIRS = lib src doc man po tests gnulib-tests
        list='$(SUBDIRS)'; for subdir in $$list; do \
[cepido@localhost coreutils-8.5]$
You mean "lib src doc man po tests gnulib-tests" in this order ? so I tried


Code:
[cepido@localhost ~]$ cd coreutils-8.5
[cepido@localhost coreutils-8.5]$ ./configure
[cepido@localhost coreutils-8.5]$ cd lib/
[cepido@localhost lib]$ make
[cepido@localhost lib]$ cd ../src
[cepido@localhost src]$ make ls
  CC       ls.o
In file included from ls.c:85:0:
system.h:89:21: fatal error: version.h: No such file or directory
compilation terminated.
make: *** [ls.o] Error 1
[cepido@localhost src]$ find ../ | grep version.h
Seems version.h still missing



PS: what does mean $$list (double dolar sign in variable)
 
Old 03-14-2011, 06:01 AM   #17
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Quote:
Seems version.h still missing
Read post # 13 : ........... run 'make' in the top directory ...

Save version.h .
 
Old 03-14-2011, 05:39 PM   #18
wakatana
Member
 
Registered: Jul 2009
Location: Slovakia
Posts: 141

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by knudfl View Post
Read post # 13 : ........... run 'make' in the top directory ...

Save version.h .
Yes this works - but requires
./configure && make

This compiles whole pcakage. Then is possilbe to delete specific binary and recompile it via gcc source.c -o id binary
That first need to be comiled whole package and then can be compiled particular binary.
 
Old 03-15-2011, 03:00 AM   #19
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
I don't see what's the big deal about just compiling the whole thing normally, unless you want to properly patch the sources so that only what is needed and wanted gets compiled.
 
Old 03-15-2011, 10:14 AM   #20
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
The step 'configure' does not compile any source code. It merely readies the Makefile and possibly some header files to contain settings appropriate to your build environment. Having completed this step, you can look in the Makefile in the top level directory, and see what targets can be made from there. Some/many/all will result in recursive makes in lower level directories.

It seems to me that most of your questions could be answered by studying a bit about the make tool, especially its purpose and general behavior. Perhaps the online book 'Managing Projects with GNU Make and the GNU Make manual' would be a good place to start.

--- rod.
 
1 members found this post helpful.
Old 03-23-2011, 05:04 PM   #21
wakatana
Member
 
Registered: Jul 2009
Location: Slovakia
Posts: 141

Original Poster
Rep: Reputation: 16
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Should this become part of the coreutils? dpeterson3 General 7 05-26-2010 12:12 PM
Re-install coreutils 3rensho Linux - Software 8 03-14-2010 04:31 AM
5.16 Coreutils-6.12 jpeters Linux From Scratch 1 03-29-2009 03:23 PM
mv (coreutils) 5.2.1 - a bug? BiThian Linux - Desktop 1 09-15-2006 12:28 AM
coreutils-5.0 error rahul_jain_9684 Linux From Scratch 0 09-27-2003 12:51 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration