Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 21 May 2013, 13:04
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
What exactly does "configure --prefix ..." set in elf exec.?
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [10 Posts]  
Author Message
sunburnt


Joined: 08 Jun 2005
Posts: 4004
Location: Arizona, U.S.A.

PostPosted: Tue 06 Sep 2011, 17:11    Post subject:  What exactly does "configure --prefix ..." set in elf exec.?  

I`m wondering what "configure --prefix ..." does to displace the file tree.
There`s something it`s setting in how the exec looks for it`s other dep. files.
# Surely it doesn`t parse the C code and patch all the path references?
I don`t think there`s any reason to have coded paths for libs.

patchelf sets RPATH , which is only for execs and libs, not other deps.
readelf shows binary file header info. ( I think ) for execs and libs.
NOTE: I used readelf on many of Puppy`s execs. and they haven`t any RPATH.

What is it that "configure --prefix ..." sets to fix the exec`s path-to-otherFiles ?
# I`m wondering if it could be just patched in binary files like patchelf does.

I ran: readelf -a mah-jong
It didn`t show any sort of "prepath" that I could see. What`s being set?
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3012
Location: Oregon

PostPosted: Tue 06 Sep 2011, 17:30    Post subject:  

Where are you getting that "readelf"command from?
I have Puppy Lucid 520 and if I type either "which elf" or "which readelf" I come up empty.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 4004
Location: Arizona, U.S.A.

PostPosted: Tue 06 Sep 2011, 17:36    Post subject:  

I have Puppy511 and it`s in: /usr/bin

If it`s not there... Google is our friend !
Back to top
View user's profile Send private message 
muggins

Joined: 20 Jan 2006
Posts: 6660
Location: lisbon

PostPosted: Tue 06 Sep 2011, 18:44    Post subject:  

@Sunburnt,

I'm not sure exactly where, in the compiled elf, the path is set, but if you run configure --prefix=/usr/local && make && make install , turma will see /usr/local in the compiled binary. I use turma to then change all instances of /usr/local to /usr, then recompile.
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3012
Location: Oregon

PostPosted: Tue 06 Sep 2011, 19:46    Post subject:  

It is there after all. I must have mistyped the name.
I tried it on a very short game called "netgame" and it gave me more information on that elf binary that I could absorb in one sitting.
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 1758

PostPosted: Wed 07 Sep 2011, 02:44    Post subject:  

autoconf potentially changes many things -it's called AC_SUBSTITUTE. There is also the C PreProcessor 'cpp' which re-writes files on-the-fly. This is supposed to be more elegant than having source files full of ifdef's which control which/what code gets compiled..
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 4004
Location: Arizona, U.S.A.

PostPosted: Wed 07 Sep 2011, 03:25    Post subject:  

muggins; Turma is a text utility I believe, and elf execs. are coded in hex I think.

But turma will see the binary`s path set by: configure --prefix ( /path/to/install ).
Then you can alter the paths in the binary with turma? Or in the source file?
The purpose of this is to work with binary files only, so no compiling.
It sounds like what I`m looking for, but you need to clarify and detail it more.

I downloaded a .pup of it by GuestToo, but it`s so old it wants GTK-1.2


8-bit; Yeah, I could only recognize a little of the info it showed.


amigo; I assume --prefix and maybe other options set the ifdef`s you spoke of.
It sounds like if cpp can be controlled, it could rewrite the source file`s paths.
If cpp can be made to work, then any source app`s. paths could be patched.
Still have to compile, but it should work on all apps. A fix for the tough ones.


I got a reply on this from curaga at the Tiny Core Linux forum.
He says --prefix sets directives in the elf exec. that all hex.
And the programs have to be written to allow --prefix to work.
So not all of configure`s options work on all source apps...
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 10817
Location: The Peoples Republic of California

PostPosted: Fri 09 Sep 2011, 02:35    Post subject:  

Often I think it just tells where to install the files. Meaning irrespective of the locations, the files may be identical.

Of course there are file comparison utilities included with our Linux for use to verify if my theory above is correct.

~

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
muggins

Joined: 20 Jan 2006
Posts: 6660
Location: lisbon

PostPosted: Fri 09 Sep 2011, 05:27    Post subject:  

Sunburnt,

no, turma will only alter source files, not binaries. But I still find it useful for finding where a particular binary is expecting library, & other files, in order to run. I only metnioned it as, if you compile with the --prefix=/usr/local option, turma can read this in the binary.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 4004
Location: Arizona, U.S.A.

PostPosted: Fri 09 Sep 2011, 07:52    Post subject:  

Hi Bruce B; There is a difference as the exec finds ALL of it`s other files.

If a normal binary package is squashed ( or just put in some dir.) it won`t work.
But if you "configure --prefix /path/to/squashMNT ( or some dir.) it will work.
I assume it`s the main exec file that gets it`s prefix path changed.

THAT providing as I was told, IF the package was written to accept it.
He also said that he estimated that about half of all apps are written that way.
I would hope that far more coders would do this. But I have to believe him.

SO... Hopefully a better idea:
The preprocessor can rewrite the main exec file`s code and patch all the paths.
Which should work on ALL main exec files in all source packages. ( I hope...)

I just need to learn more about it`s capabilities and how to make it work.
NOTE:
I know a patchelf type utility could be written to "fix" paths in binary files!


### muggins; I thought edit source files... But it`s a hex viewer also.?

Apparently the prefix option sets a variable for all non-lib. file access.
Seems to make sense, that`s how I write my apps.

Cpp parses the main exec file and substitutes new paths. Very cool...
NOW... If turma can do that ( And I think it probably can...), that`d be great.!

So which is easier to learn and does the job the easiest too.?
The preprocessor runs when you compile the package, so simpler there...
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [10 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0534s ][ Queries: 11 (0.0067s) ][ GZIP on ]