sql.js icon indicating copy to clipboard operation
sql.js copied to clipboard

Can't make a new build during trying to update rtree branch

Open sveta-wl opened this issue 6 years ago • 4 comments

Hi guys!

Recently I found out, that sql.js has a branch with R-Tree module support. Unfortunately it's quite outdated, so I'm not able to use it with the current Geopackage JS library. According to this issue #59 it needs actually just to add -DSQLITE_ENABLE_RTREE=1 to the make file on master and create a new build. But when I run make command, I receive this errors:

incorrect target triple 'le32-unknown-nacl' (did you use emcc/em++ on all source files and not clang directly?) LLVM ERROR: Invalid SIMD cast between items of different bit sizes!

I installed emscripten as it described here and here because it looks like the problem described in this FAQ. But unfortunately it doesn't work.

Could you please help me to solve this issue? Or maybe it would be possible to update rtree branch to the master state, so I can easy include it into a package config? I guess it would be the best solution in my case.

Looking forward to your reply

sveta-wl avatar Apr 06 '18 13:04 sveta-wl

seeing le32-unknown-nacl might indicate a very old version of emscripten is used by mistake. perhaps more than one was installed on your system?

emcc -v may show some info that might help.

kripken avatar Apr 09 '18 22:04 kripken

Hi I am getting the same issue, here is my emcc -v ~/sqlitejs/sql.js$ emcc -v emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.38.8 clang version 6.0.1 (emscripten 1.38.8 : 1.38.8) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /home/robertwang/emscriptenPortable/emsdk-portable/clang/e1.38.8_64bit Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6 Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6.0.0 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0 Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0 Candidate multilib: .;@m64 Selected multilib: .;@m64 INFO:root:(Emscripten: Running sanity checks)

ziyiwang avatar Jul 17 '18 00:07 ziyiwang

On macOS 10.13.5, Node v8.9.1, with the latest version of emscripten installed following these instructions (http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html):

$ emcc -v
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.38.11
clang version 6.0.1  (emscripten 1.38.11 : 1.38.11)
Target: x86_64-apple-darwin17.6.0
Thread model: posix
InstalledDir: /data/github/emsdk/clang/e1.38.11_64bit
INFO:root:(Emscripten: Running sanity checks)

In order to get this to build, I had to install CoffeeScript version 1.12.7. The latest version of CoffeeScript gives this error:

Statement = class Statement { 
Unexpected token: name (Statement) (line: 6130, col: 18, pos: 227365)

Once I got past that, it builds just fine but when I run npm test it fails as follows:

TypeError: Cannot read property 'apply' of undefined
    at Module.stackAlloc (/data/github/kripken/sql.js/js/sql.js:3:119288)

So then I added -s WASM=0 to the EMFLAGS for all the types of builds. That also builds but now gives this error when running the tests:

Assertion failed: Cannot call unknown function RegisterExtensionFunctions, make sure it is exported

All of these same errors happen if I add -DSQLITE_ENABLE_RTREE=1 or if I leave the Makefile it originally was.

Hopefully this extra information will help, or maybe I am just doing things wrong?

danielbarela avatar Aug 13 '18 18:08 danielbarela

Update: I finally got this to build by using version 1.37.27 of emscripten. Install that with the following commands:

./emsdk install sdk-1.37.27-64bit
./emsdk activate sdk-1.37.27-64bit
source ./emsdk_env.sh

Then I simply added the rtree option to the makefile and it works great. I pushed the built library here: https://github.com/danielbarela/sql.js/tree/master In addition @sveta-wl I am integrating this into geopackage-js

danielbarela avatar Aug 14 '18 15:08 danielbarela