Skip to content

Can't build duckdb-wasm from source #2023

Open
@Tishj

Description

@Tishj

What happens?

The instructions on the README.md are not working.

-- Build files have been written to: duckdb-wasm/build/relsize/eh
+ emmake make -Cduckdb-wasm/build/relsize/eh -j12 duckdb_wasm
make: make -Cduckdb-wasm/build/relsize/eh -j12 duckdb_wasm
make[1]: *** No rule to make target `duckdb_wasm'.  Stop.

The build_loadable: recipe has GEN=ninja, this results in creating a build.ninja file in these folders, not a Makefile

I've fixed this by commenting out export GEN=ninja from my ~/.zshrc and also removing the GEN=ninja from the build_loadable recipe

That results in reaching the next error:

duckdb-wasm/lib/src/config.cc:66:37: error: no matching member function for call to 'Parse'
   66 |     rapidjson::ParseResult ok = doc.Parse(args_json.begin(), args_json.size());
      |                                 ~~~~^~~~~
duckdb-wasm/build/relsize/eh/third_party/rapidjson/install/include/rapidjson/document.h:2744:22: note: candidate function not viable: no known conversion from 'const_iterator' (aka '__wrap_iter<const char *>') to 'const Ch *' (aka 'const char *') for 1st argument
 2744 |     GenericDocument& Parse(const Ch* str, size_t length) {
      |                      ^     ~~~~~~~~~~~~~
duckdb-wasm/build/relsize/eh/third_party/rapidjson/install/include/rapidjson/document.h:2731:22: note: candidate template ignored: couldn't infer template argument 'parseFlags'
 2731 |     GenericDocument& Parse(const typename SourceEncoding::Ch* str, size_t length) {
      |                      ^
duckdb-wasm/build/relsize/eh/third_party/rapidjson/install/include/rapidjson/document.h:2740:22: note: candidate template ignored: couldn't infer template argument 'parseFlags'
 2740 |     GenericDocument& Parse(const Ch* str, size_t length) {
      |                      ^
duckdb-wasm/build/relsize/eh/third_party/rapidjson/install/include/rapidjson/document.h:2708:22: note: candidate function template not viable: requires single argument 'str', but 2 arguments were provided
 2708 |     GenericDocument& Parse(const typename SourceEncoding::Ch* str) {
      |                      ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
duckdb-wasm/build/relsize/eh/third_party/rapidjson/install/include/rapidjson/document.h:2719:22: note: candidate function template not viable: requires single argument 'str', but 2 arguments were provided
 2719 |     GenericDocument& Parse(const Ch* str) {
      |                      ^     ~~~~~~~~~~~~~
duckdb-wasm/build/relsize/eh/third_party/rapidjson/install/include/rapidjson/document.h:2726:22: note: candidate function not viable: requires single argument 'str', but 2 arguments were provided
 2726 |     GenericDocument& Parse(const Ch* str) {
      |                      ^     ~~~~~~~~~~~~~
1 error generated.
make[4]: *** [CMakeFiles/duckdb_web.dir/src/config.cc.o] Error 1
make[4]: *** Waiting for unfinished jobs....
duckdb-wasm/lib/src/json_parser.cc:901:18: error: no matching member function for call to 'Parse'
  901 |         json_doc.Parse<rapidjson::kParseNanAndInfFlag>(json.begin(), json.size());
      |         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
duckdb-wasm/build/relsize/eh/third_party/rapidjson/install/include/rapidjson/document.h:2740:22: note: candidate function template not viable: no known conversion from 'const_iterator' (aka '__wrap_iter<const char *>') to 'const Ch *' (aka 'const char *') for 1st argument
 2740 |     GenericDocument& Parse(const Ch* str, size_t length) {
      |                      ^     ~~~~~~~~~~~~~
duckdb-wasm/build/relsize/eh/third_party/rapidjson/install/include/rapidjson/document.h:2731:22: note: candidate template ignored: couldn't infer template argument 'SourceEncoding'
 2731 |     GenericDocument& Parse(const typename SourceEncoding::Ch* str, size_t length) {
      |                      ^
duckdb-wasm/build/relsize/eh/third_party/rapidjson/install/include/rapidjson/document.h:2708:22: note: candidate function template not viable: requires single argument 'str', but 2 arguments were provided
 2708 |     GenericDocument& Parse(const typename SourceEncoding::Ch* str) {
      |                      ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
duckdb-wasm/build/relsize/eh/third_party/rapidjson/install/include/rapidjson/document.h:2719:22: note: candidate function template not viable: requires single argument 'str', but 2 arguments were provided
 2719 |     GenericDocument& Parse(const Ch* str) {
      |                      ^     ~~~~~~~~~~~~~
1 error generated.
make[4]: *** [CMakeFiles/duckdb_web.dir/src/json_parser.cc.o] Error 1
make[3]: *** [CMakeFiles/duckdb_web.dir/all] Error 2
make[2]: *** [CMakeFiles/duckdb_wasm.dir/rule] Error 2
make[1]: *** [duckdb_wasm] Error 2
emmake: error: 'make -Cduckdb-wasm/build/relsize/eh -j12 duckdb_wasm' failed (returned 2)
make: *** [build_loadable] Error 1

These two issues (GEN=ninja breaking and the Parse method not accepting the iterator returned from .begin()) are fixed by #2024

Summary of remaining issues:

  • make apply_patches + make serve are not sufficient to build successfully
  • emsdk version should be locked to 3.1.69-3.1.71
  • Install instructions for emsdk are missing:
git clone https://github.com/emscripten-core/emsdk.git ~/emsdk
~/emsdk install 3.1.69
~/emsdk activate 3.1.69
echo 'source "~/emsdk/emsdk_env.sh"' >> $HOME/.bash_profile
  • Install instructions for yarn are missing: sudo npm install -g yarn
  • Install instructions for js-beautify are missing: sudo apt install node-js-beautify (on ubuntu)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions