View previous topic :: View next topic |
Author |
Message |
hds Advocate
Joined: 21 Aug 2004 Posts: 2629 Location: Sprockhoevel [GER]
|
Posted: Mon Feb 07, 2005 6:06 pm Post subject: [HOWTO] how I use to prelink (nvidia included) [x86] [~x86] |
|
|
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 |
|
|
rohan28 Tux's lil' helper
Joined: 12 Dec 2004 Posts: 84 Location: Australia
|
Posted: Tue Feb 08, 2005 1:50 am Post subject: |
|
|
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 |
|
|
bakreule Apprentice
Joined: 27 Aug 2003 Posts: 233 Location: Paris, France
|
Posted: Tue Feb 08, 2005 11:12 pm Post subject: |
|
|
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 |
|
|
radfoj Guru
Joined: 31 Dec 2004 Posts: 490 Location: Tísek, Czech Republic
|
Posted: Wed Feb 09, 2005 10:59 pm Post subject: |
|
|
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:
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:
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.
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) 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 |
|
|
MaxDamage l33t
Joined: 03 Jan 2004 Posts: 650 Location: Oviedo, Spain
|
Posted: Wed Feb 09, 2005 11:23 pm Post subject: |
|
|
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 |
|
|
hds Advocate
Joined: 21 Aug 2004 Posts: 2629 Location: Sprockhoevel [GER]
|
Posted: Wed Feb 09, 2005 11:35 pm Post subject: |
|
|
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 |
|
|
R!tman Veteran
Joined: 18 Dec 2003 Posts: 1303 Location: Zurich, Switzerland
|
Posted: Wed Feb 09, 2005 11:36 pm Post subject: |
|
|
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 |
|
|
hds Advocate
Joined: 21 Aug 2004 Posts: 2629 Location: Sprockhoevel [GER]
|
Posted: Wed Feb 09, 2005 11:44 pm Post subject: |
|
|
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 |
|
|
radfoj Guru
Joined: 31 Dec 2004 Posts: 490 Location: Tísek, Czech Republic
|
Posted: Wed Feb 09, 2005 11:47 pm Post subject: |
|
|
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.
And yes, it ends with "Executing /sbin/init U" |
|
Back to top |
|
|
hds Advocate
Joined: 21 Aug 2004 Posts: 2629 Location: Sprockhoevel [GER]
|
Posted: Wed Feb 09, 2005 11:52 pm Post subject: |
|
|
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 |
|
|
radfoj Guru
Joined: 31 Dec 2004 Posts: 490 Location: Tísek, Czech Republic
|
Posted: Thu Feb 10, 2005 12:15 am Post subject: |
|
|
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. Maybe anybody tell this secret.
BTW in mandrake, there was a script in /etc/cron.daily/prelink ..... but so hard for me. |
|
Back to top |
|
|
hds Advocate
Joined: 21 Aug 2004 Posts: 2629 Location: Sprockhoevel [GER]
|
Posted: Thu Feb 10, 2005 12:22 am Post subject: |
|
|
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 |
|
|
radfoj Guru
Joined: 31 Dec 2004 Posts: 490 Location: Tísek, Czech Republic
|
Posted: Thu Feb 10, 2005 12:46 am Post subject: |
|
|
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. |
|
Back to top |
|
|
R!tman Veteran
Joined: 18 Dec 2003 Posts: 1303 Location: Zurich, Switzerland
|
Posted: Thu Feb 10, 2005 1:10 am Post subject: |
|
|
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 |
|
|
rhill Retired Dev
Joined: 22 Oct 2004 Posts: 1629 Location: sk.ca
|
|
Back to top |
|
|
hds Advocate
Joined: 21 Aug 2004 Posts: 2629 Location: Sprockhoevel [GER]
|
Posted: Thu Feb 10, 2005 11:00 am Post subject: |
|
|
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 |
|
|
radfoj Guru
Joined: 31 Dec 2004 Posts: 490 Location: Tísek, Czech Republic
|
Posted: Thu Feb 10, 2005 11:23 am Post subject: |
|
|
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 |
|
|
hds Advocate
Joined: 21 Aug 2004 Posts: 2629 Location: Sprockhoevel [GER]
|
Posted: Thu Feb 10, 2005 12:07 pm Post subject: |
|
|
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
well, i really dont know. it just works
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 |
|
|
Dais l33t
Joined: 05 Aug 2004 Posts: 977 Location: Québec
|
Posted: Thu Feb 10, 2005 2:03 pm Post subject: |
|
|
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 _________________ 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 |
|
|
hds Advocate
Joined: 21 Aug 2004 Posts: 2629 Location: Sprockhoevel [GER]
|
Posted: Thu Feb 10, 2005 2:21 pm Post subject: |
|
|
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 |
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
IMHO nothing much to risk or loose, cause you can easyly revert the situation.
well, i am not responsible to any damage of course
Last edited by hds on Thu Feb 10, 2005 2:24 pm; edited 1 time in total |
|
Back to top |
|
|
Dais l33t
Joined: 05 Aug 2004 Posts: 977 Location: Québec
|
Posted: Thu Feb 10, 2005 2:23 pm Post subject: |
|
|
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 |
|
|
hds Advocate
Joined: 21 Aug 2004 Posts: 2629 Location: Sprockhoevel [GER]
|
|
Back to top |
|
|
juri Tux's lil' helper
Joined: 13 Dec 2003 Posts: 88 Location: Pistoia - Italy
|
Posted: Fri Feb 11, 2005 6:36 pm Post subject: |
|
|
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 |
|
|
hds Advocate
Joined: 21 Aug 2004 Posts: 2629 Location: Sprockhoevel [GER]
|
Posted: Sat Feb 12, 2005 4:01 am Post subject: |
|
|
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
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 |
|
|
juri Tux's lil' helper
Joined: 13 Dec 2003 Posts: 88 Location: Pistoia - Italy
|
Posted: Sat Feb 12, 2005 10:29 am Post subject: |
|
|
And this info should be in the handbook, compiling from the beginning with pic would save a lot of time! |
|
Back to top |
|
|
|