Git Product home page Git Product logo

Comments (9)

pacak avatar pacak commented on June 18, 2024 1

Made a ticket upstream, we'll see.

from cargo-show-asm.

pacak avatar pacak commented on June 18, 2024

Try passing -vvv for more details

from cargo-show-asm.

pacak avatar pacak commented on June 18, 2024

https://github.com/pacak/cargo-show-asm/blob/master/src/main.rs#L334 - it happens around here, if c-s-a detects an artifact of cdylib type - it tries to find it and fails if it's not compiled. I wonder if wasm changes something.

from cargo-show-asm.

pacak avatar pacak commented on June 18, 2024

Can you make a smaller reproduction?

from cargo-show-asm.

pacak avatar pacak commented on June 18, 2024

Managed to reproduce something similar, did some experiments. With crate-type = ["cdylib", "lib"] rustc creates an .s file but it's mostly empty and doesn't contain a test function I added in lib.rs. A better reproduction might help. I suspect rust compiler or cargo handles ["cdylib"] in a special way, I don't know much about it though. Removing ["cdylib"] makes it work as expected.

I can revisit this again if you give me a smaller reproduction that does what you want it to do. Or once I know more about wasm.

from cargo-show-asm.

cwbhhjl avatar cwbhhjl commented on June 18, 2024

Try passing -vvv for more details

This is the execution result of cargo asm with the -vvv option.

 Running `CARGO=/Users/oker/.rustup/toolchains/nightly-2022-11-23-x86_64-apple-darwin/bin/cargo CARGO_CRATE_NAME=mylib_wasm CARGO_MANIFEST_DIR=/Users/oker/code/github/okex/mylib-wasm/core/lib/mylib CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=mylib_wasm CARGO_PKG_REPOSITORY='' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 DYLD_FALLBACK_LIBRARY_PATH='/Users/oker/code/github/okex/mylib-wasm/target/release/deps:/Users/oker/.rustup/toolchains/nightly-2022-11-23-x86_64-apple-darwin/lib:/Users/oker/.rustup/toolchains/nightly-2022-11-23-x86_64-apple-darwin/lib:/Users/oker/lib:/usr/local/lib:/usr/lib' rustc --crate-name mylib_wasm --edition=2021 core/lib/mylib/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type cdylib --crate-type lib --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no --emit asm -Ccodegen-units=1 -Cdebuginfo=2 --cfg 'feature="zkwasm"' -C metadata=5587bcb9bccba4e1 --out-dir /Users/oker/code/github/okex/mylib-wasm/target/wasm32-unknown-unknown/release/deps --target wasm32-unknown-unknown -L dependency=/Users/oker/code/github/okex/mylib-wasm/target/wasm32-unknown-unknown/release/deps -L dependency=/Users/oker/code/github/okex/mylib-wasm/target/release/deps --extern num_bigint=/Users/oker/code/github/okex/mylib-wasm/target/wasm32-unknown-unknown/release/deps/libnum_bigint-cde64e92b534153f.rlib --extern num_traits=/Users/oker/code/github/okex/mylib-wasm/target/wasm32-unknown-unknown/release/deps/libnum_traits-7c1a02c2bc62590b.rlib --extern primitive_types=/Users/oker/code/github/okex/mylib-wasm/target/wasm32-unknown-unknown/release/deps/libprimitive_types-4d1b4aca39aff137.rlib --extern sha3=/Users/oker/code/github/okex/mylib-wasm/target/wasm32-unknown-unknown/release/deps/libsha3-3b9b8ba422f4e373.rlib --extern static_assertions=/Users/oker/code/github/okex/mylib-wasm/target/wasm32-unknown-unknown/release/deps/libstatic_assertions-b3ca28a0812ddf16.rlib --extern wasm_bindgen=/Users/oker/code/github/okex/mylib-wasm/target/wasm32-unknown-unknown/release/deps/libwasm_bindgen-8aab294c2d7bc213.rlib --extern zkwasm_rust_sdk=/Users/oker/code/github/okex/mylib-wasm/target/wasm32-unknown-unknown/release/deps/libzkwasm_rust_sdk-3ad1d5222296d6ea.rlib`

Artifact files: [    Finished release [optimized] target(s) in 10.55s
"/Users/oker/code/github/okex/mylib-wasm/target/wasm32-unknown-unknown/release/mylib_wasm.wasm", "/Users/oker/code/github/okex/mylib-wasm/target/wasm32-unknown-unknown/release/libmylib_wasm.rlib"]
thread 'main' panicked at 'No cdylib?', /Users/oker/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-show-asm-0.2.21/src/main.rs:342:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

from cargo-show-asm.

cwbhhjl avatar cwbhhjl commented on June 18, 2024

Can you make a smaller reproduction?

https://github.com/cwbhhjl/cargo-asm-wasm-test

I tried creating a small project following the structure of my main project, and can reproduce the same issue.

from cargo-show-asm.

cwbhhjl avatar cwbhhjl commented on June 18, 2024

Managed to reproduce something similar, did some experiments. With crate-type = ["cdylib", "lib"] rustc creates an .s file but it's mostly empty and doesn't contain a test function I added in lib.rs. A better reproduction might help. I suspect rust compiler or cargo handles ["cdylib"] in a special way, I don't know much about it though. Removing ["cdylib"] makes it work as expected.

I can revisit this again if you give me a smaller reproduction that does what you want it to do. Or once I know more about wasm.

Wow, after changing the lib type from ["cdylib", "lib"] to ["lib"], cargo asm can show wasm instructions. However, at this point, I can no longer generate wasm for my project using wasm-pack. It prompts me to add the cdylib type in the toml file.

from cargo-show-asm.

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.