* Build fails with an error in setlocale.h
@ 2016-08-16 10:37 Matthew Wahab
2016-08-16 10:48 ` Corinna Vinschen
0 siblings, 1 reply; 10+ messages in thread
From: Matthew Wahab @ 2016-08-16 10:37 UTC (permalink / raw)
To: newlib; +Cc: corinna
Hello,
I get a build failure when cross-compiling for aarch64-none-elf, the error
message is
----
newlib-cygwin/newlib/libc/stdlib/../locale/setlocale.h:206:38: error: unknown
type name 'locale_t'; did you mean 'clockid_t'?
size_t, size_t, mbstate_t *, locale_t);
^~~~~~~~
clockid_t
----
The error points to the declaration
diff --git a/newlib/libc/locale/setlocale.h b/newlib/libc/locale/setlocale.h
+extern size_t _wcsnrtombs_l (struct _reent *, char *, const wchar_t **,
+ size_t, size_t, mbstate_t *, locale_t);
+
added by
----
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Wed Aug 10 16:30:46 2016 +0200
Implement strto[dflu]_l/wcsto[dflu]_l
----
Looking at the surrounding code in that file, I think that locale_t should have
been __locale_t.
Let me know if there's anything else I should check,
Matthew
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Build fails with an error in setlocale.h
2016-08-16 10:37 Build fails with an error in setlocale.h Matthew Wahab
@ 2016-08-16 10:48 ` Corinna Vinschen
2016-08-16 10:58 ` Corinna Vinschen
2016-08-16 11:39 ` Matthew Wahab
0 siblings, 2 replies; 10+ messages in thread
From: Corinna Vinschen @ 2016-08-16 10:48 UTC (permalink / raw)
To: newlib
[-- Attachment #1: Type: text/plain, Size: 1886 bytes --]
Hi Matthew,
[please don't CC me. I'm subscribed to the newlib ML anyway. Thanks.]
On Aug 16 11:37, Matthew Wahab wrote:
> Hello,
>
> I get a build failure when cross-compiling for aarch64-none-elf, the error
> message is
> ----
> newlib-cygwin/newlib/libc/stdlib/../locale/setlocale.h:206:38: error:
> unknown type name 'locale_t'; did you mean 'clockid_t'?
> size_t, size_t, mbstate_t *, locale_t);
> ^~~~~~~~
> clockid_t
What on earth is the compiler thinking here?
> ----
>
> The error points to the declaration
>
> diff --git a/newlib/libc/locale/setlocale.h b/newlib/libc/locale/setlocale.h
> +extern size_t _wcsnrtombs_l (struct _reent *, char *, const wchar_t **,
> + size_t, size_t, mbstate_t *, locale_t);
> +
> [...]
> Looking at the surrounding code in that file, I think that locale_t should
> have been __locale_t.
Almost. It should have been `struct __locale_t *':
diff --git a/newlib/libc/locale/setlocale.h b/newlib/libc/locale/setlocale.h
index de2bd67..03b1dd7 100644
--- a/newlib/libc/locale/setlocale.h
+++ b/newlib/libc/locale/setlocale.h
@@ -203,7 +203,7 @@ extern const char *__get_locale_env(struct _reent *, int);
extern struct lconv *__localeconv_l (struct __locale_t *locale);
extern size_t _wcsnrtombs_l (struct _reent *, char *, const wchar_t **,
- size_t, size_t, mbstate_t *, locale_t);
+ size_t, size_t, mbstate_t *, struct __locale_t *);
/* In POSIX terms the global locale is the process-wide locale. Use this
function to always refer to the global locale. */
> Let me know if there's anything else I should check,
Can you test that the above patch works for you? I'll check it in then.
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Build fails with an error in setlocale.h
2016-08-16 10:48 ` Corinna Vinschen
@ 2016-08-16 10:58 ` Corinna Vinschen
2016-08-16 11:39 ` Matthew Wahab
1 sibling, 0 replies; 10+ messages in thread
From: Corinna Vinschen @ 2016-08-16 10:58 UTC (permalink / raw)
To: newlib
[-- Attachment #1: Type: text/plain, Size: 1985 bytes --]
On Aug 16 12:48, Corinna Vinschen wrote:
> On Aug 16 11:37, Matthew Wahab wrote:
> > The error points to the declaration
> >
> > diff --git a/newlib/libc/locale/setlocale.h b/newlib/libc/locale/setlocale.h
> > +extern size_t _wcsnrtombs_l (struct _reent *, char *, const wchar_t **,
> > + size_t, size_t, mbstate_t *, locale_t);
> > +
> > [...]
> > Looking at the surrounding code in that file, I think that locale_t should
> > have been __locale_t.
>
> Almost. It should have been `struct __locale_t *':
>
> diff --git a/newlib/libc/locale/setlocale.h b/newlib/libc/locale/setlocale.h
> [...]
Actually, make that:
diff --git a/newlib/libc/locale/setlocale.h b/newlib/libc/locale/setlocale.h
index de2bd67..03b1dd7 100644
--- a/newlib/libc/locale/setlocale.h
+++ b/newlib/libc/locale/setlocale.h
@@ -203,7 +203,7 @@ extern const char *__get_locale_env(struct _reent *, int);
extern struct lconv *__localeconv_l (struct __locale_t *locale);
extern size_t _wcsnrtombs_l (struct _reent *, char *, const wchar_t **,
- size_t, size_t, mbstate_t *, locale_t);
+ size_t, size_t, mbstate_t *, struct __locale_t *);
/* In POSIX terms the global locale is the process-wide locale. Use this
function to always refer to the global locale. */
diff --git a/newlib/libc/stdlib/wcsnrtombs.c b/newlib/libc/stdlib/wcsnrtombs.c
index 8ad8bcd..8e5c387 100644
--- a/newlib/libc/stdlib/wcsnrtombs.c
+++ b/newlib/libc/stdlib/wcsnrtombs.c
@@ -107,7 +107,7 @@ PORTABILITY
size_t
_wcsnrtombs_l (struct _reent *r, char *dst, const wchar_t **src, size_t nwc,
- size_t len, mbstate_t *ps, locale_t loc)
+ size_t len, mbstate_t *ps, struct __locale_t *loc)
{
char *ptr = dst;
char buff[10];
> > Let me know if there's anything else I should check,
>
> Can you test that the above patch works for you? I'll check it in then.
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Build fails with an error in setlocale.h
2016-08-16 10:48 ` Corinna Vinschen
2016-08-16 10:58 ` Corinna Vinschen
@ 2016-08-16 11:39 ` Matthew Wahab
2016-08-16 11:57 ` Matthew Wahab
1 sibling, 1 reply; 10+ messages in thread
From: Matthew Wahab @ 2016-08-16 11:39 UTC (permalink / raw)
To: newlib
On 16/08/16 11:48, Corinna Vinschen wrote:
> On Aug 16 11:37, Matthew Wahab wrote:
>> I get a build failure when cross-compiling for aarch64-none-elf, the error
>> message is
>> ----
>> newlib-cygwin/newlib/libc/stdlib/../locale/setlocale.h:206:38: error:
>> unknown type name 'locale_t'; did you mean 'clockid_t'?
>> size_t, size_t, mbstate_t *, locale_t);
>> ^~~~~~~~
>> clockid_t
>
>
> Can you test that the above patch works for you? I'll check it in then.
>
Thanks for the patch. It fixes that failure but there's another in localeconv.c:
----
newlib-cygwin/newlib/libc/locale/localeconv.c: In function '__localeconv_l':
newlib-cygwin/newlib/libc/locale/localeconv.c:47:10: error: 'lconv' undeclared
(first use in this function); did you mean 'lconv'?
return lconv;
^~~~~
lconv
----
I think that this is because the lconv is declared and used
----
#ifdef __HAVE_LOCALE_INFO__
struct lconv *lconv = &locale->lconv;
..
#endif /* __HAVE_LOCALE_INFO__ */
return lconv;
----
That's easy to fix but I then get failures in time/strftime.c for__get_time_locale:
----
newlib-cygwin/newlib/libc/time/../time/strftime.c: In function '__strftime':
newlib-cygwin/newlib/libc/time/../time/strftime.c:701:48: warning: implicit
declaration of function '__get_time_locale'; did you mean
'__get_current_locale'? [-Wimplicit-function-declaration]
const struct lc_time_T *_CurrentTimeLocale = __get_time_locale (locale);
^~~~~~~~~~~~~~~~~
__get_current_locale
----
I also get errors for the use of era_info_t and other types in that function
----
newlib-cygwin/newlib/libc/time/../time/strftime.c: In function 'wcsftime':
newlib-cygwin/newlib/libc/time/../time/strftime.c:1446:3: error: unknown type
name 'era_info_t'; did you mean '__ino_t'?
era_info_t *era_info = NULL;
^~~~~~~~~~
__ino_t
----
But I haven't been able to track down what causes those.
Matthew
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Build fails with an error in setlocale.h
2016-08-16 11:39 ` Matthew Wahab
@ 2016-08-16 11:57 ` Matthew Wahab
2016-08-16 13:27 ` Corinna Vinschen
0 siblings, 1 reply; 10+ messages in thread
From: Matthew Wahab @ 2016-08-16 11:57 UTC (permalink / raw)
To: newlib
On 16/08/16 12:39, Matthew Wahab wrote:
> On 16/08/16 11:48, Corinna Vinschen wrote:
>> On Aug 16 11:37, Matthew Wahab wrote:
>>> I get a build failure when cross-compiling for aarch64-none-elf, the error
>>> message is
>>> ----
>>> newlib-cygwin/newlib/libc/stdlib/../locale/setlocale.h:206:38: error:
>>> unknown type name 'locale_t'; did you mean 'clockid_t'?
>>> size_t, size_t, mbstate_t *, locale_t);
>>> ^~~~~~~~
>>> clockid_t
>>
>>
>> Can you test that the above patch works for you? I'll check it in then.
>>
>
> Thanks for the patch. It fixes that failure but there's another in localeconv.c:
I've also tried with the second patch and still get the build errors.
Matthew
> ----
> newlib-cygwin/newlib/libc/locale/localeconv.c: In function '__localeconv_l':
> newlib-cygwin/newlib/libc/locale/localeconv.c:47:10: error: 'lconv' undeclared
> (first use in this function); did you mean 'lconv'?
> return lconv;
> ^~~~~
> lconv
> ----
> I think that this is because the lconv is declared and used
> ----
> #ifdef __HAVE_LOCALE_INFO__
> struct lconv *lconv = &locale->lconv;
> ..
> #endif /* __HAVE_LOCALE_INFO__ */
> return lconv;
> ----
>
> That's easy to fix but I then get failures in time/strftime.c
> for__get_time_locale:
> ----
> newlib-cygwin/newlib/libc/time/../time/strftime.c: In function '__strftime':
> newlib-cygwin/newlib/libc/time/../time/strftime.c:701:48: warning: implicit
> declaration of function '__get_time_locale'; did you mean
> '__get_current_locale'? [-Wimplicit-function-declaration]
> const struct lc_time_T *_CurrentTimeLocale = __get_time_locale (locale);
> ^~~~~~~~~~~~~~~~~
> __get_current_locale
> ----
>
> I also get errors for the use of era_info_t and other types in that function
> ----
> newlib-cygwin/newlib/libc/time/../time/strftime.c: In function 'wcsftime':
> newlib-cygwin/newlib/libc/time/../time/strftime.c:1446:3: error: unknown type
> name 'era_info_t'; did you mean '__ino_t'?
> era_info_t *era_info = NULL;
> ^~~~~~~~~~
> __ino_t
> ----
> But I haven't been able to track down what causes those.
>
> Matthew
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Build fails with an error in setlocale.h
2016-08-16 11:57 ` Matthew Wahab
@ 2016-08-16 13:27 ` Corinna Vinschen
2016-08-16 13:59 ` Matthew Wahab
0 siblings, 1 reply; 10+ messages in thread
From: Corinna Vinschen @ 2016-08-16 13:27 UTC (permalink / raw)
To: newlib
[-- Attachment #1: Type: text/plain, Size: 1085 bytes --]
Hi Matthew,
On Aug 16 12:57, Matthew Wahab wrote: > On 16/08/16 12:39, Matthew Wahab wrote:
> > On 16/08/16 11:48, Corinna Vinschen wrote:
> > > On Aug 16 11:37, Matthew Wahab wrote:
> > > > I get a build failure when cross-compiling for aarch64-none-elf, the error
> > > > message is
> > > > ----
> > > > newlib-cygwin/newlib/libc/stdlib/../locale/setlocale.h:206:38: error:
> > > > unknown type name 'locale_t'; did you mean 'clockid_t'?
> > > > size_t, size_t, mbstate_t *, locale_t);
> > > > ^~~~~~~~
> > > > clockid_t
> > >
> > >
> > > Can you test that the above patch works for you? I'll check it in then.
> > >
> >
> > Thanks for the patch. It fixes that failure but there's another in localeconv.c:
>
> I've also tried with the second patch and still get the build errors.
I applied a couple of patches meant to fix the locale stuff on non-Cygwin
targets. Please give them a try.
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Build fails with an error in setlocale.h
2016-08-16 13:27 ` Corinna Vinschen
@ 2016-08-16 13:59 ` Matthew Wahab
2016-08-16 14:28 ` Corinna Vinschen
0 siblings, 1 reply; 10+ messages in thread
From: Matthew Wahab @ 2016-08-16 13:59 UTC (permalink / raw)
To: newlib
On 16/08/16 14:27, Corinna Vinschen wrote:
> Hi Matthew,
>
> On Aug 16 12:57, Matthew Wahab wrote: > On 16/08/16 12:39, Matthew Wahab wrote:
>>> On 16/08/16 11:48, Corinna Vinschen wrote:
>>>> On Aug 16 11:37, Matthew Wahab wrote:
>>>>> I get a build failure when cross-compiling for aarch64-none-elf, the error
>>>>> message is
>>>>> ----
>>>>> newlib-cygwin/newlib/libc/stdlib/../locale/setlocale.h:206:38: error:
>>>>> unknown type name 'locale_t'; did you mean 'clockid_t'?
>>>>> size_t, size_t, mbstate_t *, locale_t);
>>>>> ^~~~~~~~
>>>>> clockid_t
>>>>
>>>>
>>>> Can you test that the above patch works for you? I'll check it in then.
>>>>
>>>
>>> Thanks for the patch. It fixes that failure but there's another in localeconv.c:
>>
>> I've also tried with the second patch and still get the build errors.
>
> I applied a couple of patches meant to fix the locale stuff on non-Cygwin
> targets. Please give them a try.
>
Thanks for that. The patches worked but now there are failures to do with
_C_monetary_locale, _C_numeric_locale, _C_time_locale and _C_messages_locale. e.g.
----
newlib-cygwin/newlib/libc/stdlib/../locale/setlocale.h: In function
'__get_monetary_locale':
newlib-cygwin/newlib/libc/stdlib/../locale/setlocale.h:329:10: error:
incompatible types when returning type 'const struct lc_monetary_T' but 'const
struct lc_monetary_T *' was expected
return _C_monetary_locale;
^~~~~~~~~~~~~~~~~~
----
There are a number of these, it looks like they're all in setlocale.h.
Matthew
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Build fails with an error in setlocale.h
2016-08-16 13:59 ` Matthew Wahab
@ 2016-08-16 14:28 ` Corinna Vinschen
2016-08-16 15:14 ` Matthew Wahab
0 siblings, 1 reply; 10+ messages in thread
From: Corinna Vinschen @ 2016-08-16 14:28 UTC (permalink / raw)
To: newlib
[-- Attachment #1: Type: text/plain, Size: 1933 bytes --]
On Aug 16 14:59, Matthew Wahab wrote:
> On 16/08/16 14:27, Corinna Vinschen wrote:
> > Hi Matthew,
> >
> > On Aug 16 12:57, Matthew Wahab wrote: > On 16/08/16 12:39, Matthew Wahab wrote:
> > > > On 16/08/16 11:48, Corinna Vinschen wrote:
> > > > > On Aug 16 11:37, Matthew Wahab wrote:
> > > > > > I get a build failure when cross-compiling for aarch64-none-elf, the error
> > > > > > message is
> > > > > > ----
> > > > > > newlib-cygwin/newlib/libc/stdlib/../locale/setlocale.h:206:38: error:
> > > > > > unknown type name 'locale_t'; did you mean 'clockid_t'?
> > > > > > size_t, size_t, mbstate_t *, locale_t);
> > > > > > ^~~~~~~~
> > > > > > clockid_t
> > > > >
> > > > >
> > > > > Can you test that the above patch works for you? I'll check it in then.
> > > > >
> > > >
> > > > Thanks for the patch. It fixes that failure but there's another in localeconv.c:
> > >
> > > I've also tried with the second patch and still get the build errors.
> >
> > I applied a couple of patches meant to fix the locale stuff on non-Cygwin
> > targets. Please give them a try.
> >
>
> Thanks for that. The patches worked but now there are failures to do with
> _C_monetary_locale, _C_numeric_locale, _C_time_locale and
> _C_messages_locale. e.g.
> ----
> newlib-cygwin/newlib/libc/stdlib/../locale/setlocale.h: In function
> '__get_monetary_locale':
> newlib-cygwin/newlib/libc/stdlib/../locale/setlocale.h:329:10: error:
> incompatible types when returning type 'const struct lc_monetary_T' but
> 'const struct lc_monetary_T *' was expected
> return _C_monetary_locale;
> ^~~~~~~~~~~~~~~~~~
> ----
> There are a number of these, it looks like they're all in setlocale.h.
Forgot the &. Should be fixed now.
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Build fails with an error in setlocale.h
2016-08-16 14:28 ` Corinna Vinschen
@ 2016-08-16 15:14 ` Matthew Wahab
2016-08-16 17:04 ` Corinna Vinschen
0 siblings, 1 reply; 10+ messages in thread
From: Matthew Wahab @ 2016-08-16 15:14 UTC (permalink / raw)
To: newlib
On 16/08/16 15:28, Corinna Vinschen wrote:
> On Aug 16 14:59, Matthew Wahab wrote:
>> Thanks for that. The patches worked but now there are failures to do with
>> _C_monetary_locale, _C_numeric_locale, _C_time_locale and
>> _C_messages_locale. e.g.
>> ----
>> newlib-cygwin/newlib/libc/stdlib/../locale/setlocale.h: In function
>> '__get_monetary_locale':
>> newlib-cygwin/newlib/libc/stdlib/../locale/setlocale.h:329:10: error:
>> incompatible types when returning type 'const struct lc_monetary_T' but
>> 'const struct lc_monetary_T *' was expected
>> return _C_monetary_locale;
>> ^~~~~~~~~~~~~~~~~~
>> ----
>> There are a number of these, it looks like they're all in setlocale.h.
>
> Forgot the &. Should be fixed now.
Yes, cross-compiled aarch64-none-elf now builds.
Thanks,
Matthew
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Build fails with an error in setlocale.h
2016-08-16 15:14 ` Matthew Wahab
@ 2016-08-16 17:04 ` Corinna Vinschen
0 siblings, 0 replies; 10+ messages in thread
From: Corinna Vinschen @ 2016-08-16 17:04 UTC (permalink / raw)
To: newlib
[-- Attachment #1: Type: text/plain, Size: 995 bytes --]
On Aug 16 16:14, Matthew Wahab wrote:
> On 16/08/16 15:28, Corinna Vinschen wrote:
> > On Aug 16 14:59, Matthew Wahab wrote:
> > > Thanks for that. The patches worked but now there are failures to do with
> > > _C_monetary_locale, _C_numeric_locale, _C_time_locale and
> > > _C_messages_locale. e.g.
> > > ----
> > > newlib-cygwin/newlib/libc/stdlib/../locale/setlocale.h: In function
> > > '__get_monetary_locale':
> > > newlib-cygwin/newlib/libc/stdlib/../locale/setlocale.h:329:10: error:
> > > incompatible types when returning type 'const struct lc_monetary_T' but
> > > 'const struct lc_monetary_T *' was expected
> > > return _C_monetary_locale;
> > > ^~~~~~~~~~~~~~~~~~
> > > ----
> > > There are a number of these, it looks like they're all in setlocale.h.
> >
> > Forgot the &. Should be fixed now.
>
> Yes, cross-compiled aarch64-none-elf now builds.
Thanks for your feedback.
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-08-16 17:04 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-16 10:37 Build fails with an error in setlocale.h Matthew Wahab
2016-08-16 10:48 ` Corinna Vinschen
2016-08-16 10:58 ` Corinna Vinschen
2016-08-16 11:39 ` Matthew Wahab
2016-08-16 11:57 ` Matthew Wahab
2016-08-16 13:27 ` Corinna Vinschen
2016-08-16 13:59 ` Matthew Wahab
2016-08-16 14:28 ` Corinna Vinschen
2016-08-16 15:14 ` Matthew Wahab
2016-08-16 17:04 ` Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).