sqlite - Load spatialite extension in RSQLite crashes R (OS X & Ubuntu) -


i running queries against spatialite database, , data directly r. this page suggests can this:

library(rsqlite) sqldrv <- dbdriver("sqlite")  con <- dbconnect(sqldrv, dbname = "/path/to/db.sqlite",loadable.extensions = true)   spatialitestatus <- dbgetquery(con, "select load_extension('libspatialite.dylib')") 

but when do, r segfaults following:

 *** 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')") 

in case, spatialite built source using homebrew, version of sqlite use. in libspatialite homebrew definition, says depends on sqlite > 3.7.3. homebrewed version of sqlite 3.7.17

i don't know version of sqlite rsqlite pulls in default, assume it's version 3.7.17 version included in rsqlite source package. tried building rsqlite source using install.packages(c("rsqlite"), type="source") in hopes use version of sqlite, doesn't did. or if did, it's still crashing.

finally, should mention tried under 2 versions of r same results:

  • r 3.0.0 downloaded in binary form cran
  • r 3.0.1 downloaded in source form , installed via homebrew

update:

crash confirmed in ubuntu 13.04 using libspatialite5 provided ubuntu foss gis repository.

it appears recent versions of libspatialite (4.x) problematic. in addition, loading homebrewed libspatialite3 extension works, subsequent queries resulted in same segfault.

in end, (short-term, temporary, hackish) solution create r package compiles own spatialite , loads it. rsqlite.spatialite can found here.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -