Replies: 9 comments 3 replies
-
|
I saw that the Rustls issue was closed, AFAICT based on the deduction that the C compiler must be configured to be targeting the wrong CPU architecture. WDYT about that?
Which C compiler, and which version, is used in this case?
It's unlikely I would make progress debugging issues the result from compiling with xwin. It would be nice to support using clang as the C compiler when targeting -msvc, regardless. But I've not tried it yet. I always recommend to use the MSVC C compiler.
When investigating this issue I refactored the conditional logic regarding ADX and so your link now points to the wrong place, I think. I think you meant to point to the call to Regardless, the ADX code is guarded on: So, I don't think the issue is that the ADX code is being used, unless there is something very wrong with the toolchain in use. |
Beta Was this translation helpful? Give feedback.
-
I think that assumption is incorrect because I have checked this further. The idea was that either I have a new CPU and Rust is compiling with such instructions, or my build configuration is set up incorrectly. In the Rustls examples I provided, there are no extra dependencies or special settings, so that cannot be the cause. Regarding my architecture, I specifically tried downgrading packages and rebuilding everything, and I also disabled certain instructions. However, nothing helped except using the debug flag on MSVC. On the GNU toolchain, nothing works to resolve this. Therefore, the assumption that I did something wrong is not accurate. Moreover, I am not a Rustls user myself — it is used by the iroh library, and the same issue happens there through the dependency chain. In other words, if it breaks both in a clean example and in a larger library, it is quite incorrect to conclude that this is due to a mistake on my part.
As I mentioned, the GNU build fails completely with this error, while the MSVC build works, but only in debug mode without this error. clang version 21.1.8 I have the latest versions in this regard, and I haven’t encountered any issues with them—neither when building anything nor with other Rust packages.
xwin works perfectly everywhere; I switched to it because in debug it doesn’t have this error. I usually used GNU, but it doesn’t work here at all. Also regarding xwin, as far as I know it handles MSVC completely correctly, just as if it were the original. I mean that of all the possible options, this is the best available when not running on actual Windows. The problem is that I’m not a Windows user, and that’s a big issue if you can’t build ring for it, since other libraries break.
Yes, when I got the error, I just noticed that: And then I immediately went and found this in the code to make it easier for you to understand what's there.
Actually, I’m not really an expert in this area. As far as I understand, it’s just calling something that shouldn’t be called, right? It’s also strange that GNU doesn’t work at all, while xwin MSVC only fails in debug. Again, it’s strange that GNU doesn’t work at all, while xwin MSVC only works in debug. And again, it can’t be a toolchain error, because all my libraries have always compiled successfully. I mean, in several years, this is literally the first error on xwin or GNU-Windows. |
Beta Was this translation helpful? Give feedback.
-
|
It doesn't make sense that |
Beta Was this translation helpful? Give feedback.
-
|
I see the system that it is failing on is "Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz". What system is the compilation happening on? Does it happen to be an AMD CPU? |
Beta Was this translation helpful? Give feedback.
-
Yes, my main build system is an AMD Ryzen 7 5800X, it is a modern x86-64 processor. But again, there are no specific settings for it. That is, when I build with GNU or xwin MSVC and manually remove all flags for this processor and so on — nothing helps. However, debug mode does help. I have a suspicion that ring compiles this exactly this way during compilation. That is, it is its own peculiarity. For example, if I use aws-lc-rs in rustls, then as far as I understand it is determined dynamically for the processor on which it will be run, and there are no problems either on GNU or on xwin. So it is quite strange if we assume that this is a processor problem and again a build configuration issue. |
Beta Was this translation helpful? Give feedback.
-
|
Look for something that is configuring the
|
Beta Was this translation helpful? Give feedback.
-
|
Perhaps this problem is caused by the cc-rs version in use. Can you try different versions of cc-rs? See rust-lang/cc-rs#1469 for an example of an issue filed against cc-rs that could easily result in the kind of behavior you are seeing. |
Beta Was this translation helpful? Give feedback.
-
|
I’ve figured out the problem — it’s an issue with ring, if it can be called that. Again, in aws-lc-rs it works because, as far as I understand, it determines this dynamically at runtime. In ring, the problem arises due to the use of cc or something similar. That is, when I build ring with GNU or MSVC on Windows, it uses AMD C flags, and we could see exactly the commands that shouldn’t have been there. This is not an issue with xwin; it just downloads:
This is also not a Rust problem, because in its settings, in the minimal example, no build flags were used, or I tried disabling them. That also did not affect the build. That is, ring uses my system C flags, which is rather unfortunate because it causes cascading library errors. In other words, this is the only one out of 500+ libraries that broke in this way, and the only one in many years of my using Rust for building on Windows. So right now, you can only:
This needs to be done only for this library; there’s currently no other way to manually help the ring library. You can also use aws-lc-rs as a fallback. In fact, it shouldn’t have used my system settings — in my opinion, this is a library issue. I mean, I know for sure that when you use something like this in your library, you could remove these flags. Or, alternatively, the library should warn users that there’s such a gap and that they need to adjust it manually. But no one, including rustls, has ever done that — and that’s exactly why it caused a chain error, all the way up to a major networking library. Yes, I debugged it like this: These are my system flags — they shouldn’t be used during the build. At the very least, Rust has its own flags, or the library should warn about this. And you can check for the instructions like this:
Therefore, the issue has been resolved on my side. From here, it depends on how you want to handle this issue on your side:
Again, I want to note that in other libraries this was either automatically handled and did not cause errors over the years in Rust, or it was explicitly mentioned. Here, this practice was absent, and everything simply failed one after another. That is, if 500+ packages built correctly everywhere else, here a single package simply does not build correctly in this regard. In my opinion, this is a library issue. Once again, thank you for helping me debug this error; I really appreciate your help and your time. |
Beta Was this translation helpful? Give feedback.
-
|
Thank you. I do agree that how |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I'm not an expert in networking, but there is an error that I believe I have fairly accurately debugged for Windows.
I am following the chain and have so far stopped here, as this is the last thing I found regarding this error. I have already created an issue in rustls #2943 so that they are aware that this problem affects them.
Here is a simple test example:
cargo:
In this code, C5 will not be triggered because there is an error in the code. Here and in rustls, this is not visible just like that; in some cases, it results in an infinite loop. That's why I am debugging the old way via console outputs + ctz suggested making a dump, and it helped to find the error.
This is through WinDbg. The error itself:
I am again not an expert, but it seems that it failed to process some instruction?
In ring, this is located here
This problem occurs with a GNU build via
cargo build --release --target x86_64-pc-windows-gnuOr with an MSVC xwin build via:
But on MSVC in debug the problem does not occur.
The system on which I tested:
I am also attaching the files:
(Yes, don't mind that it's called rustlsCheck.exe, I just didn't rename the project)
ringDumpFiles.zip
updated: I tried changing my build flags to disable instructions and so on – it didn’t help, even though ctz claimed that it would solve the problem. The only thing that helps is switching to aws-lc-rs or using a debug build for ring.
Beta Was this translation helpful? Give feedback.
All reactions