swiftlang / swift-corelibs-foundation

The Foundation Project, providing core utilities, internationalization, and OS independence
swift.org
Apache License 2.0
5.29k stars 1.13k forks source link

Swift: Use of struct statx in Base.subproj/ForSwiftFoundationOnly.h requires -D_GNU_SOURCE #4835

Open ADKaster opened 1 year ago

ADKaster commented 1 year ago

ref: https://forums.swift.org/t/swift-5-9-release-on-ubuntu-22-04-fails-to-build-std-module/67659/2

On the swift:latest docker container, building a simple C++ interop project (as referenced in my forum post) fails because the definition of struct statx is not available. Looking at the glibc sources in bootlin elixir, it seems that <sys/stat.h> only includes <bits/statx.h> if __USE_GNU is defined,. That definition comes from the public define _GNU_SOURCE in <features.h>.

Without providing -D_GNU_SOURCE, I cannot build a simple project on ubuntu 22.04 (for other reasons), nor in the current latest tag of the swift docker container due to this mismatch in assumptions about what will provide the definition of struct statx.

ADKaster commented 1 year ago

I think I figured this one out actually. For inside the container anyway :)

installing cmake from the kit ware repos installs gcc-11 as a dependency at the moment. That breaks things. Removing it and making sure to install libstdc++-10-dev lets the project get to the (probably obvious) swift errors in my example project