-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i686-unknown-linux-musl gives builds sizeof(int64_t) == 4 on 64-bit hosts #436
Comments
Hm it looks like we're already passing all the right flags, so is there much we can do here other than providing a more first-class error? |
I agree that not much can be done besides raising an error. I suggested above checking the output of echo '#include <stdint.h>\ntypedef unsigned char validate_uint64[sizeof(uint64_t) == 8 ? 1 : -1];' > test.c
musl-gcc <args> -S -o /dev/null test.c I think most crates using cc (how many assert the size of uint64_t??), in most environments, will currently silently miscompile when cross-compiling to Personally I'd be in favour of adding it as a general sanity check for all targets here, implemented in a similar way to What are your thoughts? Is it worth doing, and if so only for 32bit musl, for all musl, or for all targets? |
Ok sounds like if we were to do this it'd be a sanity check compile, but even that seems like it's sort of a lot to do with this crate. I definitely agree it's something real bad to run into, but I'm not sure how this can be handled robustly across platforms and targets, this is sort of just a "c compilers are hard" place I think |
I feel similarly, but for me the upsides outweight the downsides. As a "worst case" example, A sanity test compile takes 5-30ms on my machines. I can't think of a scenario where this crate doing such a test compile would provide a false negative. Where are you thinking it wouldn't be robust? And would it be okay to provide an opt-out env flag for these scenarios? |
I personally would prefer to not maintain this in this crate, it runs the risk of being a pretty sprawling piece of logic to what's an already sprawling crate. It'd be great if an extension on crates.io could be published which can be combined with |
See for example this assertion raised by the miniz-sys crate on a stock 64-bit ubuntu machine:
I don't know if or where this should be fixed?
musl-gcc
encodes the target triple (in my casex86_64-linux-musl
) so an i386 version ofmusl-gcc
needs to be installed and used.Perhaps asserting on
musl-gcc -v 2>&1 | grep Target
would be useful? I was getting silent corruption of data with the zstd crate; a build error would be much preferred.The text was updated successfully, but these errors were encountered: