Build failure with in-source autotools build on case-insensitive filesystem with C++20-capable compiler #621
Labels
No labels
3rdparty
Android
API
Author does not respond
bsd
bug
build system/CI
ci-virtual-device
CMake
Contributions Welcome
Core
dependencies
device-specific
documentation
don't_merge
duplicate
enhancement
Example
Haiku
hidraw
hotplug
info required
invalid
libusb
macOS
Misc
Not an issue
question
Release
Test
Test GUI
Windows
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libusb/hidapi#621
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When doing an in-source build using the autotools build system on a case-insensitive filesystem (for example, most Macs) when using a compiler that is aware of C++20, the build fails, for example on macOS 12:
This is because C++20 has a header called
versionwhich is automatically included by various system headers, but your project has a file calledVERSIONin its root directory. An in-source autotools build will add the flag-I.to find the generated config.h file, but this will also cause theVERSIONfile to be used instead of theversionfile.Note this problem occurs in any C++ mode, not just C++20 mode, as long as the compiler has C++20 compatibility and therefore has the
versionheader.Doing an out-of-source build does work. I am aware that the autotools build system is deprecated. I have not tested in-source nor out-of-source cmake builds.
More about this problem in this llvm bug report if you're interested.
For completeness of the picture I'd be happy to see results of testing the in-source CMake build.
But I do not support changing a great/simple name of a file so that deprecated build system works in non-recommended scenarios.
The good news is that cmake builds, whether in-source or out-of-source, don't seem to have the problem. Even with an in-source build, cmake doesn't add a
-Iflag for the root directory because cmake doesn't put generated headers there. So this is a uniquely autotools problem which will go away when you remove that build system.If the "non-recommended scenario" you're referring to is doing an in-source autotools build, then it could suffice to update the documentation to recommend an out-of-source build. Currently, the documentation shows how to do an in-source build:
github.com/libusb/hidapi@c19ae126d8/BUILD.autotools.md (L48-L51)An out-of-source build would be:
Good point, I'll update the doc.
Thanks.