GithubHelp home page GithubHelp logo

Comments (21)

twitchax avatar twitchax commented on June 22, 2024 7

As far as I can tell, this is still an issue. socket2 fails to compile on wasm becaause the sys module is only imported for a unix or windows target.

from socket2.

justinmchase avatar justinmchase commented on June 22, 2024 3

Sorry, I think I just closed it because I didn't want to see it in my list of open issues anymore and nobody seemed to care about it.

from socket2.

Neo-Ciber94 avatar Neo-Ciber94 commented on June 22, 2024 3

I ended using something like this, it works but in others cases it fails not sure why

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { version = "1", features = ["full"] }
async-trait = "0.1.57"
actix-web = "4"
stdweb = "0.4.20"

from socket2.

Thomasdezeeuw avatar Thomasdezeeuw commented on June 22, 2024 3

Please don't post text as a image, you can put multiple lines line that between "```" to create a code block, see https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks.

The error shown in image seems related to wasm/axum, not Socket2. But if you're pulling in socket2 I'm sorry to say that it won't work for now as we don't support wasm, see #268.

from socket2.

twitchax avatar twitchax commented on June 22, 2024 1

@Thomasdezeeuw, I was mostly commenting because this issue was closed without explanation. That would have been a helpful note to people who come across this issue. :)

from socket2.

twitchax avatar twitchax commented on June 22, 2024 1

@justinmchase, haha, no problem.

I think it is still something that would be nice. There are a lot of projects that rely on socket2 that cannot be used in wasm targets due to the lack of support here. For example, I am testing how feasible it would be to use a project like warp or rocket in Rust-based CloudFlare Workers.

from socket2.

justinmchase avatar justinmchase commented on June 22, 2024

This line appears to vary from master:
https://github.com/alexcrichton/socket2-rs/blob/ca89d63b87f4ec62f059caa1d9379c0dc8f1cd2b/src/lib.rs#L72

When I do a simple cfg check in my own app it appears to be resolved as "unix" so I'm not sure why this is failing.

Any workarounds welcome.

from socket2.

alexcrichton avatar alexcrichton commented on June 22, 2024

Thanks for the report! This crate needs to add some stubs for the wasm target that all return errors, but otherwise shouldn't be too hard to add.

from socket2.

murtyjones avatar murtyjones commented on June 22, 2024

I'm getting this error too in a project of my own, and it's kind of mysterious because it seemed to come out of nowhere and when I run wasm-pack build in other projects, it works.

this person seems to have found a workaround but I couldn't figure out what it was.

@justinmchase did you find a workaround?

from socket2.

justinmchase avatar justinmchase commented on June 22, 2024

I was not able to other than to not use the library that depended on this. I looked at it for a while and I bet there is a way but I'm not familiar enough with Rust to figure it out yet.

For what it's worth I was using WSL on windows but after a bunch of tests it seems like Rust correctly interprets it as unix and there wasn't a problem with the conditional compilation macros in smaller independent tests.

from socket2.

 avatar commented on June 22, 2024

I think I am getting a similar error. I'm using a library that depends on socket for a WASM project.

error[E0432]: unresolved import crate::sys --> C:\Users\Thomas\.cargo\registry\src\github.com-1ecc6299db9ec823\socket2-0.3.12\src\socket.rs:23:5
|
23 | use crate::sys;
| ^^^^^^^^^^ no sys in the root

from socket2.

Thomasdezeeuw avatar Thomasdezeeuw commented on June 22, 2024

@twitchax that's because wasm isn't supported.

from socket2.

Thomasdezeeuw avatar Thomasdezeeuw commented on June 22, 2024

@Thomasdezeeuw, I was mostly commenting because this issue was closed without explanation. That would have been a helpful note to people who come across this issue. :)

To be fair the issuer closed it, not the maintainers but I understand. We should probably add a compile_error for unsupported targets to make it clear from the error message.

from socket2.

damirka avatar damirka commented on June 22, 2024

Can confirm that it is an issue for some (if not many) people. I wonder if there is a way to nicely disable or put a placeholder for unsupported targets, so this functionality is disabled, but not blocking compilation of other crates. 🤔

from socket2.

Thomasdezeeuw avatar Thomasdezeeuw commented on June 22, 2024

I'm closing this in favour of #268 to track wasm support.

from socket2.

PDFergus avatar PDFergus commented on June 22, 2024

@justinmchase, haha, no problem.

I think it is still something that would be nice. There are a lot of projects that rely on socket2 that cannot be used in wasm targets due to the lack of support here. For example, I am testing how feasible it would be to use a project like warp or rocket in Rust-based CloudFlare Workers.

Yeah I just found out by nasty Surprise after integrating my Database calls to the front end only to find out that although the queries are crafted correctly that the database structure I am using may in fact use Socket2 nested deep down in its dependency structure, specifically in the aws_auth_sdk. So if you are using any data from an amazon authenticated source, you may be at the migration point.

oh well back to the drawing board I guess. Maybe I will give SurealDB a shot.

from socket2.

NazarKhlopeniuk avatar NazarKhlopeniuk commented on June 22, 2024

I have the same issue.
How can I handle this?

from socket2.

Thomasdezeeuw avatar Thomasdezeeuw commented on June 22, 2024

I have the same issue. How can I handle this?

@NazarKhlopeniuk what platform are you using? If you're using wasm you can help in #268.

from socket2.

NazarKhlopeniuk avatar NazarKhlopeniuk commented on June 22, 2024

windows 10 64bit.

from socket2.

NazarKhlopeniuk avatar NazarKhlopeniuk commented on June 22, 2024

image

from socket2.

NazarKhlopeniuk avatar NazarKhlopeniuk commented on June 22, 2024

This is the error that I get after running "cargo test"

from socket2.

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.