2013-08-20 182 views
1

我正在使用mac,我想安裝osm2pgsql以將OSM數據導入PostgreSQL。在終端執行brew install osm2pgsql。 (我已經執行brew update)。「brew install osm2pgsql」失敗

這裏是輸出:

==> Downloading https://github.com/openstreetmap/osm2pgsql/archive/v0.82.0.zip 
Already downloaded: /Library/Caches/Homebrew/osm2pgsql-0.82.0.zip 
==> ./autogen.sh 
==> ./configure --with-proj=/usr/local/opt/proj 
checking for fork... yes 
checking for xml2-config... /usr/bin/xml2-config 
checking for xml2 libraries... yes 
checking for zlib compression library... no 
configure: error: required library not found 

READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting 

這裏是執行brew doctor的輸出:

Warning: Unbrewed dylibs were found in /usr/local/lib. 
If you didn't put them there on purpose they could cause problems when 
building Homebrew formulae, and may need to be deleted. 

Unexpected dylibs: 
    /usr/local/lib/libMonoPosixHelper.dylib 
    /usr/local/lib/libSFFileMonitor.32.dylib 
    /usr/local/lib/libSFIPC.32.dylib 
    /usr/local/lib/libSFIPC.I.dylib 
    /usr/local/lib/libSFsqlite3.7.4.dylib 
    /usr/local/lib/libSFSyncEngine.I.dylib 

我不知道這些dylibs,我應該刪除?

我應該怎麼做linstall osm2pgsql

還是應該放棄osm2pgsql並使用其他工具將OSM數據導入PostgreSQL

[編輯1]

http://www.zlib.net/,zlib的已被包含在Mac OS X中的一部分

當我在谷歌搜索,我發現這個https://github.com/josegonzalez/homebrew-php/issues/205https://github.com/josegonzalez/homebrew-php/issues/538

所以我執行以下兩條命令:

brew tap homebrew/dupes 
brew install zlib 

而結果輸出爲:

==> Downloading http://zlib.net/zlib-1.2.8.tar.gz 
######################################################################## 100.0% 
==> ./configure --prefix=/usr/local/Cellar/zlib/1.2.8 
==> make install 
==> Caveats 
This formula is keg-only: so it was not symlinked into /usr/local. 

Mac OS X already provides this software and installing another version in 
parallel can cause all kinds of trouble. 

Generally there are no consequences of this for you. If you build your 
own software and it requires this formula, you'll need to add to your 
build variables: 

    LDFLAGS: -L/usr/local/opt/zlib/lib 
    CPPFLAGS: -I/usr/local/opt/zlib/include 

==> Summary 

看來,我沒有安裝zlib的。

我再次執行brew install osm2pgsql,但它仍然不起作用。

[編輯2]

我放棄自制並經由二進制安裝安裝osm2pgsql。

FYI:
http://wiki.openstreetmap.org/wiki/Osm2pgsql#Binary_Installer https://github.com/openstreetmap/osm2pgsql/issues/15

+0

爲'釀造doctor'問題,請參閱http://dissociatedpress.net/blog/2012/11/18/til-how-to-find-the-program - 即,擁有-文件上-MAC-OS-X / –

回答

1

我不知道brew什麼,但根據錯誤消息,缺少zlib庫。嘗試先安裝它。

而且您應該保留至osm2pgsql,因爲它是將OSM數據導入PostgreSQL數據庫的標準工具。

0

你必須使用以下命令來編輯公式:

brew edit <formula_name> 

然後,你必須在BREW ENV所需要的出口,要做到這一點的最好的地方是在安裝功能之前的

system "./configure", *args 

這裏的呼叫是行追加

ENV.append 'LDFLAGS', "-L/usr/local/opt/zlib/lib" 
ENV.append 'CPPFLAGS', "-I/usr/local/opt/zlib/include" 

當完成後,你只需要再次運行brew安裝,它會運行