2016-09-26 46 views
1

静的にリンクされたバージョンのvipsを作成しようとしましたが、できませんでした。静的にリンクされたvipsコマンドを作成することは可能ですか?静的リンクされたvips(libvips)バイナリ

私がコンパイルしているプラ​​ットフォームは、Ubuntu 16.04です。

makeコマンド私は実行しています:

make LDFLAGS=-all-static 

私はそれがPythonやImageMagickの、(configの出力でそれらのショーを "なし")を使用して構成しておりません。私は取得していますエラーは次のとおりです。私はここに、たとえば、上の発見したものから、

/usr/bin/ld: cannot find -lgdk_pixbuf-2.0 
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgio-2.0.a(libgio_2_0_la-glocalfileinfo.o): In function `lookup_gid_name': 
(.text+0x11d7): warning: Using 'getgrgid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking 
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgio-2.0.a(libgio_2_0_la-glocalvfs.o): In function `g_local_vfs_parse_name': 
(.text+0x1cd): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking 
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libglib-2.0.a(libglib_2_0_la-gutils.o): In function `g_get_user_database_entry': 
(.text+0x249): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking 
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libglib-2.0.a(libglib_2_0_la-gutils.o): In function `g_get_user_database_entry': 
(.text+0xcf): warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking 
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgio-2.0.a(libgio_2_0_la-glocalfileinfo.o): In function `lookup_uid_data': 
(.text+0x1054): warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking 
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libxml2.a(nanohttp.o): In function `xmlNanoHTTPConnectHost': 
(.text+0x924): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking 
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libxml2.a(nanohttp.o): In function `xmlNanoHTTPConnectHost': 
(.text+0x9f4): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking 
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgio-2.0.a(libgio_2_0_la-gnetworkaddress.o): In function `g_network_address_parse': 
(.text+0xc39): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking 
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgio-2.0.a(libgio_2_0_la-gnetworkaddress.o): In function `g_network_address_parse': 
(.text+0xc4e): warning: Using 'endservent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking 
collect2: error: ld returned 1 exit status 
Makefile:597: recipe for target 'vips' failed 
make[2]: *** [vips] Error 1 
make[2]: Leaving directory '/usr/local/src/vips-8.4.1/tools' 
Makefile:631: recipe for target 'all-recursive' failed 
make[1]: *** [all-recursive] Error 1 
make[1]: Leaving directory '/usr/local/src/vips-8.4.1' 
Makefile:536: recipe for target 'all' failed 
make: *** [all] Error 2 

Create statically-linked binary that uses getaddrinfo? が、これはlibnssの問題であるということです。しかし、./configure --helpの出力には、 - enable-static-flagはありません。それでも、私はそれを試みたが、それは私の問題を解決しなかった。私はにリンクしています

ライブラリは、(configの出力に応じて、私はそれを切り捨てました):

build radiance support:   yes 
build analyze support:   yes 
build PPM support:   yes 
use fftw3 for FFT:   yes 
accelerate loops with orc:  yes 
ICC profile support with lcms:  yes (lcms2) 
SVG import with librsvg-2.0:  yes 
zlib:     yes 
file import/export with libwebp: yes 
file import/export with libpng:  yes (pkg-config libpng >= 1.2.9) 
file import/export with libtiff: yes (pkg-config libtiff-4) 
file import/export with giflib:  yes (found by search) 
file import/export with libjpeg: yes 
use libexif to load/save JPEG metadata: yes 

は、私はそれにリンクしています特定のライブラリが問題を引き起こしているがありますか?

$ CFLAGS="-static" CXXFLAGS="-static" ./configure --prefix=/home/john/vips --without-python --without-magick 

をそして、動作するようです:

答えて

1

私はこのようにしようとした私はあまりかかわらず、それをテストしていませんでした

$ ls ~/vips/lib 
girepository-1.0 libvipsCC.a libvips-cpp.a libvips.la python2.7 
libvips.a   libvipsCC.la libvips-cpp.la pkgconfig 
$ which vips 
/home/john/vips/bin/vips 
$ ls -l ~/vips/bin/vips 
-rwxr-xr-x 1 john john 6373864 Sep 27 13:16 /home/john/vips/bin/vips 
$ vips invert /data/john/pics/k2.jpg x.jpg 
$ eog x.jpg 

、と私はそれが非常に静的ではありません疑います。例えば、vipsバイナリ上でlddを実行すると、長いリストが得られます。本当の静的なバイナリはもう存在しません。

なぜ静的バイナリが必要ですか?それが流通を楽にするならば、フラットパックやスナッピーのようなものが良いかもしれません。独自のソートを行うこともできます。たとえば、共有バイナリの再配置を可能にする単純なラッパースクリプトが付いています。

+0

私はffmpegとffprobeのスタティックバージョンを持った最小限のドッカーコンテナに展開したいと考えていました。私は画像変換プログラムがgetservbynameのような呼び出しを必要としている理由を確信していなかったので、私が落とす可能性のある依存関係があることを望んでいました。 – SjB

+0

vipsは移植性を助けるためにglibを使い、glibにはたくさんのものがあります。いくつかのものを削除して自分のglibを作ってみるといいかもしれません。静的バイナリ^^^^は16.04のどのインストールでも動作しますが、これはおそらく最小限のLinuxインストールではうまくいかないでしょう。 OpenWRTにはlibvipsパッケージがあり、これは非常に最小限です。おそらくそれを適応させることができますか? – user894763

+0

私はdietlibcのようなものを使うと動作するかもしれないと思うが、まだそれを再訪問する機会はなかった。 – SjB

関連する問題