LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-01-2007, 03:54 PM   #1
simopal6
Member
 
Registered: Jun 2006
Location: Italy
Distribution: Slackware 13.1
Posts: 230

Rep: Reputation: 30
Is it safe to interrupt 'make' ?


Hello!
GNU make is able to resolve dependencies between files and to compile only the necessary ones; my question is: can i interrupt make with ctrl-c and restart it later?

I'll explain better with an example:
I download app-x.y.z.tar.gz, unzip and untar, run ./configure, run make. While make is still compiling, let's suppose i have to reboot my computer; so i press ctrl-c while it is compiling appunit.c, and make stops. Later, a run make again. It doesn't compile the files it has already compiled, and restarts from the point where id had been stopped. Could appunit.o (result of compilation of appunit.c) be damaged?

Hope i was clear..
Thanks to everyone!
 
Old 06-01-2007, 04:04 PM   #2
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
It should be fine. "Should be" means I'd ^C with confidence, but keep an eye out for gremlins on the next make. Wouldn't expect to see any, though.
 
Old 06-02-2007, 12:06 AM   #3
hradtke
Member
 
Registered: May 2006
Distribution: Fedora Core 6
Posts: 38

Rep: Reputation: 15
It really is not different from compiling, modifying a source file and compiling again. That being said, why not just ./configure; make; make install; again to be 100% safe?
 
Old 06-03-2007, 06:37 PM   #4
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
The original poster's question had to do with interrupting the make. If you're interrupting the make, you don't have to do the ./configure again later, because that's already run to completion. So just the make should be sufficient. His question was whether it would be safe, and my answer was Yes.

The frosting on the cake is that he won't recompile the modules that have already been completely compiled, thus saving time.
 
Old 06-03-2007, 06:39 PM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I don't know if it would be safe to simply continue. What if an object file was only partially written. You might want to run "make clean" and start over.
 
Old 06-04-2007, 08:14 AM   #6
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
Whether you want to make clean and start over depends on how much time you would save by just continuing.

Suppose you don't make clean, but just continue, and a .o file (compiled, unlinked object) was only partially written. In that case, you will have an invalid .o file, and the linking phase will catch it during the next make. Suppose, instead of some .o file, the linked executable was only partially written. In that case, you will catch it the first time you try to run the program. If you'd save a lot of time by not starting over, it would be just as good to rely on these other ways of catching the error.
 
Old 06-04-2007, 10:15 AM   #7
simopal6
Member
 
Registered: Jun 2006
Location: Italy
Distribution: Slackware 13.1
Posts: 230

Original Poster
Rep: Reputation: 30
Thanks guys for your advice. My fear is that the object/executable may be corrupt. I've got no idea whether what i'm going to say is correct: if i ctrl-c just while the compiler is writing the object file to disk, shouldn't the kernel wait for the completion of the i/o operation before closing the process?

However, i think i can risk getting a bad file if it's worth it, i.e. if it would be too long to restart from the beginning... I can always recompile..!
 
Old 06-06-2007, 09:40 AM   #8
hradtke
Member
 
Registered: May 2006
Distribution: Fedora Core 6
Posts: 38

Rep: Reputation: 15
Ctrl-c is an interrupt signal, not a kill -9. I would guess that when make receives the interrupt signal, make would finish something like writing the object/executable to disk before halting.
 
Old 06-07-2007, 05:07 AM   #9
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
make has no special knowledge of what pass a compiler is in, or whether it's in the middle of writing an object file and should be allowed to complete. But I still think the ^C thing isn't terribly dangerous, for the reasons I said before.
 
Old 06-08-2007, 08:54 AM   #10
dawkcid
Member
 
Registered: May 2007
Location: UK
Distribution: LFS,Slackware,Slamd64,NetBSD
Posts: 102

Rep: Reputation: 15
Of course it is, I interrupt make all the time. The compiler doesn't leave half written files lying around (unless perhaps you kill -9 it), any partial files will either be completed or deleted. Naturally, though, if you're using make for some other purpose (it isn't just for compiling programs), with a program that doesn't clean up after itself, YMMV, but as far as gcc is concerned, there is no problem.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
control is not going to interrupt handler when interrupt comes in serial driver sateeshalla Linux - Kernel 1 05-04-2006 09:43 AM
iPod mini: how do I make it safe to disconnect? signmeuptoo Linux - General 4 10-16-2005 01:03 AM
<0>Kernel panic: Aiee, killing interrupt handler! In interrupt handler - not syncing mrb Linux - Newbie 2 01-09-2005 09:47 AM
is malloc interrupt safe jwstric2 Programming 2 06-26-2004 10:59 PM
safe to run 'make bzlilo' for kernel upgrade? mikeylikesit! Linux - Software 9 10-13-2002 02:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:16 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