Page MenuHomeFreeBSD

localedef: Fix bootstrapping on Ubuntu 16.04
ClosedPublic

Authored by jrtc27 on Jan 23 2021, 10:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 18, 12:19 AM
Unknown Object (File)
Tue, Nov 5, 3:22 PM
Unknown Object (File)
Thu, Oct 24, 10:32 AM
Unknown Object (File)
Sep 22 2024, 11:01 PM
Unknown Object (File)
Sep 22 2024, 7:41 AM
Unknown Object (File)
Sep 20 2024, 12:08 PM
Unknown Object (File)
Sep 6 2024, 12:05 AM
Unknown Object (File)
Sep 2 2024, 5:07 AM
Subscribers

Details

Summary

Glibc's stdlib.h defines various prototypes for GNU extensions that take
a locale_t. Newer versions use locale_t directly and include an internal
bits/types/locale_t.h in order to get its definition, but older versions
include xlocale.h for that, for which our bootstrap version is empty.
Moreover it expects to use the glibc-specific __locale_t type. Thus,
provide dummy definitions of both types in order to ensure the
prototypes don't give any errors, and guard against the header being
inadvertently included between the bootstrapping namespace.h and
un-namespace.h, where locale_t is #define'd.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Jan 23 2021, 11:39 PM

I was able to compile this on a 12.2 system with -DBUILD_WITH_STRICT_TMPPATH -DBOOTSTRAP_ALL_TOOLS and the following patch applied:

diff --git a/usr.bin/localedef/bootstrap/xlocale.h b/usr.bin/localedef/bootstrap/xlocale.h
index 05629a32f4e3..d4b8d75de55c 100644
--- a/usr.bin/localedef/bootstrap/xlocale.h
+++ b/usr.bin/localedef/bootstrap/xlocale.h
@@ -51,5 +51,6 @@
 #error "Dummy xlocale.h included inside bootstrapping namespace context"
 #endif

+#error "Linux only?"
 typedef        struct __dummy_host_locale      *__locale_t;
 typedef        __locale_t                      locale_t;

So it seems like I did remember correctly that this only affects Linux bootstrap. Therefore this is unlikely to break anything important and should be fine to commit. CheriBSD CI is also happy so it seems like both Ubuntu 18.04 and 20.04 still work.

This revision was automatically updated to reflect the committed changes.