Skip to content

rustc 1.61 breaks build script that works with 1.60 #702

Open
@osa1

Description

@osa1

I'm not sure if this is a bug in rustc, or a print line that needs to be updated in cc. If you think this is a rustc bug please let me know and I'll report this in to rustc issue tracker. The problem exists in nightly as well.

I have this simple build script: https://github.com/osa1/sg/blob/master/build.rs it runs cc 6 times in total. The generated files should be statically linked with the executable.

In each iteration the build script runs cc twice. The second file being compiled uses symbols defined in the first.

cargo build works fine with rustc 1.60. With 1.61 it fails with "undefined reference to xyz" build errors where the symbols in error messages are symbols defined in the first file and used in the second file.

When both of the files being compiled are C files, I can combine the two cc commands in the loop body with one, passing both files as inputs. If I do that the build script works fine with rustc 1.61.

However sometimes one of the files is a C++ file, and in that case I can't combine these two cc commands into one, so I can't fix this for rustc 1.61 and newer by compiling both files in one invocation of cc.

Should cc be updated for some change in rustc 1.61? I checked the changelog for 1.61. The only entry that looks somewhat relevant is rust-lang/rust#93901. However from that thread I don't see why it would break a build script that works fine with rustc 1.61..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions