LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-16-2007, 12:47 PM   #1
narz
Member
 
Registered: May 2007
Location: US
Distribution: slackware
Posts: 186

Rep: Reputation: 37
How to patch and recompile program?


Hi,
brand new around these parts. am in need of a bit of help.

Im using Debian-Etch right now. a couple days ago i compiled the latest source version of VICE emulator for my computer.
one problem, apparently there was an update in libx11 and the screen of the emulator is always black beacause of it. i have located this patch that should fix it:
i left off the h at the beginning because i cannot post a link without having at least one post.
ttp://bugs.debian.org/cgi-bin/bugreport.cgi?bug=418295


But i do not know how to apply the patch the program, or how to recompile a program? not sure if theres a special command to do this. and i tried doing:

patch < xxx.securitypatch.xxx

within the source directory, but not sure if its doing anything?

can someone please help me to understand what im suppose to do?
 
Old 05-16-2007, 02:20 PM   #2
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware 14.1 (32 and 64 bit)
Posts: 1,587

Rep: Reputation: 121Reputation: 121
Do the same steps like when you compiled your program, but insert the patch at step 2: (1) Uncompress the tarball, (2) apply the patch, (3) and so on do configure make make install like you probably did the first time.

To apply the patch: Go into the folder (vice-1.20, right?) and issue "patch -p1 < /path/to/libx11-security-update.patch"
 
Old 05-16-2007, 02:28 PM   #3
narz
Member
 
Registered: May 2007
Location: US
Distribution: slackware
Posts: 186

Original Poster
Rep: Reputation: 37
Quote:
Originally Posted by titopoquito
Do the same steps like when you compiled your program, but insert the patch at step 2: (1) Uncompress the tarball, (2) apply the patch, (3) and so on do configure make make install like you probably did the first time.

To apply the patch: Go into the folder (vice-1.20, right?) and issue "patch -p1 < /path/to/libx11-security-update.patch"
oh ok cool.
will i have to uninstall my old program first before i compile it again?
i am still sort of unclear on the patch p0, p1, p2 thing? i tried reading about it, but its sorta foreign language to me right now.
to keep the record straight, apply patch then ./configure right?

thanks man, youve already been a big help.
 
Old 05-16-2007, 02:31 PM   #4
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware 14.1 (32 and 64 bit)
Posts: 1,587

Rep: Reputation: 121Reputation: 121
In general you won't need to uninstall it first, the files should get overwritten if you call ./configure (yes, after you applied the patch) with the same options.

About the p0, p1 ... maybe look this thread where I tried to explain it: http://www.linuxquestions.org/questi...d.php?t=553502
 
Old 05-16-2007, 02:44 PM   #5
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware 14.1 (32 and 64 bit)
Posts: 1,587

Rep: Reputation: 121Reputation: 121
Well, maybe I can explain it better. You have to look at where you are (the path to current folder) and the path that is stated in the patch file.

In your example: uncrompressing the app's tarball you will have a folder vice-1.20. So you might be in for example "/tmp/vice-1.20". Lets call that "current working directory". If you look in this patchfile you will see at the top at least two lines with a relative path, that means they don't start with a "/". Let's call that "where to patch directory".
Both will be simply appended if you use -p0 (with a Null). So the path would read "/tmp/vice-1.20/vice-1.20/src/arch/unix/x11/xaw/uicolor.c". You can see that the vice-1.20 seems to be double. And if you look around in the current working directory, where your app's source is, you will most probably see no folder "vice-1.20", but a folder "src". To tell the patch command that it shall omit the leading "vice-1.20/" (in this case even "vice-1.20.pigi4" that could never be found on your computer, because it's named false), you give it the -p1. If there were two or three ... leading folder names that you need to omit, you would increase the number.
For example if you were in /tmp/vice-1.20/src/arch/unix/x11/xaw -- deep in the source code tree -- you would call it with -p6, so that here only the file's name would be appended to the current working directory.

Hope that gives some insight what the numbers mean.
 
Old 05-16-2007, 02:55 PM   #6
narz
Member
 
Registered: May 2007
Location: US
Distribution: slackware
Posts: 186

Original Poster
Rep: Reputation: 37
oh ok, so its sorta like you want to copy to the hierarchy or top of the directory so it overwrites what you already have and doesnt give you more directories on top of the one you have. right? hahhaaha.....its ok, youve seemed to clarify this well enough for me.
cant wait to get home and try it.
thank you so much for your help on this one.
 
Old 05-16-2007, 02:58 PM   #7
narz
Member
 
Registered: May 2007
Location: US
Distribution: slackware
Posts: 186

Original Poster
Rep: Reputation: 37
wait...wait....hahahahaa.....

so if i have the source directory at
/home/me/vice-1.21

wouldnt i specify a p2?
 
Old 05-16-2007, 02:58 PM   #8
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware 14.1 (32 and 64 bit)
Posts: 1,587

Rep: Reputation: 121Reputation: 121
You're welcome
 
Old 05-16-2007, 03:00 PM   #9
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware 14.1 (32 and 64 bit)
Posts: 1,587

Rep: Reputation: 121Reputation: 121
Quote:
Originally Posted by narz
wait...wait....hahahahaa.....

so if i have the source directory at
/home/me/vice-1.21

wouldnt i specify a p2?
No, because both paths appended would read /home/me/vice-1.21/vice-1.20.pigi4/src/arch/unix/x11/xaw/uicolor.c
The red part is the only obsolete one, so one level too much. That means -p1 if you are in /home/me/vice-1.21 when you apply the patch.
 
Old 05-16-2007, 03:12 PM   #10
narz
Member
 
Registered: May 2007
Location: US
Distribution: slackware
Posts: 186

Original Poster
Rep: Reputation: 37
so pretty much....i should mostly stick with p1 when i want to append a patch generally to a program?
that way it sort of start keeps the program intact how it is and just includes the patch to where it needs to go?
sorry....i tend to overthink things a little.
thank you again for your patience and great help.

if im still not getting it i will sit and think about it for awhile....promise....lol.
 
Old 05-16-2007, 05:11 PM   #11
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware 14.1 (32 and 64 bit)
Posts: 1,587

Rep: Reputation: 121Reputation: 121
Hehe, it doesn't hurt to think
p1 is what I mostly have seen, but I think I had p0, too. I'm quite sure though that I never needed p2 and greater, but never say never ...
 
Old 05-16-2007, 09:36 PM   #12
narz
Member
 
Registered: May 2007
Location: US
Distribution: slackware
Posts: 186

Original Poster
Rep: Reputation: 37
many thanks to titopoquito.

installed patch as you described and am now running VICE-1.21.

thank you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Offline Installation of Program or Patch tobiasw Linux - General 1 10-19-2006 02:33 PM
Can I recompile the same program more than once? arielc Linux - Software 2 06-24-2006 08:42 PM
recompile ubuntu patch alaios Ubuntu 1 08-21-2005 02:21 AM
how to recompile a installed program(mplayer) erik Linux - Software 3 01-12-2005 01:09 PM
Kernel recompile with patch and custom driver Code_Zero Slackware 2 07-14-2004 10:04 PM


All times are GMT -5. The time now is 10:03 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration