Skip to content

wasm-pack: crate-type must be cdylib to compile to wasm  #38

Open

Description

@tiero
$ wasm-pack build --target web .
Error: crate-type must be cdylib to compile to wasm32-unknown-unknown. Add the following to your Cargo.toml file:

[lib]
crate-type = ["cdylib", "rlib"]

Activity

  1. apoelstra commented on Dec 19, 2022

    @apoelstra
    Member

    I'll look into this, and see if I can't get a wasm-pack CI job working, at least locally.

    15:22:48 -bash@camus ~/code/ElementsProject/elements-miniscript/master 5430285$ wasm-pack test --node
    Segmentation fault (core dumped)
    

    kek.

  2. apoelstra commented on Dec 19, 2022

    @apoelstra
    Member

    Looks like the segfault is in curl:

    15:25:55 -bash@camus ~/code/ElementsProject/elements-miniscript/master 5430285$ valgrind wasm-pack test --node
    ==23741== Memcheck, a memory error detector
    ==23741== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
    ==23741== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
    ==23741== Command: wasm-pack test --node
    ==23741== 
    [INFO]: Checking for the Wasm target...
    ==23741== Thread 2:
    ==23741== Invalid read of size 8
    ==23741==    at 0x4F6F9D8: OPENSSL_sk_value (in /usr/lib/libcrypto.so.3)
    ==23741==    by 0x4F980BA: X509_STORE_add_lookup (in /usr/lib/libcrypto.so.3)
    ==23741==    by 0x4F9B950: X509_STORE_load_file_ex (in /usr/lib/libcrypto.so.3)
    ==23741==    by 0x48F9790: ossl_connect_step1 (openssl.c:3362)
    ==23741==    by 0x48FF886: ossl_connect_common (openssl.c:4059)
    ==23741==    by 0x48FC0A8: UnknownInlinedFun (vtls.c:371)
    ==23741==    by 0x48FC0A8: Curl_ssl_connect_nonblocking (vtls.c:354)
    ==23741==    by 0x48B1E95: UnknownInlinedFun (http.c:1650)
    ==23741==    by 0x48B1E95: Curl_http_connect (http.c:1576)
    ==23741==    by 0x48D1985: UnknownInlinedFun (multi.c:1773)
    ==23741==    by 0x48D1985: multi_runsingle (multi.c:2089)
    ==23741==    by 0x48D3F1D: curl_multi_perform (multi.c:2682)
    ==23741==    by 0x48A981B: UnknownInlinedFun (easy.c:663)
    ==23741==    by 0x48A981B: UnknownInlinedFun (easy.c:753)
    ==23741==    by 0x48A981B: curl_easy_perform (easy.c:772)
    ==23741==    by 0x293823: wasm_pack::manifest::Crate::return_api_call_result (in /store/home/apoelstra/.cargo/bin/wasm-pack)
    ==23741==    by 0x2934E4: wasm_pack::manifest::Crate::return_wasm_pack_latest_version (in /store/home/apoelstra/.cargo/bin/wasm-pack)
    ==23741==  Address 0x158b78d48000001 is not stack'd, malloc'd or (recently) free'd
    ==23741== 
    ==23741== 
    ==23741== Process terminating with default action of signal 11 (SIGSEGV): dumping core
    ==23741==  Access not within mapped region at address 0x18EC8348
    ==23741==    at 0x4F6F9D8: OPENSSL_sk_value (in /usr/lib/libcrypto.so.3)
    ==23741==    by 0x4F980BA: X509_STORE_add_lookup (in /usr/lib/libcrypto.so.3)
    ==23741==    by 0x4F9B950: X509_STORE_load_file_ex (in /usr/lib/libcrypto.so.3)
    ==23741==    by 0x48F9790: ossl_connect_step1 (openssl.c:3362)
    ==23741==    by 0x48FF886: ossl_connect_common (openssl.c:4059)
    ==23741==    by 0x48FC0A8: UnknownInlinedFun (vtls.c:371)
    ==23741==    by 0x48FC0A8: Curl_ssl_connect_nonblocking (vtls.c:354)
    ==23741==    by 0x48B1E95: UnknownInlinedFun (http.c:1650)
    ==23741==    by 0x48B1E95: Curl_http_connect (http.c:1576)
    ==23741==    by 0x48D1985: UnknownInlinedFun (multi.c:1773)
    ==23741==    by 0x48D1985: multi_runsingle (multi.c:2089)
    ==23741==    by 0x48D3F1D: curl_multi_perform (multi.c:2682)
    ==23741==    by 0x48A981B: UnknownInlinedFun (easy.c:663)
    ==23741==    by 0x48A981B: UnknownInlinedFun (easy.c:753)
    ==23741==    by 0x48A981B: curl_easy_perform (easy.c:772)
    ==23741==    by 0x293823: wasm_pack::manifest::Crate::return_api_call_result (in /store/home/apoelstra/.cargo/bin/wasm-pack)
    ==23741==    by 0x2934E4: wasm_pack::manifest::Crate::return_wasm_pack_latest_version (in /store/home/apoelstra/.cargo/bin/wasm-pack)
    ==23741==  If you believe this happened as a result of a stack
    ==23741==  overflow in your program's main thread (unlikely but
    ==23741==  possible), you can try to increase the size of the
    ==23741==  main thread stack using the --main-stacksize= flag.
    ==23741==  The main thread stack size used in this run was 8388608.
    ==23741== 
    ==23741== HEAP SUMMARY:
    ==23741==     in use at exit: 1,360,933 bytes in 16,994 blocks
    ==23741==   total heap usage: 18,502 allocs, 1,508 frees, 2,975,435 bytes allocated
    ==23741== 
    ==23741== LEAK SUMMARY:
    ==23741==    definitely lost: 0 bytes in 0 blocks
    ==23741==    indirectly lost: 0 bytes in 0 blocks
    ==23741==      possibly lost: 289,449 bytes in 4,576 blocks
    ==23741==    still reachable: 1,071,484 bytes in 12,418 blocks
    ==23741==         suppressed: 0 bytes in 0 blocks
    ==23741== Rerun with --leak-check=full to see details of leaked memory
    ==23741== 
    ==23741== For lists of detected and suppressed errors, rerun with: -s
    ==23741== ERROR SUMMARY: 2 errors from 1 contexts (suppressed: 0 from 0)
    Segmentation fault (core dumped)
    

    There are a couple segfault issues on the wasm-pack repo which I think this may be an instance of.

    I don't have time to chase this down, sorry. Somebody else can take this over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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