Skip to content

mem flag not honored #89

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

Closed
steveyko opened this issue Aug 4, 2020 · 2 comments
Closed

mem flag not honored #89

steveyko opened this issue Aug 4, 2020 · 2 comments

Comments

@steveyko
Copy link

steveyko commented Aug 4, 2020

I am cross-compiling a Rust library for aarch64-unknown-none-softfloat and it does not look like 'memcpy = false' in Cargo.toml is honored anymore. I have a libc that I'm using for my platform. Now when I'm linking things together my build script throws 'multiple definition of `memcpy'' etc.

This was working a few months ago (probably March or April) but now I came back to it, it does not work anymore.

I have updated my toolchain to the latest nightly as follows:

rustup 1.22.1 (2020-07-08)
rustc 1.47.0-nightly (2020-07-26)
cargo 1.47.0-nightly (2020-07-23)

Unfortunately, I don't have a log of which versions I was using when it was working.

I have tried different versions of cargo-xbuild, v0.5.20, v0.5.35, v0.6.0, etc.

v0.6.0 fails for a different reason (#88), but other versions all seem to include memcpy, etc.

I don't know if this is an issue with cargo-xbuild or compiler-builtins as it looks like compiler-builtins v0.1.32 is used now, which is probably a different version from what I was using before (though I don't know which version I was using when it was working for me).

Any help on this would be much appreciated.

@phil-opp
Copy link
Member

phil-opp commented Aug 5, 2020

If you don't need the mem feature: Have you tried using cargo's own build-std flag? It already works great for most projects, so maybe it works for you too. See https://github.com/rust-osdev/cargo-xbuild#alternative-the-build-std-feature-of-cargo for migration instructions.

I don't know what could cause the issue you're seeing. Our implementation still honors the memcpy flag when enabling the features of compiler_builtins: https://github.com/rust-osdev/cargo-xbuild/blob/master/src/sysroot.rs#L175-L179 . The mem feature of compiler_builtins is still no default feature on the latest version and it's not enabled by any other features: https://github.com/rust-lang/compiler-builtins/blob/f4c7940d3b13ec879c9fdc218812f71a65149123/Cargo.toml#L51 . So I see no reason why the feature should be enabled.

To debug this issue, it would help if you could post the full compilation log, post the code of your project, and ideally try to find out which cargo-xbuild release introduced the problem.

@steveyko
Copy link
Author

steveyko commented Aug 6, 2020

Thanks for your answer. I actually found the reason: rust-lang/compiler-builtins@03001f2. My target contains '-none' and it automatically enables the mem feature. It's an issue from compiler-builtins, so I'll close this.

@steveyko steveyko closed this as completed Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants