* [LIBGO PATCH] Fix compilation error against uClibc-ng: runtime_sysinfo.go: error: use of undefined type ‘___uclibc_locale_struct’
@ 2017-09-29 8:38 Alex Potapenko
2017-09-29 12:56 ` Ian Lance Taylor
0 siblings, 1 reply; 7+ messages in thread
From: Alex Potapenko @ 2017-09-29 8:38 UTC (permalink / raw)
To: gcc-patches, Waldemar Brodkorb
Hi!
Building GCC 7.2.0 libgo against uClibc-ng 1.0.26 results in the following
error:
> runtime_sysinfo.go:418:17: error: use of undefined type
> ‘___uclibc_locale_struct’
This happens because -fdump-go-spec probably generates types only from
typedef declarations, ignoring structs, like "struct
__uclibc_locale_struct;" in uClibc-ng <bits/uClibc_locale.h> header. Adding
"typedef struct __uclibc_locale_struct __uclibc_locale_struct;" to
libgo/sysinfo.c remedies this issue:
--- a/libgo/sysinfo.c
+++ b/libgo/sysinfo.c
@@ -277,3 +277,7 @@
epoll_data_offset = offsetof(struct epoll_event, data)
};
#endif
+
+#ifdef __UCLIBC__
+typedef struct __uclibc_locale_struct __uclibc_locale_struct;
+#endif
Best regards,
Alex
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LIBGO PATCH] Fix compilation error against uClibc-ng: runtime_sysinfo.go: error: use of undefined type ‘___uclibc_locale_struct’
2017-09-29 8:38 [LIBGO PATCH] Fix compilation error against uClibc-ng: runtime_sysinfo.go: error: use of undefined type ‘___uclibc_locale_struct’ Alex Potapenko
@ 2017-09-29 12:56 ` Ian Lance Taylor
2017-09-29 13:29 ` Alex Potapenko
0 siblings, 1 reply; 7+ messages in thread
From: Ian Lance Taylor @ 2017-09-29 12:56 UTC (permalink / raw)
To: Alex Potapenko; +Cc: gcc-patches, Waldemar Brodkorb
On Fri, Sep 29, 2017 at 1:38 AM, Alex Potapenko <opotapenko@gmail.com> wrote:
>
> Building GCC 7.2.0 libgo against uClibc-ng 1.0.26 results in the following
> error:
>
>> runtime_sysinfo.go:418:17: error: use of undefined type
>> ‘___uclibc_locale_struct’
>
>
> This happens because -fdump-go-spec probably generates types only from
> typedef declarations, ignoring structs, like "struct
> __uclibc_locale_struct;" in uClibc-ng <bits/uClibc_locale.h> header. Adding
> "typedef struct __uclibc_locale_struct __uclibc_locale_struct;" to
> libgo/sysinfo.c remedies this issue:
>
> --- a/libgo/sysinfo.c
> +++ b/libgo/sysinfo.c
> @@ -277,3 +277,7 @@
> epoll_data_offset = offsetof(struct epoll_event, data)
> };
> #endif
> +
> +#ifdef __UCLIBC__
> +typedef struct __uclibc_locale_struct __uclibc_locale_struct;
> +#endif
-fdump-go-spec doesn't ignore structs, so I feel like there may be
something else going on. Could you send the generated gen-sysinfo.go
file (without your patch)? Thanks.
Ian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LIBGO PATCH] Fix compilation error against uClibc-ng: runtime_sysinfo.go: error: use of undefined type ‘___uclibc_locale_struct’
2017-09-29 12:56 ` Ian Lance Taylor
@ 2017-09-29 13:29 ` Alex Potapenko
2017-09-29 13:44 ` Ian Lance Taylor
0 siblings, 1 reply; 7+ messages in thread
From: Alex Potapenko @ 2017-09-29 13:29 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc-patches, Waldemar Brodkorb
(Sorry for the rerepost: the list doesn't accept any attachments)
Hi Ian,
On Fri, Sep 29, 2017 at 3:56 PM, Ian Lance Taylor <iant@golang.org> wrote:
> On Fri, Sep 29, 2017 at 1:38 AM, Alex Potapenko <opotapenko@gmail.com>
> wrote:
> >
> > Building GCC 7.2.0 libgo against uClibc-ng 1.0.26 results in the
> following
> > error:
> >
> >> runtime_sysinfo.go:418:17: error: use of undefined type
> >> ‘___uclibc_locale_struct’
> >
> >
> > This happens because -fdump-go-spec probably generates types only from
> > typedef declarations, ignoring structs, like "struct
> > __uclibc_locale_struct;" in uClibc-ng <bits/uClibc_locale.h> header.
> Adding
> > "typedef struct __uclibc_locale_struct __uclibc_locale_struct;" to
> > libgo/sysinfo.c remedies this issue:
> >
> > --- a/libgo/sysinfo.c
> > +++ b/libgo/sysinfo.c
> > @@ -277,3 +277,7 @@
> > epoll_data_offset = offsetof(struct epoll_event, data)
> > };
> > #endif
> > +
> > +#ifdef __UCLIBC__
> > +typedef struct __uclibc_locale_struct __uclibc_locale_struct;
> > +#endif
>
> -fdump-go-spec doesn't ignore structs, so I feel like there may be
> something else going on. Could you send the generated gen-sysinfo.go
> file (without your patch)? Thanks.
>
> Ian
>
Maybe, -fdump-go-spec chokes on declared structs that are missing
definition? In uClibc-ng struct __uclibc_locale_struct definition is
private, in the <bits/uClibc_locale.h> header (see below for the reference)
it's defined as an abstract struct:
> struct __uclibc_locale_struct;
The list doesn't accept attachments, so I'm using paste.bin.
uClibc_locale.h first: https://pastebin.com/NPscqw1j
And gen-sysinfo.go next: https://pastebin.com/ts54YD3A
Thanks,
Alex
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LIBGO PATCH] Fix compilation error against uClibc-ng: runtime_sysinfo.go: error: use of undefined type ‘___uclibc_locale_struct’
2017-09-29 13:29 ` Alex Potapenko
@ 2017-09-29 13:44 ` Ian Lance Taylor
2017-09-29 14:08 ` Alex Potapenko
0 siblings, 1 reply; 7+ messages in thread
From: Ian Lance Taylor @ 2017-09-29 13:44 UTC (permalink / raw)
To: Alex Potapenko; +Cc: gcc-patches, Waldemar Brodkorb
[-- Attachment #1: Type: text/plain, Size: 2199 bytes --]
On Fri, Sep 29, 2017 at 6:28 AM, Alex Potapenko <opotapenko@gmail.com> wrote:
> (Sorry for the rerepost: the list doesn't accept any attachments)
>
> Hi Ian,
>
> On Fri, Sep 29, 2017 at 3:56 PM, Ian Lance Taylor <iant@golang.org> wrote:
>>
>> On Fri, Sep 29, 2017 at 1:38 AM, Alex Potapenko <opotapenko@gmail.com>
>> wrote:
>> >
>> > Building GCC 7.2.0 libgo against uClibc-ng 1.0.26 results in the
>> > following
>> > error:
>> >
>> >> runtime_sysinfo.go:418:17: error: use of undefined type
>> >> ‘___uclibc_locale_struct’
>> >
>> >
>> > This happens because -fdump-go-spec probably generates types only from
>> > typedef declarations, ignoring structs, like "struct
>> > __uclibc_locale_struct;" in uClibc-ng <bits/uClibc_locale.h> header.
>> > Adding
>> > "typedef struct __uclibc_locale_struct __uclibc_locale_struct;" to
>> > libgo/sysinfo.c remedies this issue:
>> >
>> > --- a/libgo/sysinfo.c
>> > +++ b/libgo/sysinfo.c
>> > @@ -277,3 +277,7 @@
>> > epoll_data_offset = offsetof(struct epoll_event, data)
>> > };
>> > #endif
>> > +
>> > +#ifdef __UCLIBC__
>> > +typedef struct __uclibc_locale_struct __uclibc_locale_struct;
>> > +#endif
>>
>> -fdump-go-spec doesn't ignore structs, so I feel like there may be
>> something else going on. Could you send the generated gen-sysinfo.go
>> file (without your patch)? Thanks.
>>
>> Ian
>
>
> Maybe, -fdump-go-spec chokes on declared structs that are missing
> definition? In uClibc-ng struct __uclibc_locale_struct definition is
> private, in the <bits/uClibc_locale.h> header (see below for the reference)
> it's defined as an abstract struct:
>>
>> struct __uclibc_locale_struct;
>
>
> The list doesn't accept attachments, so I'm using paste.bin.
>
> uClibc_locale.h first: https://pastebin.com/NPscqw1j
>
> And gen-sysinfo.go next: https://pastebin.com/ts54YD3A
Thanks. Yes, the problem is that -fdump-go-spec is faithfully
reporting a dangling type definition, which is fine in C but not in
Go. Since we don't care about any of the locale stuff anyhow, I'm
inclined to a patch like the appended. Can you see if this fixes the
problem on your system? Thanks.
Ian
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 454 bytes --]
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index f7e88a6d..cbe5b979 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -34,6 +34,7 @@ grep -v '^// ' gen-sysinfo.go | \
grep -v '^type _timespec ' | \
grep -v '^type _timestruc_t ' | \
grep -v '^type _epoll_' | \
+ grep -v '^type _*locale[_ ]' | \
grep -v 'in6_addr' | \
grep -v 'sockaddr_in6' | \
sed -e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1Timeval\2/g' \
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LIBGO PATCH] Fix compilation error against uClibc-ng: runtime_sysinfo.go: error: use of undefined type ‘___uclibc_locale_struct’
2017-09-29 13:44 ` Ian Lance Taylor
@ 2017-09-29 14:08 ` Alex Potapenko
2017-09-29 14:15 ` Ian Lance Taylor
0 siblings, 1 reply; 7+ messages in thread
From: Alex Potapenko @ 2017-09-29 14:08 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc-patches, Waldemar Brodkorb
On Fri, Sep 29, 2017 at 4:44 PM, Ian Lance Taylor <iant@golang.org> wrote:
>
> Thanks. Yes, the problem is that -fdump-go-spec is faithfully
> reporting a dangling type definition, which is fine in C but not in
> Go. Since we don't care about any of the locale stuff anyhow, I'm
> inclined to a patch like the appended. Can you see if this fixes the
> problem on your system? Thanks.
>
After I apply your patch, and additionally patch libgo/mkrsysinfo.sh in the
similar fashion, it does fix the problem:
--- a/libgo/mkrsysinfo.sh
+++ b/libgo/mkrsysinfo.sh
@@ -23,6 +23,7 @@
grep -v '^type _timespec_t ' | \
grep -v '^type _timespec ' | \
grep -v '^type _epoll_' | \
+ grep -v '^type _*locale[_ ]' | \
grep -v 'in6_addr' | \
grep -v 'sockaddr_in6' | \
sed -e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1timeval\2/g' \
Thanks,
Alex
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LIBGO PATCH] Fix compilation error against uClibc-ng: runtime_sysinfo.go: error: use of undefined type ‘___uclibc_locale_struct’
2017-09-29 14:08 ` Alex Potapenko
@ 2017-09-29 14:15 ` Ian Lance Taylor
2017-09-29 14:45 ` Alex Potapenko
0 siblings, 1 reply; 7+ messages in thread
From: Ian Lance Taylor @ 2017-09-29 14:15 UTC (permalink / raw)
To: Alex Potapenko; +Cc: gcc-patches, Waldemar Brodkorb, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 996 bytes --]
On Fri, Sep 29, 2017 at 7:08 AM, Alex Potapenko <opotapenko@gmail.com> wrote:
> On Fri, Sep 29, 2017 at 4:44 PM, Ian Lance Taylor <iant@golang.org> wrote:
>>
>> Thanks. Yes, the problem is that -fdump-go-spec is faithfully
>> reporting a dangling type definition, which is fine in C but not in
>> Go. Since we don't care about any of the locale stuff anyhow, I'm
>> inclined to a patch like the appended. Can you see if this fixes the
>> problem on your system? Thanks.
>
>
> After I apply your patch, and additionally patch libgo/mkrsysinfo.sh in the
> similar fashion, it does fix the problem:
>
> --- a/libgo/mkrsysinfo.sh
> +++ b/libgo/mkrsysinfo.sh
> @@ -23,6 +23,7 @@
> grep -v '^type _timespec_t ' | \
> grep -v '^type _timespec ' | \
> grep -v '^type _epoll_' | \
> + grep -v '^type _*locale[_ ]' | \
> grep -v 'in6_addr' | \
> grep -v 'sockaddr_in6' | \
> sed -e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1timeval\2/g' \
Thanks. Committed to mainline.
Ian
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1391 bytes --]
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE (revision 253236)
+++ gcc/go/gofrontend/MERGE (working copy)
@@ -1,4 +1,4 @@
-11b7dae7de94215e92eb46e703cfecd76c0a3282
+9a9d526a4c0a7f5b3635034b3e1dc3bbe6380dd2
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
Index: libgo/mkrsysinfo.sh
===================================================================
--- libgo/mkrsysinfo.sh (revision 253025)
+++ libgo/mkrsysinfo.sh (working copy)
@@ -23,6 +23,7 @@ grep -v '^// ' gen-sysinfo.go | \
grep -v '^type _timespec_t ' | \
grep -v '^type _timespec ' | \
grep -v '^type _epoll_' | \
+ grep -v '^type _*locale[_ ]' | \
grep -v 'in6_addr' | \
grep -v 'sockaddr_in6' | \
sed -e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1timeval\2/g' \
Index: libgo/mksysinfo.sh
===================================================================
--- libgo/mksysinfo.sh (revision 253025)
+++ libgo/mksysinfo.sh (working copy)
@@ -34,6 +34,7 @@ grep -v '^// ' gen-sysinfo.go | \
grep -v '^type _timespec ' | \
grep -v '^type _timestruc_t ' | \
grep -v '^type _epoll_' | \
+ grep -v '^type _*locale[_ ]' | \
grep -v 'in6_addr' | \
grep -v 'sockaddr_in6' | \
sed -e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1Timeval\2/g' \
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LIBGO PATCH] Fix compilation error against uClibc-ng: runtime_sysinfo.go: error: use of undefined type ‘___uclibc_locale_struct’
2017-09-29 14:15 ` Ian Lance Taylor
@ 2017-09-29 14:45 ` Alex Potapenko
0 siblings, 0 replies; 7+ messages in thread
From: Alex Potapenko @ 2017-09-29 14:45 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc-patches, Waldemar Brodkorb, gofrontend-dev
On Fri, Sep 29, 2017 at 5:15 PM, Ian Lance Taylor <iant@golang.org> wrote:
>
> Thanks. Committed to mainline.
>
Great, thanks!
--
Best regards,
Alex Potapenko
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-09-29 14:45 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-29 8:38 [LIBGO PATCH] Fix compilation error against uClibc-ng: runtime_sysinfo.go: error: use of undefined type ‘___uclibc_locale_struct’ Alex Potapenko
2017-09-29 12:56 ` Ian Lance Taylor
2017-09-29 13:29 ` Alex Potapenko
2017-09-29 13:44 ` Ian Lance Taylor
2017-09-29 14:08 ` Alex Potapenko
2017-09-29 14:15 ` Ian Lance Taylor
2017-09-29 14:45 ` Alex Potapenko
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).