rust-cross / cargo-zigbuild

Compile Cargo project with zig as linker
MIT License
1.45k stars 52 forks source link

Force a generic cpu build? #150

Closed cgbur closed 1 year ago

cgbur commented 1 year ago

I am using this in a build system and want to be sure that the x86 artifacts are as generic as possible to work on any cpu. Currently when I inspect the build log I see that cargo is using the following

CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")

and then in the zig cc....sh execution I see

"-march=core2" "-msse" "-mfpmath=sse"

Is this the default and expected on every cpu at this point? Is there a way to specify that is should be more generic.

messense commented 1 year ago

You can probably tweak RUSTFLAGS/CFLAGS and etc to achieve that and I think you need to build your own libstd too since the default one was compiled with sse enabled.