2011-06-07 12:24:09     removing libstdc++, libobjc, libnsl, libmudflap*, and more from ucLinux build

Document created by Aaronwu Employee on Aug 27, 2013
Version 1Show Document
  • View in full screen mode

2011-06-07 12:24:09     removing libstdc++, libobjc, libnsl, libmudflap*, and more from ucLinux build

Timothy Stotts (UNITED STATES)

Message: 101052   

 

To find unused libraries in my romfs, I have run the following shell command in my build directory on the development host. Why are there so many libraries being built for the romfs that are not referenced by any other binary in the build? For example, I am not building an C++ applications and the C++ library is built. Are these safe to remove? How can I automate their removal prior to romfs generation and/or prevent them from building? Will this disrupt the kernel's usage of ld.so.cache?

 

# for n in romfs/lib/*.* romfs/usr/lib/*.*; do du -sh $n; nn=`basename $n`; find romfs/ -type f -print0 | xargs -0 grep -l $nn | grep -v $n | grep -v ld.so.cache | wc -l; done

20K     romfs/lib/ld-uClibc.so.0

23

232K    romfs/lib/libc.so.0

33

12K     romfs/lib/libcrypt.so.0

2

8.0K    romfs/lib/libdl.so.0

5

68K     romfs/lib/libgcc_s.so.1

21

456K    romfs/lib/libgfortran.so.3

0

28K     romfs/lib/libgomp.so.1

0

68K     romfs/lib/libm.so.0

3

96K     romfs/lib/libmudflap.so.0

0

100K    romfs/lib/libmudflapth.so.0

0

4.0K    romfs/lib/libnsl.so.0

0

84K     romfs/lib/libobjc.so.2

0

40K     romfs/lib/libpthread.so.0

3

4.0K    romfs/lib/libresolv.so.0

0

4.0K    romfs/lib/librt.so.0

0

512K    romfs/lib/libstdc++.so.6

0

188K    romfs/lib/libthread_db.so.1

0

8.0K    romfs/lib/libutil.so.0

0

64K     romfs/lib/libz.so.1

1

1.1M    romfs/usr/lib/libcrypto.so.0.9.8

2

92K     romfs/usr/lib/liblzo2.so.2

1

224K    romfs/usr/lib/libssl.so.0.9.8

0

 

 

QuoteReplyEditDelete

 

 

2011-06-07 12:49:56     Re: removing libstdc++, libobjc, libnsl, libmudflap*, and more from ucLinux build

Mike Frysinger (UNITED STATES)

Message: 101053   

 

the dist already provides an option for automatically trimming libraries:

CONFIG_INSTALL_ELF_TRIM_LIBS=y

 

obviously by default, we have no idea what programs people are going to load after the fact and thus what libraries they're going to need, so we cant remove based purely on the contents of romfs/.

QuoteReplyEditDelete

Attachments

    Outcomes