Note that there are some explanatory texts on larger screens.

plurals
  1. POLoad spatialite extension in RSQLite crashes R (OS X & Ubuntu)
    primarykey
    data
    text
    <p>I am running some queries against a spatialite database, and would like to get the data directly into R. <a href="http://r-sig-geo.2731867.n2.nabble.com/Re-spatialite-from-R-td7583603.html" rel="nofollow">This page</a> suggests I can do something like this:</p> <pre><code>library(RSQLite) sqldrv &lt;- dbDriver("SQLite") con &lt;- dbConnect(sqldrv, dbname = "/path/to/db.sqlite",loadable.extensions = TRUE) spatialitestatus &lt;- dbGetQuery(con, "SELECT load_extension('libspatialite.dylib')") </code></pre> <p>But when I do, R segfaults with the following:</p> <pre><code> *** caught segfault *** address 0x0, cause 'memory not mapped' Traceback: 1: .Call("RS_SQLite_fetch", rsId, nrec = n, PACKAGE = .SQLitePkgName) 2: sqliteFetch(rs, n = -1, ...) 3: sqliteQuickSQL(conn, statement, ...) 4: dbGetQuery(con, "SELECT load_extension('/usr/local/lib/libspatialite.dylib')") 5: dbGetQuery(con, "SELECT load_extension('/usr/local/lib/libspatialite.dylib')") </code></pre> <p>In my case, spatialite was built from source using Homebrew, as is the version of sqlite that I would normally use. In the libspatialite homebrew definition, it says it depends on sqlite > 3.7.3. My homebrewed version of sqlite is 3.7.17</p> <p>I don't know for certain what version of sqlite RSQLite pulls in by default, but I assume it's the version 3.7.17 version included in the RSQLite source package. I tried building RSQLite from source using <code>install.packages(c("RSQLite"), type="source")</code> in hopes that it would simply use my version of sqlite, but it doesn't look like it did. Or if it did, it's still crashing.</p> <p>Finally, I should mention that I tried this under two versions of R with same results:</p> <ul> <li>R 3.0.0 downloaded in binary form from CRAN</li> <li>R 3.0.1 downloaded in source form and installed via homebrew</li> </ul> <h2>UPDATE:</h2> <p>Crash confirmed in Ubuntu 13.04 using the libspatialite5 provided by the Ubuntu FOSS GIS repository.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload