-
Notifications
You must be signed in to change notification settings - Fork 49
Build failure with clang-16 or later #73
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
Comments
This is only true if the next release in fact includes the changes. If for whatever reason this isn't the case (e.g. we update to some patch release not including the fixes), we have to re-apply the patch(es). This is precisely what I don't want.
It's not the size that matters, but the extra work/effort needed when updating the libffi source code. It also sets a precedent of maintaining patches, which again isn't something I want. If we can instead provide a flag to turn the error back into a warning, I'd much rather do that. I highly doubt anybody would compile libffi-rs with anything but clang or gcc, so the flag shouldn't be an issue. In the worst case we check what compiler is used and add the flag conditionally. |
Building with clang-16 or newer currently fails as the issue described in libffi/libffi#760 causes a compile error. Fix this by adding the -Wno-implicit-function-declaration compiler flag, which allows the current source code to still be built. Addresses tov#73.
OK, fair enough.
Turns out this was easier than I expected, as the rust I've submitted a patch as #74. |
This should be fixed in version 2.2.1 of libffi-sys. |
Thanks again! |
rustpython-test-compile-failure.log Getting the error, even when on "2.3.0". |
In your log I see:
so it looks like 2.1.0 is actually getting built here. |
I'm having the same issue when building on fedora. I double checked and i'm using |
Attempting to build libffi-rs using clang-16 or later as the C compiler fails with:
(This is the same problem pointed out here #69 (comment), pulled out into a new issue since it is really unrelated to that pull request.)
The C source code is in fact invalid, C99 and later do not support implicit function declarations. However, most compilers up to now have treated this as simply a warning (and you do indeed see that warning when building libffi-rs with older clang versions or GCC), but as of clang-16, this is now treated as hard error by default. (See https://reviews.llvm.org/D122983 for the upstream discussion.)
That invalid source code was introduced into the libffi sources here libffi/libffi@fc6b939, which made its way into the 3.4.4 release. The bug was subsequently fixed via libffi/libffi#760 and libffi/libffi#764, which landed upstream but is not yet part of any official release.
This is unfortunate as clang-16 starts to become more frequently used, as this will mean the current libffi-rs release will not build out of the box when that compiler is used as default. In particular, this showed up as failure preventing moving rust's miri tool to the latest libffi-rs release (see rust-lang/rust#109771), as some of the rust regression test builders already use clang-16.
I've been investigating options to fix this problem and make libffi-rs buildable again. These all boil down to one of two approaches: fix the actual problem in the C sources, or else downgrade the error back to a warning as it used to be:
-Wno-implicit-function-declaration
or-Wno-error=implicit-function-declaration
to theCFLAGS
when building the C portions of libffi, which could be done automatically e.g. by updating thelibffi-sys-rs/build/not_msvc.rs
script. However, there might be some issue with compilers that do not recognize this flag (GCC and clang do, but I'm not sure if there are any other compilers that could possibly be used to build libffi-rs).My preference would be option 2, but the decision is of course up to you. I'd be happy to help implement any of those if needed.
The text was updated successfully, but these errors were encountered: