Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[HOWTO] how I use to prelink (nvidia included) [x86] [~x86]
View unanswered posts
View posts from last 24 hours

Goto page 1, 2, 3, 4, 5, 6  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
hds
Advocate
Advocate


Joined: 21 Aug 2004
Posts: 2629
Location: Sprockhoevel [GER]

PostPosted: Mon Feb 07, 2005 6:06 pm    Post subject: [HOWTO] how I use to prelink (nvidia included) [x86] [~x86] Reply with quote

hi folx,
well, IMHO the prelinking guide(s) are all outdated, and not takeing care about those of us owning an nvidia graphicscard (using nvidia native drivers, of course), here's my way:

a) enable "pic" to your USEflags. this has not to be mistaken (like it is told in the prelink howto) with the CFLAG "-fPIC" - IMHO this is false in the howto. what is actually meant is "./configure --with-pic"!!

b) "emerge -uDv --newuse world"
this might take a while, because if "pic" hasnt been in before, glibc hasto be recompiled.

c) now, to make prelink happy with the nvidia drivers, run: "opengl-update xorg-x11" so the libgl.so symlinks will be fixed. do NOT!!! do an environment update!!

d) prelink -avmfR

e) the last line after this finished should be:
Executing /sbin/init U
if this is NOT the case, not everything has been prelinked. recheck above steps. did you really really re-emerge with the "--newuse" flag? did you compile stuff locally, and forgot to add "--with-pic" in your ./configure?

f) now run "opengl-update nvidia" to get your libgl.so back (the nvidia one).

edit /etc/env.d/99kde-env like this:
#KDE_IS_PRELINKED=1
KDE_IS_PRELINKED=1

now (just in case) run
env-update
source /etc/profile

should be it. reboot and see.
btw.. leaving out he nvidia part this should actually work for anyone. i have checked this on my wifes system (old voodo3 in there) and it worked. she is running kernel 2.6.x, me 2.4.x

have fun, enjoy, and feel free to add your coments and perhaps additional hints and tips.


Last edited by hds on Sat Feb 26, 2005 8:42 pm; edited 1 time in total
Back to top
View user's profile Send private message
rohan28
Tux's lil' helper
Tux's lil' helper


Joined: 12 Dec 2004
Posts: 84
Location: Australia

PostPosted: Tue Feb 08, 2005 1:50 am    Post subject: Reply with quote

With regards to a), you are right, and it is in fact quite a bad idea to put -fPIC in your CFLAGS; if you do this, both libraries and executables will be compiled with Position Independent Code. Generally you want shared libraries to be PIC, but not executables themselves, as this will decrease performance in the same kind of way as not using -fomit-frame-pointer (but several times worse).

Just thought I would make that comment. A nice and simple HOWTO :-)
Back to top
View user's profile Send private message
bakreule
Apprentice
Apprentice


Joined: 27 Aug 2003
Posts: 233
Location: Paris, France

PostPosted: Tue Feb 08, 2005 11:12 pm    Post subject: Reply with quote

No wonder my system seemed slower the last time I tried to prelink everything. Either I was stupid and didn't see the part about the "pic" USE flag in the docs or it wasn't there...

Thanks for the guide!
_________________
Buses stop at a bus station.
Trains stop at a train station.
On my desk there's a workstation.....
Back to top
View user's profile Send private message
radfoj
Guru
Guru


Joined: 31 Dec 2004
Posts: 490
Location: Tísek, Czech Republic

PostPosted: Wed Feb 09, 2005 10:59 pm    Post subject: Reply with quote

Hi,
about month ago, I tried to prelink my new gentoo box. I followed the prelink guide, with USE-flag "pic" in my make.conf. No benchmark were done, but I wasnt feeling any speedups. I decided to try once more after some time. Today I found this howto, so I tried again, also with your trick "opengl-update".

The output of typing "prelink -avmfR" also contains: :oops:
Code:
prelink: /usr/bin/gvidcap: Cannot prelink against non-PIC shared library /usr/lib/libavformat.so
prelink: /usr/bin/mplex: Cannot prelink against non-PIC shared library /usr/lib/libmplex2-1.6.so.0
prelink: /usr/bin/mpeg2enc: Cannot prelink against non-PIC shared library /usr/lib/libmpeg2encpp-1.6.so.0
prelink: /usr/bin/ffserver: Cannot prelink against non-PIC shared library /usr/lib/libavformat.so
prelink: /usr/bin/xvidcap: Cannot prelink against non-PIC shared library /usr/lib/libavformat.so
prelink: /usr/bin/ffmpeg: Cannot prelink against non-PIC shared library /usr/lib/libavformat.so

and more warnings like that: :oops:
Code:
prelink: Warning: /usr/lib/libavformat.so has undefined non-weak symbols
prelink: Warning: /usr/lib/libaviplayavformat-0.7.so.0 has undefined non-weak symbols
prelink: Warning: /usr/lib/libaviplayavcodec-0.7.so.0 has undefined non-weak symbols
prelink: Warning: /usr/lib/libFLAC.so.4 has undefined non-weak symbols
prelink: Warning: /usr/lib/libgthread-1.2.so.0 has undefined non-weak symbols
prelink: Warning: /usr/lib/libgif.so.4 has undefined non-weak symbols
prelink: Warning: /usr/kde/3.3/lib/libkscreensaver.so.4 has undefined non-weak symbols
prelink: Warning: /usr/lib/libcupsimage.so.2 has undefined non-weak symbols
prelink: Warning: /usr/lib/libsablot.so.0 has undefined non-weak symbols
prelink: Warning: /usr/lib/libXfont.so.1 has undefined non-weak symbols
prelink: Warning: /usr/lib/libgmodule-1.2.so.0 has undefined non-weak symbols
prelink: Warning: /usr/lib/libgdk_imlib.so.1 has undefined non-weak symbols
prelink: Warning: /usr/lib/libgtk-1.2.so.0 has undefined non-weak symbols


But after reboot applications are REALLY starting much faster. Although I am not sure about the messagess above, my first impressions are saying - IT WORKS. :D

OK, my system seems to be prelinked now. But after next emerging/unmerging, its important to care about it. So it would be nice, if somebody could post here how are you doing it.
Add it to crontab (what exactly) or add to some emerge script (how exactly) :oops: :?: Or have you another idea?

Some tips for /etc/env.d/60prelink or /etc/prelink.conf would be also nice. Thanks, really, very much.
Back to top
View user's profile Send private message
MaxDamage
l33t
l33t


Joined: 03 Jan 2004
Posts: 650
Location: Oviedo, Spain

PostPosted: Wed Feb 09, 2005 11:23 pm    Post subject: Reply with quote

Are you sure about prelinking with the x11 libraries, then using nvidia ones again? Will the 3D apps use nvidia or x11, then?
_________________
La PDA de tungsteno
Back to top
View user's profile Send private message
hds
Advocate
Advocate


Joined: 21 Aug 2004
Posts: 2629
Location: Sprockhoevel [GER]

PostPosted: Wed Feb 09, 2005 11:35 pm    Post subject: Reply with quote

radfoj wrote:

[code]prelink: /usr/bin/gvidcap: Cannot prelink against non-PIC shared library /usr/lib/libavformat.so
prelink: /usr/bin/mplex: Cannot prelink against non-PIC shared library /usr/lib/libmplex2-1.6.so.0
[...]

are you sure they have been compiled with "pic"? i guess you added the pic flag later, and those have been compiled prior to this?
try emerge -upDv --newuse world
and see if those apps would get re-emerged

warnings are OK, imho. i have had some of those as well.
is the last outputted line:
Executing /sbin/init U
?
Back to top
View user's profile Send private message
R!tman
Veteran
Veteran


Joined: 18 Dec 2003
Posts: 1303
Location: Zurich, Switzerland

PostPosted: Wed Feb 09, 2005 11:36 pm    Post subject: Reply with quote

What does the "pic" USE Flag do exactely?

[edit]
Only just in case, the "Build Position Independent Code. Needed for prelink or the hardened toolchain" is not very helpful in understanding what pic does.
It's from http://www.gentoo.org/dyn/use-index.xml
[/edit]
Back to top
View user's profile Send private message
hds
Advocate
Advocate


Joined: 21 Aug 2004
Posts: 2629
Location: Sprockhoevel [GER]

PostPosted: Wed Feb 09, 2005 11:44 pm    Post subject: Reply with quote

its used for the ./configure stuff prior to make. its like if you would add "--with-pic" to ./configure if you compile manually.
Back to top
View user's profile Send private message
radfoj
Guru
Guru


Joined: 31 Dec 2004
Posts: 490
Location: Tísek, Czech Republic

PostPosted: Wed Feb 09, 2005 11:47 pm    Post subject: Reply with quote

hds wrote:
are you sure they have been compiled with "pic"? i guess you added the pic flag later, and those have been compiled prior to this?

I am sure, I add "pic" month ago .......... and "emerge -avuD --newuse world" I typed since then few times. :D :D
And yes, it ends with "Executing /sbin/init U"
Back to top
View user's profile Send private message
hds
Advocate
Advocate


Joined: 21 Aug 2004
Posts: 2629
Location: Sprockhoevel [GER]

PostPosted: Wed Feb 09, 2005 11:52 pm    Post subject: Reply with quote

radfoj wrote:

And yes, it ends with "Executing /sbin/init U"

so at least the prelinking stuff gots to its end.
well, i really dont recall which packages had warnings and/or were unable to get prelinked.. there are a few, i know.
however, i wouldnt worry. the main advantage is in speeding up KDE anyway (IMHO).
also please note, there are a lot of ebuilds that do not honor the "pic" useflag at all, so also this might be a problem. i really dont know. i only do know it never got to "init U" using the prelink guide - so it actually never worked before at my system.
Back to top
View user's profile Send private message
radfoj
Guru
Guru


Joined: 31 Dec 2004
Posts: 490
Location: Tísek, Czech Republic

PostPosted: Thu Feb 10, 2005 12:15 am    Post subject: Reply with quote

hds wrote:
radfoj wrote:

And yes, it ends with "Executing /sbin/init U"

so at least the prelinking stuff gots to its end.
well, i really dont recall which packages had warnings and/or were unable to get prelinked.. there are a few, i know.
however, i wouldnt worry. the main advantage is in speeding up KDE anyway (IMHO).

Yes, I agree with you ... and not only KDE apps are starting faster.
I am worring now about one - "keeping this state for ages".
I found some opinions here on forum, then for this we must prelink after updating. Somebody says, that the best to do it after every emerge. So maybe with cron or some script. But I dont know, how exactly. With -avmfR again and again- its waste of time, especially, when I love updating. :P Maybe anybody tell this secret. :P
BTW in mandrake, there was a script in /etc/cron.daily/prelink ..... but so hard for me.
Back to top
View user's profile Send private message
hds
Advocate
Advocate


Joined: 21 Aug 2004
Posts: 2629
Location: Sprockhoevel [GER]

PostPosted: Thu Feb 10, 2005 12:22 am    Post subject: Reply with quote

no, you dont need -avmfR again. see "man prelink":
Code:

       -q --quick
              Run  prelink  in  quick  mode.  This mode checks just mtime and ctime timestamps of libraries and binaries stored in the cache
              file.  If they are unchanged from the last prelink run, it is assumed that the library in question did not change and no pars-
              ing of its ELF headers and verifying it is done.

so, -qavmR should do it [untested] ;)

btw.. i wouldnt put this in cron. i do not emerge anything unattended anyway.
Back to top
View user's profile Send private message
radfoj
Guru
Guru


Joined: 31 Dec 2004
Posts: 490
Location: Tísek, Czech Republic

PostPosted: Thu Feb 10, 2005 12:46 am    Post subject: Reply with quote

hds wrote:

so, -qavmR should do it [untested] ;)

Not exactly:
Code:
radfoj radfoj # prelink -qvmfR
prelink: no files given and --all not used

I will test it later, its time to go to bed.
But I think that without -f - "prelink -qavmR"

Thanks hds anyway ... time will show me. :lol:
Back to top
View user's profile Send private message
R!tman
Veteran
Veteran


Joined: 18 Dec 2003
Posts: 1303
Location: Zurich, Switzerland

PostPosted: Thu Feb 10, 2005 1:10 am    Post subject: Reply with quote

hds wrote:
its used for the ./configure stuff prior to make. its like if you would add "--with-pic" to ./configure if you compile manually.


Ok, thanks. But I think you explained the idea of USE Flags in general, not that specific one.

What difference to a package does this "pic" cause to a package, so that it is prelinkable from now on?
Back to top
View user's profile Send private message
rhill
Developer
Developer


Joined: 22 Oct 2004
Posts: 1629
Location: sk.ca

PostPosted: Thu Feb 10, 2005 6:59 am    Post subject: Reply with quote

http://www.gentoo.org/proj/en/hardened/pic-internals.xml
http://en.wikipedia.org/wiki/Position_independent_code
_________________
by design, by neglect
for a fact or just for effect
Back to top
View user's profile Send private message
hds
Advocate
Advocate


Joined: 21 Aug 2004
Posts: 2629
Location: Sprockhoevel [GER]

PostPosted: Thu Feb 10, 2005 11:00 am    Post subject: Reply with quote

i just had a deeper look into this, why some packages dont prelink. i unpacked ffmpeg manually, and did a "./configure --help". there is no such option like "--with-pic" in that package, so that explains it all.
nothing we can do about this for now.. except perhaps asking the ffmpeg autor if he could add this option to his source.
Back to top
View user's profile Send private message
radfoj
Guru
Guru


Joined: 31 Dec 2004
Posts: 490
Location: Tísek, Czech Republic

PostPosted: Thu Feb 10, 2005 11:23 am    Post subject: Reply with quote

hds wrote:
i just had a deeper look into this, why some packages dont prelink. i unpacked ffmpeg manually, and did a "./configure --help". there is no such option like "--with-pic" in that package, so that explains it all.
nothing we can do about this for now.. except perhaps asking the ffmpeg autor if he could add this option to his source.


OK. One little question: how many packages have you compiled with "pic".
I am not sure, wheather this is a right way, how count it, but in make.conf I changet "pic" to "-pic" and typed "emerge -avuD --newuse world" ..... It offer me only 4 packages to rebuild:
Code:
Calculating world dependencies ...done!
[ebuild   R   ] sys-libs/glibc-2.3.4.20040808-r1  -build -debug -erandom -hardened (-multilib) +nls-nptl -pic* -userlocales 0 kB
[ebuild   R   ] app-arch/gzip-1.3.5-r5  -build -debug +nls -pic* -static 0 kB
[ebuild   R   ] media-libs/xine-lib-1_rc8-r1  +X -aalib +alsa (-altivec) +arts +avi -debug -directfb +dvd -esd -gnome +ipv6 +nls +oggvorbis -pic* +sdl -speex +theora 0 kB
[ebuild   R   ] media-video/avidemux-2.0.36  -a52 +aac +alsa (-altivec) +arts -debug +encode +mad +mmx +nls +oggvorbis -pic* +sdl +truetype +xv +xvid 0 kB


Have I something broken? Or dont I understand it well?
Back to top
View user's profile Send private message
hds
Advocate
Advocate


Joined: 21 Aug 2004
Posts: 2629
Location: Sprockhoevel [GER]

PostPosted: Thu Feb 10, 2005 12:07 pm    Post subject: Reply with quote

yes, just a few, but all KDE ebuilds should be listed. as i already mentioned, "pic" is just used by a few ebuilds.

//edit: hmm, KDE ebuilds arent listed here either 8O
well, i really dont know. it just works :lol:
btw.. infact of KDE i think thats where the ENV variable comes in, because pic support might be already included internally?
anyway, i am not a gcc or c++ expert freak. you should better ask in one of those forums to learn more.
dont get me wrong - but it would be nice if we could concentrate on improveing the howto ;)
Back to top
View user's profile Send private message
Dais
l33t
l33t


Joined: 05 Aug 2004
Posts: 977
Location: Québec

PostPosted: Thu Feb 10, 2005 2:03 pm    Post subject: Reply with quote

MaxDamage wrote:
Are you sure about prelinking with the x11 libraries, then using nvidia ones again? Will the 3D apps use nvidia or x11, then?


I'd like to know the answer too :P
_________________
Tout ce que je suis n'est que cause
Tout ce que je suis n'est que conséquence
Pourquoi s'attacher à toutes ces choses
Pourquoi continuer dans la souffrance ?

-
Shiki Soku Ze Ku, Ku Soku Ze Shiki
Back to top
View user's profile Send private message
hds
Advocate
Advocate


Joined: 21 Aug 2004
Posts: 2629
Location: Sprockhoevel [GER]

PostPosted: Thu Feb 10, 2005 2:21 pm    Post subject: Reply with quote

Dais wrote:
MaxDamage wrote:
Are you sure about prelinking with the x11 libraries, then using nvidia ones again? Will the 3D apps use nvidia or x11, then?

I'd like to know the answer too :P

does work fine here. glxinfo output looks OK.
also gl screensaver (just tested "euphoria") is still working and using nvidias glx. same with glxgears.
specially those screensavers (*.kss) have been an issue - but i am sure you already knew that ;)
OTOH - your mileage might vary - simply try it out and report back if it doesnt work for you 8O
IMHO nothing much to risk or loose, cause you can easyly revert the situation.
well, i am not responsible to any damage of course :oops: :lol: :oops:


Last edited by hds on Thu Feb 10, 2005 2:24 pm; edited 1 time in total
Back to top
View user's profile Send private message
Dais
l33t
l33t


Joined: 05 Aug 2004
Posts: 977
Location: Québec

PostPosted: Thu Feb 10, 2005 2:23 pm    Post subject: Reply with quote

thanks ^^
_________________
Tout ce que je suis n'est que cause
Tout ce que je suis n'est que conséquence
Pourquoi s'attacher à toutes ces choses
Pourquoi continuer dans la souffrance ?

-
Shiki Soku Ze Ku, Ku Soku Ze Shiki
Back to top
View user's profile Send private message
hds
Advocate
Advocate


Joined: 21 Aug 2004
Posts: 2629
Location: Sprockhoevel [GER]

PostPosted: Thu Feb 10, 2005 2:26 pm    Post subject: keinstein Reply with quote

everything looking OK with "keinstein" (kde 3.4 beta2) as well. if you are interessted in screenshots, watch this space regulary:
http://www.en-total.de/modules.php?name=Forums&file=viewtopic&p=284#284
im a still compiling - this athlon 1200, ah well ;)
Back to top
View user's profile Send private message
juri
Tux's lil' helper
Tux's lil' helper


Joined: 13 Dec 2003
Posts: 88
Location: Pistoia - Italy

PostPosted: Fri Feb 11, 2005 6:36 pm    Post subject: Reply with quote

hds,
you should contact the author of the prelink how-to at gentoo.org or file a bug for the docs with bugzilla.
their guide needs to be updated quickly. I took a look at the USE flags with which stage 2 - 3 (2004.1 livecd) were compiled and there's no trace of "pic", so everyone trying to prelink will fail!
Back to top
View user's profile Send private message
hds
Advocate
Advocate


Joined: 21 Aug 2004
Posts: 2629
Location: Sprockhoevel [GER]

PostPosted: Sat Feb 12, 2005 4:01 am    Post subject: Reply with quote

well, he (and someone else in here as well now) is talking about the -fPIC CFLAG. i am still puzzled if this is correct or not. as i already mentioned in my first post, the -fPIC is IMHO irrelevant - but i know very little about gcc and c++ so i could be wrong :oops:
anyway, author emailed.
PS: IMHO the "pic" USEflag should have to be renamed to "prelink" - this would avoid a lot of confusion..
Back to top
View user's profile Send private message
juri
Tux's lil' helper
Tux's lil' helper


Joined: 13 Dec 2003
Posts: 88
Location: Pistoia - Italy

PostPosted: Sat Feb 12, 2005 10:29 am    Post subject: Reply with quote

And this info should be in the handbook, compiling from the beginning with pic would save a lot of time!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page 1, 2, 3, 4, 5, 6  Next
Page 1 of 6

 
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