Comments (21)
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.
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.
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.
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.
@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.
@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.
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.
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.
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.
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.
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.
@twitchax that's because wasm isn't supported.
from socket2.
@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.
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.
I'm closing this in favour of #268 to track wasm support.
from socket2.
@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 inwasm
targets due to the lack of support here. For example, I am testing how feasible it would be to use a project likewarp
orrocket
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.
I have the same issue.
How can I handle this?
from socket2.
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.
windows 10 64bit.
from socket2.
from socket2.
This is the error that I get after running "cargo test"
from socket2.
Related Issues (20)
- Add CI support for ESP-IDF
- msghdr as a private field in MsgHdr/MsgMutHdr HOT 2
- Set Socket interface using interface index HOT 1
- What happened to the `RAW` socket type? HOT 1
- Question: Possible to support architectures that only provide the `std::net` interface (and only TCP)? HOT 4
- Windows: `sa_family_t` should use `ADDRESS_FAMILY` from `windows-sys` HOT 5
- nonblocking connect HOT 6
- Set `ss_len` when creating `SockAddr` from std HOT 1
- Why cannot find WASStartup and WSACleanup in source code? HOT 7
- bind_device succeeds, but subsequent sends fail with no such device or address. HOT 5
- QUESTION: How to special `laddr` when dialing connection? HOT 3
- Android support HOT 3
- don'tassign8080 port
- Currently socket2 has no way to set the DF bit on packets. The attached patch adds it. HOT 3
- Error: BoxSend(Os { code: 98, kind: AddrInUse, message: "Address already in use" }) HOT 2
- How to read EventExtra from the event? HOT 2
- socket() always fails on WSL1 due to unsupported SOCK_CLOEXEC flag HOT 5
- Support for {recv,send}mmsg HOT 2
- New release HOT 1
- socket error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from socket2.