Problem building 9.4.7 on Fedora 36 (bytestring/cbits/is-valid-utf8.c)

The build was failing, because rts/OSThreads.h via Rts.h from
libraries/bytestring/cbits/is-valid-utf8.c had no definition of
`clockid_t`. This type is not exposed with _POSIX_C_SOURCE is
not defined to a sufficiently high value:
SYNOPSIS
#include

On Tue, Aug 08, 2023 at 11:33:52AM -0400, Viktor Dukhovni wrote:
The build was failing, because rts/OSThreads.h via Rts.h from libraries/bytestring/cbits/is-valid-utf8.c had no definition of `clockid_t`. This type is not exposed when _POSIX_C_SOURCE is not defined to a sufficiently high value:
Apologies, original $subject should have said 9.4.6. -- Viktor.

I believe 9.4.7 is coming with a fix for this
On Tue, 8 Aug 2023 at 23:44, Viktor Dukhovni
On Tue, Aug 08, 2023 at 11:33:52AM -0400, Viktor Dukhovni wrote:
The build was failing, because rts/OSThreads.h via Rts.h from libraries/bytestring/cbits/is-valid-utf8.c had no definition of `clockid_t`. This type is not exposed when _POSIX_C_SOURCE is not defined to a sufficiently high value:
Apologies, original $subject should have said 9.4.6.

Unfortunately you’re not the only developer facing these build errors. They've been reported in #23810 https://gitlab.haskell.org/ghc/ghc/-/issues/23810 and #23789 https://gitlab.haskell.org/ghc/ghc/-/issues/23789. It might be worth pasting your workaround there too. Thanks, Rodrigo
On 8 Aug 2023, at 16:33, Viktor Dukhovni
wrote: The build was failing, because rts/OSThreads.h via Rts.h from libraries/bytestring/cbits/is-valid-utf8.c had no definition of `clockid_t`. This type is not exposed with _POSIX_C_SOURCE is not defined to a sufficiently high value:
SYNOPSIS #include
int clock_getres(clockid_t clockid, struct timespec *res);
int clock_gettime(clockid_t clockid, struct timespec *tp); int clock_settime(clockid_t clockid, const struct timespec *tp);
Link with -lrt (only for glibc versions before 2.17).
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
clock_getres(), clock_gettime(), clock_settime(): _POSIX_C_SOURCE >= 199309L
I quick-and-dirty work-around was:
--- a/libraries/bytestring/cbits/is-valid-utf8.c +++ b/libraries/bytestring/cbits/is-valid-utf8.c @@ -27,6 +27,10 @@ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#undef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 200809L +#undef _XOPEN_SOURCE +#define _XOPEN_SOURCE 700 #pragma GCC push_options #pragma GCC optimize("-O2") #include
There's surely a better solution.
-- Viktor. _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
participants (3)
-
Jens Petersen
-
Rodrigo Mesquita
-
Viktor Dukhovni