Safe to delete old files in /usr/lib?
markus at edemalm.se
Tue Jan 5 16:23:24 UTC 2016
> 5 jan. 2016 kl. 04:47 skrev Shane Ambler <FreeBSD at ShaneWare.Biz>:
> On 05/01/2016 06:04, Polytropon wrote:
>> On Mon, 4 Jan 2016 19:18:02 +0100, Markus Edemalm wrote:
>>>> 4 jan. 2016 kl. 18:52 skrev Polytropon <freebsd at edvax.de>:
>>>> On Mon, 4 Jan 2016 18:28:14 +0100, Markus Edemalm wrote:
>>>>>> 4 jan. 2016 kl. 18:12 skrev Polytropon <freebsd at edvax.de>:
>>>>>> On Mon, 4 Jan 2016 18:06:00 +0100, Markus Edemalm wrote:
>>>>>>> My system was first installed as 10.0-RELEASE. I have
>>>>>>> sinceupgraded to 10.1, 10.1-STABLE, 10.2-RELEASE and is now
> >>>>>> at 10.2-RELEASE-p8.
>>>>>>> Iâ€™ve rebuild from source and followed the steps in the
> >>>>>> handbook. Everything is fineâ€¦ but:
>>>>>>> I see many files in /usr/lib with old dates, apparently
>>>>>>> they are
> no longer installed during upgrades.
> Did you clear out /usr/obj
> With the right modifications dates, a binary doesn't need to be rebuilt
> While I think make buildworld should clean it out, some files may get missed.
Yes, I always delete /usr/obj before I start. Just like the handbook suggests.
>>>>> And, they are all .a files, except for libc++.so and libc.so.
>>>>> I added NO_PROFILE=true to /etc/make.conf a while back. Is that relevant?
>>>> Hmmm... I always thought that would be the default (no profiling libs
>>>> being built and installed). But according to "man src.conf", the
>>>> setting's name is WITHOUT_PROFILE, not NO_PROFILE.
I removed NO_PROFILE=true from /etc/make.conf and rebuilt everything today.
Now I got the _p.a files installed. But no .a files. For each lib in /usr/lib I have, for example:
-r--r--r-- 1 root wheel 29242 Dec 2 2014 librt.a
lrwxr-xr-x 1 root wheel 10 Jan 5 16:50 librt.so@ -> librt.so.1
-r--r--r-- 1 root wheel 23832 Jan 5 16:50 librt.so.1
-r--r--r-- 1 root wheel 32202 Jan 5 16:50 librt_p.a
-r--r--r-- 1 root wheel 30550 Dec 2 2014 libpanelw.a
lrwxr-xr-x 1 root wheel 14 Jan 5 16:50 libpanelw.so@ -> libpanelw.so.5
-r--r--r-- 1 root wheel 11840 Jan 5 16:50 libpanelw.so.5
-r--r--r-- 1 root wheel 31678 Jan 5 16:50 libpanelw_p.a
See the dates? Why do I get fresh _p.a files and no .a files?
>>> Hmm. I forgot about src.conf, I got:
>>> cat /etc/src.conf
>>> That may explain why _some_ libs are not being built and installed.
>>> But still, more than 100 .a files with old dates. Doesnâ€™t make sense to me at all.
>> In this case, a good idea would be to move the old libraries out
>> of /usr/lib (for example into a newly created /usr/lib.old directory)
>> and checking if any application in use produces an error. In that
>> case, the required library could be restored. If no further error
>> appears - forget about those libraries. :-)
> .a files should be copied into the final binary, so removing .a files
> won't break anything that is already built, but the next make could
> fail with a missing library at link time.
> I am running 10-stable and run make delete-old after upgrades -
# make check-old-libs
>>> Checking for old libraries
# make delete-old-libs
>>> Removing old libraries
Please be sure no application still uses those libraries, else you
can not start such an application. Consult UPDATING for more
information regarding how to cope with the removal/revision bump
of a specific library.
>>> Old libraries removed
(nothing to remove)
> ls /usr/lib/*.a | wc -l
> ls /usr/lib/*.so | wc -l
> find /usr/lib -type l -name "*.a" | wc -l
> I do seem to have a few old libs
> find /usr/lib -not -newermt "2 weeks ago" | wc -l
> Downloading base.txz for 10.2-RELEASE -
> ls usr/lib/*.a | wc -l
> ls usr/lib/*.so | wc -l
Here’s my number after todays rebuild:
$ ls /usr/lib/*.a | wc -l
$ ls /usr/lib/*_p.a | wc -l
$ ls /usr/lib/*.so | wc -l
> FreeBSD - the place to B...Software Developing
> Shane Ambler
More information about the freebsd-questions