servo / pathfinder

A fast, practical GPU rasterizer for fonts and vector graphics
Apache License 2.0
3.52k stars 198 forks source link

remove stdsimd feature flag #548

Closed jonaspleyer closed 4 months ago

jonaspleyer commented 5 months ago

Problem

I was recently compiling the plotters crate with the nigthly compiler and got the following build error:

error[E0635]: unknown feature `stdsimd`
  --> /home/REDACTED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pathfinder_simd-0.5.2/src/lib.rs:12:49
   |
12 | #![cfg_attr(pf_rustc_nightly, feature(simd_ffi, stdsimd))]
   |                                                 ^^^^^^^

For more information about this error, try `rustc --explain E0635`.

My nightly compiler is

# rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/REDACTEDrustup

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu
nightly-2022-12-18-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)
1.58-x86_64-unknown-linux-gnu
1.75-x86_64-unknown-linux-gnu
1.62.0-x86_64-unknown-linux-gnu

active toolchain
----------------

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.78.0-nightly (f067fd608 2024-02-05)

Solution

It seems that the feature flag stdsimd is not present in the nightly compiler anymore. This patch very small patch is able to fix my problem and the package still compiles

diff --git a/simd/src/lib.rs b/simd/src/lib.rs
index cbffc2a4..89a087bd 100644
--- a/simd/src/lib.rs
+++ b/simd/src/lib.rs
@@ -9,7 +9,7 @@
 // except according to those terms.

 #![cfg_attr(pf_rustc_nightly, feature(link_llvm_intrinsics, platform_intrinsics))]
-#![cfg_attr(pf_rustc_nightly, feature(simd_ffi, stdsimd))]
+#![cfg_attr(pf_rustc_nightly, feature(simd_ffi))]

 //! A minimal SIMD abstraction, usable outside of Pathfinder.

with this stable compiler:

# rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/REDACTED.rustup

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu (default)
nightly-2022-12-18-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu
1.58-x86_64-unknown-linux-gnu
1.75-x86_64-unknown-linux-gnu
1.62.0-x86_64-unknown-linux-gnu

active toolchain
----------------

stable-x86_64-unknown-linux-gnu (default)
rustc 1.75.0 (82e1608df 2023-12-21)

Comments

I am aware that this patch affects stable upstream and do not know about the internals of this package. This patch might be obsolete depending on if the nightly version changes again in the future. I am looking forward on Feedback regarding this issue and this PR. This may also be a nightly compiler error but I do not know how to check this.

jayvdb commented 4 months ago

@jdm @mrobinson @s3bk , could you take a look at this please.

jayvdb commented 4 months ago

I noticed when https://github.com/zowens/crc32c/pull/52 did this, they also re-added another feature for aarch64, see https://github.com/zowens/crc32c/pull/54

jonaspleyer commented 4 months ago

I have just confirmed that the build also works when including the following flags:

#![cfg_attr(all(target_arch = "aarch64", nightly), feature(stdarch_arm_crc32))]

I also upated the PR accordingly.

s3bk commented 4 months ago

I would say to merge this and see if it breaks for some architecture later?

s3bk commented 4 months ago

I am going to merge this and then make a PR to fix the pdf stuff.