Giter Club home page Giter Club logo

Comments (5)

pepperoni505 avatar pepperoni505 commented on June 21, 2024 1

Any updates on this?

Yeah, I got this resolved with downloading the wasi-sdk (https://github.com/WebAssembly/wasi-sdk, in my case I used v19). I then made a batch file to set a few environmental variables:

set "CLANG_LIB_WASI=%WASI_SDK%\\lib\\clang\\15.0.7\\lib\\wasi"
set "WASI_SYSROOT=%WASI_SDK%\\share\\wasi-sysroot"
set "CC=%WASI_SDK%\\bin\\clang --sysroot=%WASI_SYSROOT%"
set "AR=%WASI_SDK%\\bin\\llvm-ar"
set "CC_wasm32_wasi=%WASI_SDK%\\bin\\clang"
set "LIBSQLITE3_FLAGS=-DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_SHARED_CACHE -D_LARGEFILE64_SOURCE"
set "RUSTFLAGS=-Clink-arg=-L%CLANG_LIB_WASI% -Clink-arg=-lclang_rt.builtins-wasm32 -Clink-arg=--export-table -Clink-arg=--export=malloc -Clink-arg=--export=free"

One of the most important parts of that is linking the clang_rt.builtins-wasm32, as without that my WASM output was trying to import functions that weren't exposed to it/didn't exist on my target platform:
image

Hopefully this works for you!

from rusqlite.

gwenn avatar gwenn commented on June 21, 2024

For winsqlite3 feature:
=> #1270
So please, remove it even if you still have the same error.

from rusqlite.

thomcc avatar thomcc commented on June 21, 2024

Nobody should use the winsqlite3 feature in general. But if you're using it when trying to compile to wasm, you'll certainly have a bad time.

from rusqlite.

pepperoni505 avatar pepperoni505 commented on June 21, 2024

Removed the winsqlite3 feature and my error changed:

warning: sqlite3/sqlite3.c:14183:10: fatal error: 'stdio.h' file not found
warning: #include <stdio.h>
warning:          ^~~~~~~~~
warning: 1 error generated.

error: failed to run custom build command for `libsqlite3-sys v0.26.0`

Caused by:
  process didn't exit successfully: `C:\Users\peppe\Documents\Code\rusqlite-test\target\release\build\libsqlite3-sys-59408460b12e7548\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-changed=sqlite3/sqlite3.c
  cargo:rerun-if-changed=sqlite3/wasm32-wasi-vfs.c
  cargo:rerun-if-env-changed=SQLITE_MAX_VARIABLE_NUMBER
  cargo:rerun-if-env-changed=SQLITE_MAX_EXPR_DEPTH
  cargo:rerun-if-env-changed=LIBSQLITE3_FLAGS
  TARGET = Some("wasm32-wasi")
  OPT_LEVEL = Some("3")
  HOST = Some("x86_64-pc-windows-msvc")
  cargo:rerun-if-env-changed=CC_wasm32-wasi
  CC_wasm32-wasi = None
  cargo:rerun-if-env-changed=CC_wasm32_wasi
  CC_wasm32_wasi = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  cargo:rerun-if-env-changed=CFLAGS_wasm32-wasi
  CFLAGS_wasm32-wasi = None
  cargo:rerun-if-env-changed=CFLAGS_wasm32_wasi
  CFLAGS_wasm32_wasi = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  running: "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-wasi" "-DSQLITE_CORE" "-DSQLITE_DEFAULT_FOREIGN_KEYS=1" "-DSQLITE_ENABLE_API_ARMOR" "-DSQLITE_ENABLE_COLUMN_METADATA" "-DSQLITE_ENABLE_DBSTAT_VTAB" "-DSQLITE_ENABLE_FTS3" "-DSQLITE_ENABLE_FTS3_PARENTHESIS" "-DSQLITE_ENABLE_FTS5" "-DSQLITE_ENABLE_JSON1" "-DSQLITE_ENABLE_LOAD_EXTENSION=1" "-DSQLITE_ENABLE_MEMORY_MANAGEMENT" "-DSQLITE_ENABLE_RTREE" "-DSQLITE_ENABLE_STAT2" "-DSQLITE_ENABLE_STAT4" "-DSQLITE_SOUNDEX" "-DSQLITE_THREADSAFE=1" "-DSQLITE_USE_URI" "-DHAVE_USLEEP=1" "-D_POSIX_THREAD_SAFE_FUNCTIONS" "-DHAVE_ISNAN" "-DHAVE_LOCALTIME_R" "-o" "C:\\Users\\peppe\\Documents\\Code\\rusqlite-test\\target\\wasm32-wasi\\release\\build\\libsqlite3-sys-855966926157e9d5\\out\\sqlite3/sqlite3.o" "-c" "sqlite3/sqlite3.c"
  cargo:warning=sqlite3/sqlite3.c:14183:10: fatal error: 'stdio.h' file not found

  cargo:warning=#include <stdio.h>

  cargo:warning=         ^~~~~~~~~

  cargo:warning=1 error generated.

  exit code: 1

  --- stderr


  error occurred: Command "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-wasi" "-DSQLITE_CORE" "-DSQLITE_DEFAULT_FOREIGN_KEYS=1" "-DSQLITE_ENABLE_API_ARMOR" "-DSQLITE_ENABLE_COLUMN_METADATA" "-DSQLITE_ENABLE_DBSTAT_VTAB" "-DSQLITE_ENABLE_FTS3" "-DSQLITE_ENABLE_FTS3_PARENTHESIS" "-DSQLITE_ENABLE_FTS5" "-DSQLITE_ENABLE_JSON1" "-DSQLITE_ENABLE_LOAD_EXTENSION=1" "-DSQLITE_ENABLE_MEMORY_MANAGEMENT" "-DSQLITE_ENABLE_RTREE" "-DSQLITE_ENABLE_STAT2" "-DSQLITE_ENABLE_STAT4" "-DSQLITE_SOUNDEX" "-DSQLITE_THREADSAFE=1" "-DSQLITE_USE_URI" "-DHAVE_USLEEP=1" "-D_POSIX_THREAD_SAFE_FUNCTIONS" "-DHAVE_ISNAN" "-DHAVE_LOCALTIME_R" "-o" "C:\\Users\\peppe\\Documents\\Code\\rusqlite-test\\target\\wasm32-wasi\\release\\build\\libsqlite3-sys-855966926157e9d5\\out\\sqlite3/sqlite3.o" "-c" "sqlite3/sqlite3.c" with args "clang" did not execute successfully (status code exit code: 1).

Also, should I be using bundled or bundled-windows?

from rusqlite.

zrus avatar zrus commented on June 21, 2024

Any updates on this?

from rusqlite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.