Skip to content

max-pure feature is not pure (pulls in libsqlite3-sys) #1681

Closed
@tanriol

Description

@tanriol

Current behavior 😯

$ cargo build --target aarch64-unknown-linux-musl --release --no-default-features --features=max-pure
[...]
error: failed to run custom build command for `libsqlite3-sys v0.30.1`

Expected behavior 🤔

max-pure feature should be actually pure (ideally, CI should ensure it works without a C compiler available at all)

Git behavior

No response

Steps to reproduce 🕹

No response

Activity

added
acknowledgedan issue is accepted as shortcoming to be fixed
blockedIssue can't progress due to external dependencies
help wantedExtra attention is needed
and removed
blockedIssue can't progress due to external dependencies
on Nov 17, 2024
Byron

Byron commented on Nov 17, 2024

@Byron
Member

Thanks for bringing this to my attention.

It's true that max-pure is over-promising at the moment and what really is tested on CI is that a build is possible without additional tooling, like cmake. Here is the listing of prerequisites that are currently required to make any Rust build:

run: |
prerequisites=(
ca-certificates
curl
gcc # rustc calls gcc to invoke the linker.
libc-dev # rustc, in the toolchain we are using, dynamically links to the system libc.
)
apt-get update
apt-get install --no-install-recommends -y -- "${prerequisites[@]}"

Note that curl is used to install Rust via rustup.rs.

As of now, it's not possible to make any Rust build without a C compiler as it invokes the linker through it. Thanks to that, C-dependencies can always sneak in and build as long as they don't invoke more than make to compile.

Even though this particular issue can be solved by turning off gitoxide-core-tools-query for the max-pure build, it seems that what this issue really is about is to be able to build without a functional gcc.

Maybe the CI run could be tuned to replace gcc with a wrapper that only allows linking - then an attempt to build an actual C file would fail naturally, and one would maybe notice even more such invocations.
Maybe there is also a way to force Rust to use ld directly?

NobodyXu

NobodyXu commented on Nov 17, 2024

@NobodyXu
Contributor

There's nightly flag for using rustup distributed lld, honestly I wish something like zig-cc is provided via rustup.

Byron

Byron commented on Nov 17, 2024

@Byron
Member

That should be possible to integrate on CI and would solve the problem. Thanks for suggesting!

EliahKagan

EliahKagan commented on Nov 17, 2024

@EliahKagan
Member

I've opened #1682 to make the pure-rust-build CI job detect this issue, including but going beyond the dependency on libsqlite3-sys that was reported here (since there are some other dependencies that build C code as well).

The approach I've proposed there is intended as a way of getting immediate greater insight into how and why max-pure has dependencies that build C. I think it might also be useful alongside the approach proposed in #1681 (comment), or that it could potentially be replaced by that approach. Once this issue is fixed (or closer to being fixed), the benefit of allowing the build to succeed to observe all C compilation may no longer be needed.

added
blockedIssue can't progress due to external dependencies
on Nov 17, 2024
Byron

Byron commented on Nov 17, 2024

@Byron
Member

Thanks a lot for your help!

I have set this issue to blocked once again as ring currently builds some C code as part of its own compilation. It probably does so for very good reason, but while it's doing so a truly pure Rust build can't be accomplished unless one turns off HTTPS transport.

I could also imagine an intermediate step which involves setting up a pure target, one that tries to achieve a pure Rust build without having to provide max features.

tanriol

tanriol commented on Nov 17, 2024

@tanriol
Author

Not that I personally needed it to be absolutely pure Rust - removing gitoxide-core-tools-query and gitoxide-core-tools-corpus from max-pure was enough for my case to work, everything else cross-compiled successfully - but that's what the feature naming implied.

added a commit that references this issue on Nov 17, 2024

7 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acknowledgedan issue is accepted as shortcoming to be fixedblockedIssue can't progress due to external dependencieshelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @Byron@tanriol@EliahKagan@NobodyXu

      Issue actions

        `max-pure` feature is not pure (pulls in `libsqlite3-sys`) · Issue #1681 · GitoxideLabs/gitoxide