{"id":141,"date":"2012-12-18T09:55:05","date_gmt":"2012-12-18T15:55:05","guid":{"rendered":"http:\/\/cartometric.com\/blog\/?p=141"},"modified":"2014-09-25T13:33:17","modified_gmt":"2014-09-25T18:33:17","slug":"osm2pgsql-and-windows-errors-failed-to-start-msvcr90-dll-connection-to-database-failed-etc","status":"publish","type":"post","link":"https:\/\/elrobis.com\/blog\/2012\/12\/18\/osm2pgsql-and-windows-errors-failed-to-start-msvcr90-dll-connection-to-database-failed-etc\/","title":{"rendered":"osm2pgsql and windows errors: failed to start MSVCR90.dll, Connection to database failed, etc.."},"content":{"rendered":"<p>I&#8217;m following the <a href=\"http:\/\/www.bostongis.com\/?content_name=loading_osm_postgis#229\" target=\"_blank\">BostonGIS tutorial<\/a>(<a href=\"http:\/\/www.bostongis.com\/?content_name=generating_osm_tiles#230\" target=\"_blank\">s<\/a>) to learn how to setup an OpenStreetMap tile server on Windows (XP 32, cos&#8217; that&#8217;s what&#8217;s on the desk), and I&#8217;m running into headache after headache. So this post notes the gotcha&#8217;s I&#8217;m encountering and how I&#8217;m fixing them (optimistically assuming I fix all of them).<\/p>\n<p>&#8220;Thar be dragons..&#8221; 8)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p><strong>Part I: &#8220;Failed to start MSVCR90.dll&#8221;<\/strong><\/p>\n<p>First, as recommended I tried using the <a href=\"https:\/\/github.com\/hotosm\/installer\/downloads\" target=\"_blank\">HOTOSM installer<\/a>, but when I launch it using the example command provided on the BostonGIS site, I got the error above. I&#8217;d logged out\/in, rebooted, <em>ad nauseam<\/em>, to no avail. Also the problem can&#8217;t be my redist libs&#8211;this install of XP is only a couple months old, and I have all the redists libs I know of (2005, 2008, 2010&#8212;plus, when I try reinstalling a redist it says I have the latest). I consider uninstalling and reinstalling Visual Studio to be more trouble than just trying something else to get the OSM download into PostGIS, so..<\/p>\n<p>Next I tried the latest <a href=\"http:\/\/osm4windows.org\/downloads\/osm2pgsql-2012-08-09.zip\" target=\"_blank\">&#8220;alpha&#8221; build of osm2pgsql<\/a> (rather than the all-in-one HOTOSM installer), and that\u00a0 got me around the MSVCR\/redist issue. That is, it&#8217;s launching..<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p><strong>Part II: the BostonGIS osm2pgsql example command<\/strong><\/p>\n<p><strong>Error: Connection to database failed: could not connect to server: No such file<\/strong><strong> or directory<\/strong><br \/>\nIs the server running locally and accepting<br \/>\nconnections on Unix domain socket &#8220;\/tmp\/.s.PGSQL.5432&#8221;?<\/p>\n<p>&#8230;and then&#8230;<\/p>\n<p><strong>Error: Connection to database failed: fe_sendauth: no password supplied<\/strong><\/p>\n<p>&#8230;and then&#8230;<\/p>\n<p><strong>Out of memory for node cache dense index, try using &#8220;&#8211;cache-strategy sparse&#8221; in<\/strong><strong>stead<\/strong><\/p>\n<p>&#8230;and then&#8230;<\/p>\n<p><strong>Out of memory for sparse node cache, reduce &#8211;cache size<\/strong><\/p>\n<p>I&#8217;ve benefitted greatly from the BostonGIS tutorials, and I&#8217;m very thankful for them. (Thank you Regina, Leo, et. al., sincerely!) Having said that, though, here&#8217;s a few notes discussing how I addressed the above, for which a couple items are conspicuously missing in the BostonGIS osm2pgsl example command.<\/p>\n<p>So take a look at this:<\/p>\n<blockquote><p>osm2pgsql missouri.osm.bz2 <strong>-H localhost<\/strong> -d OSM -U postgres -P 5432 <strong>-W<\/strong> -S default.style <strong>-C 512<\/strong> <strong>&#8211;slim<\/strong> &#8211;hstore <strong>&#8211;cache-strategy sparse<\/strong><\/p><\/blockquote>\n<p>What&#8217;s of-note:<\/p>\n<p><strong>-H localhost<\/strong> (solves the first error)<\/p>\n<p><strong>-W<\/strong> (solves the second error, i.e. lets you enter your db password after ENTER)<\/p>\n<p><strong>&#8211;cache-strategy sparse<\/strong> (gets past the third, and into the fourth error)<\/p>\n<p><strong>&#8211;slim<\/strong> (<a href=\"http:\/\/wiki.openstreetmap.org\/wiki\/Osm2pgsql#Slim_mode\" target=\"_blank\">from everything I read, you just need this on a 32-bit system<\/a>)<\/p>\n<p><strong>-C 512<\/strong> (wicked-small cache size)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p><strong>21 Minutes. I&#8217;m not talking about an episode of Friends.<\/strong><\/p>\n<p>So those are the extra command parameters that ultimately got me to end-game:<\/p>\n<blockquote><p>Osm2pgsql took 1317s overall<\/p><\/blockquote>\n<p>Setting that wicked-small cache size finally did the trick (it actually finished while I was writing this). At first I started it larger (<a href=\"http:\/\/wiki.openstreetmap.org\/wiki\/Osm2pgsql#Slim_mode\" target=\"_blank\">12000<\/a>, look under &#8220;Parameters&#8221;), then I started backing off (<a href=\"http:\/\/gis.stackexchange.com\/questions\/6080\/optimizing-osm2pgsql-imports-for-osm-data\" target=\"_blank\">4096<\/a>, <a href=\"http:\/\/switch2osm.org\/serving-tiles\/manually-building-a-tile-server\/\" target=\"_blank\">2048<\/a> look under &#8220;Loading data into your server&#8221;), when all the examples I found didn&#8217;t work, I just tried reducing by the common multiples&#8212;again, 1024 didn&#8217;t work, but 512 did.<\/p>\n<p>I need to do some research, but I guess that cache size suggests my hard disk must be ..wholly ..awful. :\/ I&#8217;m not a gear-hound (clearly, I&#8217;m using XP), but that&#8217;s my best-guess.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m following the BostonGIS tutorial(s) to learn how to setup an OpenStreetMap tile server on Windows (XP 32, cos&#8217; that&#8217;s what&#8217;s on the desk), and I&#8217;m running into headache after headache. So this post notes the gotcha&#8217;s I&#8217;m encountering and how I&#8217;m fixing them (optimistically assuming I fix all of them). &#8220;Thar be dragons..&#8221; 8) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[36,35,33],"tags":[54,53,52],"_links":{"self":[{"href":"https:\/\/elrobis.com\/blog\/wp-json\/wp\/v2\/posts\/141"}],"collection":[{"href":"https:\/\/elrobis.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elrobis.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elrobis.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elrobis.com\/blog\/wp-json\/wp\/v2\/comments?post=141"}],"version-history":[{"count":4,"href":"https:\/\/elrobis.com\/blog\/wp-json\/wp\/v2\/posts\/141\/revisions"}],"predecessor-version":[{"id":262,"href":"https:\/\/elrobis.com\/blog\/wp-json\/wp\/v2\/posts\/141\/revisions\/262"}],"wp:attachment":[{"href":"https:\/\/elrobis.com\/blog\/wp-json\/wp\/v2\/media?parent=141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elrobis.com\/blog\/wp-json\/wp\/v2\/categories?post=141"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elrobis.com\/blog\/wp-json\/wp\/v2\/tags?post=141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}