[ncl-install] Builded NCL have too more dependent dynamic library at openSUSE Tumbleweed

Kevin Hallock hallock at ucar.edu
Mon Apr 2 09:53:46 MDT 2018


Hi Renzhi,

106 MB does seem a bit large for a static build of NCL; most of our static builds end up around 50 MB (although we do not run the strip command).

Unfortunately, I don’t think you’ll be able to get it much smaller than 28 MB. NCL itself contains many components (graphics, computational routines, file I/O, etc), which will require a certain minimum amount of disk space.

As for the shared libraries, most of the libraries listed in your “ldd ncl” output are either direct dependencies of NCL or are required by one of the direct dependencies. You could theoretically statically link against some of those libraries (if the appropriate *.a files exist), although this will increase the size of your final NCL binary.

If you do wish to prioritize static libraries over shared, you can modify some of the #define statements in the file $nclsrc/config/Project. For example, on my machine I do the following for cairo:
original:
#define CAIROlib -lcairo -lXrender -lfontconfig -lpixman-1 -lfreetype -lexpat -lpng -lz -liconv -lbz2

modified:
#define CAIROlib /Users/hallock/dev/external/lib/libcairo.a -lfontconfig /Users/hallock/dev/external/lib/libpixman-1.a /Users/hallock/dev/external/lib/libfreetype.a /Users/hallock/dev/external/lib/libexpat.a /Users/hallock/dev/external/lib/libpng.a -lz -liconv -lXrender -lbz2

However, instead of modifying the Project file directly, I would recommend adding these #define statements to your $nclsrc/config/Site.local file as it will override the defaults in Project. The Project file should just be used as a reference for which macros need to be redefined.

I hope this helps,
Kevin

> On Mar 30, 2018, at 9:56 AM, 王忍之 via ncl-install <ncl-install at ucar.edu> wrote:
> 
> Dear NCL Developer:
> 
>  I have build ncl 6.4.0 at openSUSE Tumbleweed. gcc version is 7.3.1 . Most of library have been compiled statically.
>  such as netcdf 4.5.0, hdf5-1.8.20, hdf, hdf-eos, gdal ..and etc.
> 
>  But I fonud ncl binary file is too big (106MB), so I use 'strip' command reduced ncl size. Finally it only have 28MB.
> 
>  And I run 'ldd ncl' command . it's output:
> 
>  	linux-vdso.so.1 (0x00007ffc6b8fb000)
> 	libjpeg.so.62 => /usr/lib64/libjpeg.so.62 (0x00007feb1402a000)
> 	libz.so.1 => /lib64/libz.so.1 (0x00007feb13e13000)
> 	liblber-2.4.so.2 => /usr/lib64/liblber-2.4.so.2 (0x00007feb13c04000)
> 	libldap_r-2.4.so.2 => /usr/lib64/libldap_r-2.4.so.2 (0x00007feb139b0000)
> 	libtirpc.so.3 => /lib64/libtirpc.so.3 (0x00007feb1377e000)
> 	libexpat.so.1 => /usr/lib64/libexpat.so.1 (0x00007feb1354c000)
> 	libpng16.so.16 => /usr/lib64/libpng16.so.16 (0x00007feb13308000)
> 	libcairo.so.2 => /usr/lib64/libcairo.so.2 (0x00007feb12fd2000)
> 	libXrender.so.1 => /usr/lib64/libXrender.so.1 (0x00007feb12dc7000)
> 	libfontconfig.so.1 => /usr/lib64/libfontconfig.so.1 (0x00007feb12b82000)
> 	libpixman-1.so.0 => /usr/lib64/libpixman-1.so.0 (0x00007feb128dc000)
> 	libfreetype.so.6 => /usr/lib64/libfreetype.so.6 (0x00007feb12635000)
> 	libbz2.so.1 => /usr/lib64/libbz2.so.1 (0x00007feb12418000)
> 	libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007feb120d7000)
> 	libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007feb11ec5000)
> 	libgfortran.so.4 => /usr/lib64/libgfortran.so.4 (0x00007feb11af1000)
> 	libm.so.6 => /lib64/libm.so.6 (0x00007feb1175e000)
> 	libdl.so.2 => /lib64/libdl.so.2 (0x00007feb1155a000)
> 	libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007feb111d1000)
> 	libgomp.so.1 => /usr/lib64/libgomp.so.1 (0x00007feb10fa1000)
> 	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007feb10d89000)
> 	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007feb10b6a000)
> 	libc.so.6 => /lib64/libc.so.6 (0x00007feb107ac000)
> 	libresolv.so.2 => /lib64/libresolv.so.2 (0x00007feb10595000)
> 	libsasl2.so.3 => /usr/lib64/libsasl2.so.3 (0x00007feb10378000)
> 	libssl.so.1.1 => /usr/lib64/libssl.so.1.1 (0x00007feb1010d000)
> 	libcrypto.so.1.1 => /usr/lib64/libcrypto.so.1.1 (0x00007feb0fc83000)
> 	libgssapi_krb5.so.2 => /usr/lib64/libgssapi_krb5.so.2 (0x00007feb0fa38000)
> 	libEGL.so.1 => /usr/lib64/libEGL.so.1 (0x00007feb0f825000)
> 	libxcb-shm.so.0 => /usr/lib64/libxcb-shm.so.0 (0x00007feb0f621000)
> 	libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00007feb0f3f8000)
> 	libxcb-render.so.0 => /usr/lib64/libxcb-render.so.0 (0x00007feb0f1ea000)
> 	libGL.so.1 => /usr/lib64/libGL.so.1 (0x00007feb0ef59000)
> 	librt.so.1 => /lib64/librt.so.1 (0x00007feb0ed51000)
> 	/lib64/ld-linux-x86-64.so.2 (0x00007feb14293000)
> 	libquadmath.so.0 => /usr/lib64/libquadmath.so.0 (0x00007feb0eb11000)
> 	libkrb5.so.3 => /usr/lib64/libkrb5.so.3 (0x00007feb0e837000)
> 	libk5crypto.so.3 => /usr/lib64/libk5crypto.so.3 (0x00007feb0e605000)
> 	libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007feb0e401000)
> 	libkrb5support.so.0 => /usr/lib64/libkrb5support.so.0 (0x00007feb0e1f4000)
> 	libGLdispatch.so.0 => /usr/lib64/libGLdispatch.so.0 (0x00007feb0df3e000)
> 	libXau.so.6 => /usr/lib64/libXau.so.6 (0x00007feb0dd3a000)
> 	libGLX.so.0 => /usr/lib64/libGLX.so.0 (0x00007feb0db08000)
> 	libkeyutils.so.1 => /usr/lib64/libkeyutils.so.1 (0x00007feb0d904000)
> 	libselinux.so.1 => /lib64/libselinux.so.1 (0x00007feb0d6db000)
> 	libpcre.so.1 => /usr/lib64/libpcre.so.1 (0x00007feb0d44e000)
> 
> 
> 
>  I compared with precompiled binaries. it need too more shared library .So Can you help me how to reduce 'ncl' dependent dynamic library? 
> 
>  
>    Builded NCL is work well at present. 
> 
> Sincerely
> Renzhi Wang
> _______________________________________________
> ncl-install mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-install

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-install/attachments/20180402/46aa754f/attachment.html>


More information about the ncl-install mailing list