You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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..
The text was updated successfully, but these errors were encountered:
This is so strange.. If I swap the cc calls it works. So instead of building the dependency and then the dependant (which works in rustc older than 1.61), I build the dependant first and then the dependency.
osa1
added a commit
to osa1/sg
that referenced
this issue
Jul 22, 2022
Starting with rustc 1.61 the build script causes linker errors.
Swapping order of `cc` calls somehow "fixes" the issue. It probably
works around some bug in rustc or cargo.
See also rust-lang/cc-rs#702
I'm not sure if this is a bug in rustc, or a
print
line that needs to be updated incc
. 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 ofcc
.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..The text was updated successfully, but these errors were encountered: