Skip to content

undefined reference to linker error when using from nightly rustc #2684

Closed
@fpoli

Description

@fpoli

In our project we use rustc nightly-2021-10-15 and we encountered a compiler bug that prevents us upgrading from hyper 0.13, warp 0.2, reqwest 0.10, tokio 0.2 to hyper 0.14, warp 0.3, reqwest 0.11, tokio 1.2 (working, not working commit).

It seems that the cause is the C ffi:

crate-type = ["lib", "staticlib", "cdylib"]

Removing that line solves the issue: alexkornitzer@1199048

I know that this is not exactly a bug in hyper, but since the C API is unstable I wonder if there is a way to set that crate-type only in the build that generates the C library. At least, until the compiler is fixed.

Activity

added
C-bugCategory: bug. Something is wrong. This is bad!
on Nov 5, 2021
seanmonstar

seanmonstar commented on Nov 5, 2021

@seanmonstar
Member

Unfortunately we currently can't. There's no way for people to enable only a cdylib on-demand. But #2685 is tracking that.

sfackler

sfackler commented on Nov 5, 2021

@sfackler
Contributor

Couldn't the C interface be moved to a separate crate from hyper itself?

seanmonstar

seanmonstar commented on Nov 5, 2021

@seanmonstar
Member

The C interface makes uses of private details, so to use them in a separate crate would require making those "public".

bjorn3

bjorn3 commented on Nov 5, 2021

@bjorn3

An option would be to only expose them when a certain cfg is used. If it is something like foo and not feature = "foo" you can only set it using RUSTFLAGS and not when specifying it as dependency.

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

    C-bugCategory: bug. Something is wrong. This is bad!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @seanmonstar@sfackler@fpoli@bjorn3

        Issue actions

          `undefined reference` to linker error when using from nightly rustc · Issue #2684 · hyperium/hyper