完整linux下配置RMagick步驟 解決RMagick.so cannot open shared object問題

來源:互聯網
上載者:User

如果你在安裝RMagick的時候碰到類似這樣的錯誤:

1RMagick.so: libWand.so.10: cannot open shared object file: No such file or directory -

問題應該是出在共用庫的路徑上..所以可以嘗試在configure之前,先聲明路徑:

11)export LD_LIBRARY_PATH=/usr/local/lib
22)added "/usr/local/lib" to /etc/ld.so.conf , then

然後再configure , make ,make install..

送上我在linux上安裝RMagick的步驟和經驗..這個模組裝起來也確實麻煩的很..需要的東西很多..而且路徑問題折騰了我好久...閑話不說..下面是步驟

---------------------------------------------------------------------------------------------------
先來安裝RMagick 的前提,就是下面這些個模組...

1)安裝libjpg
wget http://www.ijg.org/files/jpegsrc.v6b.tar.gz
tar -xzvf jpegsrc.v6b.tar.gz
cd jpeg-6b/
./configure --enable-shared
make
make test
make install

2)安裝libpng
wget http://easynews.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.16.tar.bz2
tar -xvjf libpng-1.2.16.tar.bz2
./configure
make check

3)安裝Freetype
wget http://superb-west.dl.sourceforge.net/sourceforge/freetype/freetype-2.3.2.tar.bz2
tar -xjvf freetype-2.3.2.tar.bz2
cd freetype-2.3.2
make
make
cp objs/.libs/*.so* /usr/local/lib/
cp -rv include/* /usr/local/include/

4)安裝Ghostscript
wget http://umn.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.54-gpl.tar.bz2
tar xjvf ghostscript-8.54-gpl.tar.bz2
cd ghostscript-8.54-gpl
./configure
make
make install

5)安裝Ghostscript fonts
wget http://internap.dl.sourceforge.net/sourceforge/gs-fonts/ghostscript-fonts-std-8.11.tar.gz
tar -xvzf ghostscript-fonts-std-8.11.tar.gz
cp -rv fonts /usr/local/share/ghostscript/

6)安裝ImageMagick   
wget ftp://ftp.fifi.org/pub/ImageMagick/ImageMagick-6.3.2-9.tar.bz2
tar -xjvf ImageMagick-6.3.2-9.tar.bz2
cd ImageMagick-6.3.2
./configure --without-perl --without-magick-plus-plus

export PATH=$PATH:/usr/local/ImageMagic/bin
編輯:/etc/ld.so.conf,加入
/usr/local/ImageMagick/lib
執行:ldconfig  查看是否有異常..

確定有以下的配置資訊出現:
Ghostscript None gs (8.54)
FreeType --with-freetype=yes yes
JPEG v1 --with-jpeg=yes yes
PNG --with-png=yes yes

接著,make install(run as root)

如果在安裝後,系統報字型找不到,把usr/share/fonts/type1字型考到目錄/usr/share/ghostscript/fonts/,就可以了。

---------------------------------------------------------------------------------------
至此結束了RMagick的前面步驟...現在就開始了RMagick的安裝...比較簡單了...你可以選擇兩種方式:

1. gem安裝 

gem install rmagick

成功後提示:

Bulk updating Gem source index for: http://gems.rubyforge.org
Building native extensions.  This could take a while...
Successfully installed rmagick-X.Y.Z

2. 源碼安裝:

1) export LD_LIBRARY_PATH=/usr/local/lib
2) added "/usr/local/lib" to /etc/ld.so.conf , then
3) ./configure
4) make && make install

至此RMagick安裝結束..

現在來測試下RMagick是否安裝成功

irb -rubygems -r RMagick
irb(main):001:0> puts Magick::Long_version    如果輸出一下資訊則代表OK:

This is RMagick 1.15.3 ($Date: 2007/01/20 15:45:29 $) Copyright (C) 2007 by Timothy P. Hunter
Built with ImageMagick 6.3.2 02/23/07 Q8 http://www.imagemagick.org
Built for ruby 1.8.5 (2006-12-25 patchlevel 12) [powerpc-darwin8.0.0]
Web page: http://rmagick.rubyforge.org
Email: rmagick@rubyforge.org
=> nil

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.