-
Notifications
You must be signed in to change notification settings - Fork 234
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
Need --cfg=libc_align
in v0.3.16 but not v0.3.15; why?
#130
Comments
It is very strange that you get this on rustc 1.47.0. According to the libc build script it should automatically activate And also having I have never used Bazel. Maybe it does not support features or build scripts enough? |
Or maybe it simply does not parse the build script output of |
Ah! Thank you, thank you. Indeed, it can parse |
Summary: When setting up the transitive dep on `libc` in #4316, I had originally passed `--cfg=libc_align`, because that fixed the build for me and on CI, and I couldn’t figure out the right cross-platform fix. But @faern [helpfully points out that we just need to run the build script][1], which detects the OS and Rust compiler version to determine the appropriate flags. Bazel `rules_rust` can handle this, if we just ask. (I should have followed my own `DEVELOPMENT.md` suggestions!) [1]: rust-lang/socket2#130 (comment) Test Plan: It still builds—`bazel build @raze__libc__0_2_80//:libc`—and the demo server still works and accepts requests following #4318’s test plan. wchargin-branch: rust-libc-gen-buildrs wchargin-source: 4ddff8d0b822585a9e84c7a24c4577b97b9c5d6a
Summary: When setting up the transitive dep on `libc` in #4316, I had originally passed `--cfg=libc_align`, because that fixed the build for me and on CI, and I couldn’t figure out the right cross-platform fix. But @faern [helpfully points out that we just need to run the build script][1], which detects the OS and Rust compiler version to determine the appropriate flags. Bazel `rules_rust` can handle this, if we just ask. (I should have followed my own `DEVELOPMENT.md` suggestions!) [1]: rust-lang/socket2#130 (comment) Test Plan: It still builds—`bazel build @raze__libc__0_2_80//:libc`—and the demo server still works and accepts requests following #4318’s test plan. wchargin-branch: rust-libc-gen-buildrs
Hi! I transitively use
socket2
as part of a Rust project built withBazel. I’m noting that
socket2
builds successfully for me at v0.3.15,but not at version v0.3.16 (released today) unless I specify the extra
flag
--cfg=libc_align
. I’m a bit hesitant to do so because it feelslow-level and platform specific, so I wanted to check and see whether
this is expected or whether there’s a better solution?
Here is a repro repo. You do need to have Bazel to repro, but you
don’t need any additional setup. The error is:
I dug far enough into the
libc
structure to see thealign
/no_align
modules and guess that this
cfg
flag would probably fix it; it does.The failing Bazel action, with directory structure and command line
invocation, is here (in a Gist because it has some long paths):
https://gist.github.com/wchargin/4da947cf43d2a241cfffb89873788a82
In all cases, the
libc
dependency is at version 0.2.80. But I notethat
socket2
v0.3.15 depends onlibc
with default features, whereasin v0.3.16 it depends on the
align
feature:So I’m hoping that you can help me understand what caused this change,
why it requires me to build with
--cfg=libc_align
, (maybe) why it’sneeded with Bazel but not with Cargo (though I understand if that’s
outside your purview/expertise), and whether I should feel comfortable
doing so? I want to build for non-Linux platforms, too, eventually.
I’m on rustc 1.47.0 (18bf6b4f0 2020-10-07) on Debian-like Linux.
Thanks much!
The text was updated successfully, but these errors were encountered: