Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing JsValue in a proc_macro causes a compilation error on recent nightly's #120

Closed
finnbear opened this issue May 24, 2023 · 8 comments · Fixed by #123
Closed

Importing JsValue in a proc_macro causes a compilation error on recent nightly's #120

finnbear opened this issue May 24, 2023 · 8 comments · Fixed by #123

Comments

@finnbear
Copy link
Contributor

Thanks for the crate! I noticed a regression on recent Rust nightly's that causes a linker error when using stylist.

I'll work on a PR to see if JsValue can be removed for proc_macro purposes.

@futursolo
Copy link
Owner

Is this a duplicate of #114?

@finnbear
Copy link
Contributor Author

Is this a duplicate of #114?

Almost certainly yes!

universal-git added a commit to universal-git/stylist-rs that referenced this issue Jun 5, 2023
…#121

This gets rid of the compile error:
/usr/bin/ld: __wbindgen_realloc: undefined version: 
          /usr/bin/ld: __wbindgen_malloc: undefined version: 
          /usr/bin/ld: __wbindgen_free: undefined version: 
          /usr/bin/ld: __wbindgen_exn_store: undefined version: 
          /usr/bin/ld: failed to set dynamic section sizes: bad value
          collect2: error: ld returned 1 exit status
          
error: could not compile `stylist-macros` (lib) due to previous error

This is just a test-verification of the below commit by @finnbear

futursolo@9272103
@futursolo futursolo pinned this issue Jun 11, 2023
@futursolo
Copy link
Owner

I have submitted a pull request awaiting code review from @WorldSEnder.

Until this is mitigated from stylist, there is a comment in the compiler regression issue about how to mitigate the impact by switching the linker to lld until Rust compiler is fixed.

@vaassi
Copy link

vaassi commented Jun 11, 2023

solution with lld doesn't work for me but adding this in Cargo.toml with rust 1.70 helps me to solve this issue

[profile.dev.package.wasm-bindgen]
debug-assertions = false

BrooksPatton added a commit to brooks-builds/lms that referenced this issue Jun 15, 2023
BrooksPatton added a commit to brooks-builds/lms that referenced this issue Jun 15, 2023
* wip - creating next buttons for articles

* wip marking user articles as started

* marking user article complete when hitting the button

* marking articles as completed at load

* wip - marking the completed articles completed live and not just in database. Probably need to do an upsert or something else

* marking articles as started and completed at the right times

* fixed errors and warningsO

* using latest ycl

* fixed clippy warnings

* running cargo check only on this library

* fixing bug due to futursolo/stylist-rs#120

* using an older version of rust

* fixed cargo formatting problem

* fixed cargo formatting problem
@rambip
Copy link

rambip commented Jun 24, 2023

Same error here, I can't compile stylist.
Im on rust 1.70

@rambip
Copy link

rambip commented Jun 24, 2023

After going back to rust 1.69, I can confirm that it is a version issue (it worked with 1.69)

futursolo added a commit that referenced this issue Jun 25, 2023
* Fix #120 - don't compile in JsValue in proc_macro.

* Different approach - don't compile in JsValue outside wasm32.

* Restore \n at EOF.

* Use features to workaround proc macro linker error.

* Fix browser tests.

* Fix feature flags.

* Update documentation.

* Update documentation.

* Adjust documentation.

* Adjust documentation.

* Adjust documentation.

---------

Co-authored-by: Finn Bear <[email protected]>
@futursolo
Copy link
Owner

Stylist v0.12.1 has been released, which should also mitigate this issue from within stylist.
Affected users can run cargo update in their projects and it should pick up the new version automatically.

@futursolo
Copy link
Owner

This current workaround has a couple requirements:

  1. For single crate applications, you need to use edition 2021.
  2. For applications inside a workspace, you need to enable cargo resolver 2. (See Error when compiling with stylist 0.12.1 in workspaces #129)

In addition, since Rust 1.72 has fixed this regression and this workaround is no longer needed, I do plan to remove the workaround.

The current plan is once 1.72 has been released for 6 months, we bump the MSRV requirement to 1.72 to avoid this regression and remove the workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants