Github messages for voidlinux
 help / color / mirror / Atom feed
* [ISSUE] gcc fails to build with gccgo enabled for cross targets since gcc10
@ 2021-01-21 11:24 q66
  2021-01-21 11:27 ` q66
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: q66 @ 2021-01-21 11:24 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1036 bytes --]

New issue by q66 on void-packages repository

https://github.com/void-linux/void-packages/issues/28076

Description:
getting output like this: https://build.voidlinux.org/builders/aarch64-musl_builder/builds/31247/steps/shell_3/logs/stdio

```
...
/usr/lib/gcc/aarch64-linux-musl/10.2.1/../../../../aarch64-linux-musl/bin/ld: /usr/aarch64-linux-musl/usr/lib/libgo.so: undefined reference to `getcontext'
/usr/lib/gcc/aarch64-linux-musl/10.2.1/../../../../aarch64-linux-musl/bin/ld: /usr/aarch64-linux-musl/usr/lib/libgo.so: undefined reference to `makecontext'
/usr/lib/gcc/aarch64-linux-musl/10.2.1/../../../../aarch64-linux-musl/bin/ld: /usr/aarch64-linux-musl/usr/lib/libgo.so: undefined reference to `setcontext'
...
```

which indicates that something is wrong with libgo in the crosstoolchain; not exactly sure what's going on here

for now i disabled gccgo for cross+musl, but once we've figured this out we will need to reenable it and revbump gcc

could use some help figuring this out

@pullmoll @Johnnynator 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcc fails to build with gccgo enabled for cross targets since gcc10
  2021-01-21 11:24 [ISSUE] gcc fails to build with gccgo enabled for cross targets since gcc10 q66
@ 2021-01-21 11:27 ` q66
  2021-01-21 11:30 ` q66
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: q66 @ 2021-01-21 11:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 966 bytes --]

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/issues/28076#issuecomment-764575907

Comment:
this also seems easily reproducible in the crosscompiler:

```
$ cat test.go
package main
func main() {}
$ aarch64-linux-musl-gccgo test.go -o test
/usr/lib/gcc/aarch64-linux-musl/10.2.1/../../../../aarch64-linux-musl/bin/ld: /usr/lib/gcc/aarch64-linux-musl/10.2.1/../../../../aarch64-linux-musl/lib/../lib64/libgo.so: undefined reference to `getcontext'
/usr/lib/gcc/aarch64-linux-musl/10.2.1/../../../../aarch64-linux-musl/bin/ld: /usr/lib/gcc/aarch64-linux-musl/10.2.1/../../../../aarch64-linux-musl/lib/../lib64/libgo.so: undefined reference to `makecontext'
/usr/lib/gcc/aarch64-linux-musl/10.2.1/../../../../aarch64-linux-musl/bin/ld: /usr/lib/gcc/aarch64-linux-musl/10.2.1/../../../../aarch64-linux-musl/lib/../lib64/libgo.so: undefined reference to `setcontext'
collect2: error: ld returned 1 exit status
```

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcc fails to build with gccgo enabled for cross targets since gcc10
  2021-01-21 11:24 [ISSUE] gcc fails to build with gccgo enabled for cross targets since gcc10 q66
  2021-01-21 11:27 ` q66
@ 2021-01-21 11:30 ` q66
  2021-01-21 12:43 ` pullmoll
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: q66 @ 2021-01-21 11:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 286 bytes --]

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/issues/28076#issuecomment-764577698

Comment:
looks like we'll have to fix the crosscompilers and then rebuild them; once they're fixed (i.e. the above should compile) we can re-bump gcc itself

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcc fails to build with gccgo enabled for cross targets since gcc10
  2021-01-21 11:24 [ISSUE] gcc fails to build with gccgo enabled for cross targets since gcc10 q66
  2021-01-21 11:27 ` q66
  2021-01-21 11:30 ` q66
@ 2021-01-21 12:43 ` pullmoll
  2021-01-21 13:05 ` pullmoll
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pullmoll @ 2021-01-21 12:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 353 bytes --]

New comment by pullmoll on void-packages repository

https://github.com/void-linux/void-packages/issues/28076#issuecomment-764618038

Comment:
It worked with 10.2.0 so the alpine gcc 10.2.1pre1 has a change which breaks linking because `-lucontext` is missing in the linker flags. A diff between 10.2.0 and 10.2.1pre1 should help. I'll take a look now.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcc fails to build with gccgo enabled for cross targets since gcc10
  2021-01-21 11:24 [ISSUE] gcc fails to build with gccgo enabled for cross targets since gcc10 q66
                   ` (2 preceding siblings ...)
  2021-01-21 12:43 ` pullmoll
@ 2021-01-21 13:05 ` pullmoll
  2021-01-21 13:15 ` q66
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pullmoll @ 2021-01-21 13:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 456 bytes --]

New comment by pullmoll on void-packages repository

https://github.com/void-linux/void-packages/issues/28076#issuecomment-764629543

Comment:
The diff has nothing which would explain the issue AFAICT.
Actually `-lucontext` is there in the build log https://build.voidlinux.org/builders/x86_64_builder/builds/29895/steps/shell_3/logs/stdio for e.g. `cross-aarch64-linux-musl`, the last package. Is this linking against the static `libucontext.a`, though?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcc fails to build with gccgo enabled for cross targets since gcc10
  2021-01-21 11:24 [ISSUE] gcc fails to build with gccgo enabled for cross targets since gcc10 q66
                   ` (3 preceding siblings ...)
  2021-01-21 13:05 ` pullmoll
@ 2021-01-21 13:15 ` q66
  2021-01-21 13:19 ` q66
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: q66 @ 2021-01-21 13:15 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2179 bytes --]

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/issues/28076#issuecomment-764635359

Comment:
i figured it out

because we override `CFLAGS` for the "internal" static build of `libucontext`, it never has `-DEXPORT_UNPREFIXED`, which means only the `libucontext_` prefixed symbols are contained in the library

what i'm going to do is thís:

```
From 6d6c80991683656d69e715efc8cab6c9c77160cd Mon Sep 17 00:00:00 2001
From: Daniel Kolesa <daniel@octaforge.org>
Date: Thu, 21 Jan 2021 14:13:32 +0100
Subject: [PATCH] gcc: patch gccgo on musl to allow usage of freestanding
 libucontext

---
 srcpkgs/gcc/files/gccgo-musl.patch | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/srcpkgs/gcc/files/gccgo-musl.patch b/srcpkgs/gcc/files/gccgo-musl.patch
index 9b3f3af9b7..1b1045b31d 100644
--- a/srcpkgs/gcc/files/gccgo-musl.patch
+++ b/srcpkgs/gcc/files/gccgo-musl.patch
@@ -186,6 +186,25 @@ URL: https://code.foxkit.us/adelie/packages/tree/master/system/gcc
  	  {
  		mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
  		int i;
+--- libgo/runtime/runtime.h
++++ libgo/runtime/runtime.h
+@@ -500,10 +500,13 @@ int __go_setcontext(__go_context_t*);
+ void __go_makecontext(__go_context_t*, void (*)(), void*, size_t);
+ #else
+ #define __go_context_t	ucontext_t
+-#define __go_getcontext(c)	getcontext(c)
+-#define __go_setcontext(c)	setcontext(c)
++int  libucontext_getcontext(__go_context_t *);
++void libucontext_makecontext(__go_context_t *, void (*)(), int, ...);
++int  libucontext_setcontext(const __go_context_t *);
++#define __go_getcontext(c)	libucontext_getcontext(c)
++#define __go_setcontext(c)	libucontext_setcontext(c)
+ #define __go_makecontext(c, fn, sp, size) \
+-	((c)->uc_stack.ss_sp = sp, (c)->uc_stack.ss_size = size, makecontext(c, fn, 0))
++	((c)->uc_stack.ss_sp = sp, (c)->uc_stack.ss_size = size, libucontext_makecontext(c, fn, 0))
+ #endif
+ 
+ // Symbols defined by the linker.
 --- libgo/sysinfo.c
 +++ libgo/sysinfo.c
 @@ -73,9 +73,6 @@
-- 
2.30.0
```

and then bump the respective crosstoolchains and that should fix the problem

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcc fails to build with gccgo enabled for cross targets since gcc10
  2021-01-21 11:24 [ISSUE] gcc fails to build with gccgo enabled for cross targets since gcc10 q66
                   ` (4 preceding siblings ...)
  2021-01-21 13:15 ` q66
@ 2021-01-21 13:19 ` q66
  2021-01-21 13:19 ` pullmoll
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: q66 @ 2021-01-21 13:19 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2433 bytes --]

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/issues/28076#issuecomment-764635359

Comment:
i figured it out

because we override `CFLAGS` for the "internal" static build of `libucontext`, it never has `-DEXPORT_UNPREFIXED`, which means only the `libucontext_` prefixed symbols are contained in the library

what i'm going to do is thís:

```
From 6d6c80991683656d69e715efc8cab6c9c77160cd Mon Sep 17 00:00:00 2001
From: Daniel Kolesa <daniel@octaforge.org>
Date: Thu, 21 Jan 2021 14:13:32 +0100
Subject: [PATCH] gcc: patch gccgo on musl to allow usage of freestanding
 libucontext

---
 srcpkgs/gcc/files/gccgo-musl.patch | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/srcpkgs/gcc/files/gccgo-musl.patch b/srcpkgs/gcc/files/gccgo-musl.patch
index 9b3f3af9b7..1b1045b31d 100644
--- a/srcpkgs/gcc/files/gccgo-musl.patch
+++ b/srcpkgs/gcc/files/gccgo-musl.patch
@@ -186,6 +186,25 @@ URL: https://code.foxkit.us/adelie/packages/tree/master/system/gcc
  	  {
  		mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
  		int i;
+--- libgo/runtime/runtime.h
++++ libgo/runtime/runtime.h
+@@ -500,10 +500,13 @@ int __go_setcontext(__go_context_t*);
+ void __go_makecontext(__go_context_t*, void (*)(), void*, size_t);
+ #else
+ #define __go_context_t	ucontext_t
+-#define __go_getcontext(c)	getcontext(c)
+-#define __go_setcontext(c)	setcontext(c)
++int  libucontext_getcontext(__go_context_t *);
++void libucontext_makecontext(__go_context_t *, void (*)(), int, ...);
++int  libucontext_setcontext(const __go_context_t *);
++#define __go_getcontext(c)	libucontext_getcontext(c)
++#define __go_setcontext(c)	libucontext_setcontext(c)
+ #define __go_makecontext(c, fn, sp, size) \
+-	((c)->uc_stack.ss_sp = sp, (c)->uc_stack.ss_size = size, makecontext(c, fn, 0))
++	((c)->uc_stack.ss_sp = sp, (c)->uc_stack.ss_size = size, libucontext_makecontext(c, fn, 0))
+ #endif
+ 
+ // Symbols defined by the linker.
 --- libgo/sysinfo.c
 +++ libgo/sysinfo.c
 @@ -73,9 +73,6 @@
-- 
2.30.0
```

and then bump the respective crosstoolchains and that should fix the problem

(we could also add `-DEXPORT_UNPREFIXED` in the `CFLAGS` for `libucontext` in `void-cross` build-style, but i like this better, since this is the canonical API of `libucontext` and allows us to carry less symbol bloat in the linked-in static library)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcc fails to build with gccgo enabled for cross targets since gcc10
  2021-01-21 11:24 [ISSUE] gcc fails to build with gccgo enabled for cross targets since gcc10 q66
                   ` (5 preceding siblings ...)
  2021-01-21 13:19 ` q66
@ 2021-01-21 13:19 ` pullmoll
  2021-01-21 13:20 ` q66
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pullmoll @ 2021-01-21 13:19 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 373 bytes --]

New comment by pullmoll on void-packages repository

https://github.com/void-linux/void-packages/issues/28076#issuecomment-764637454

Comment:
Fine!
I found out I didn't see this with gcc `10.2.0` because I had a **modified** `common/build-styles/void-cross.sh` in my branch, and which I dropped with master update to `10.2.1pre1`. There I had the define in the CFLAGS...

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [ISSUE] [CLOSED] gcc fails to build with gccgo enabled for cross targets since gcc10
  2021-01-21 11:24 [ISSUE] gcc fails to build with gccgo enabled for cross targets since gcc10 q66
                   ` (7 preceding siblings ...)
  2021-01-21 13:20 ` q66
@ 2021-01-21 13:20 ` q66
  2021-01-21 13:20 ` pullmoll
  2021-01-21 13:33 ` q66
  10 siblings, 0 replies; 12+ messages in thread
From: q66 @ 2021-01-21 13:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1039 bytes --]

Closed issue by q66 on void-packages repository

https://github.com/void-linux/void-packages/issues/28076

Description:
getting output like this: https://build.voidlinux.org/builders/aarch64-musl_builder/builds/31247/steps/shell_3/logs/stdio

```
...
/usr/lib/gcc/aarch64-linux-musl/10.2.1/../../../../aarch64-linux-musl/bin/ld: /usr/aarch64-linux-musl/usr/lib/libgo.so: undefined reference to `getcontext'
/usr/lib/gcc/aarch64-linux-musl/10.2.1/../../../../aarch64-linux-musl/bin/ld: /usr/aarch64-linux-musl/usr/lib/libgo.so: undefined reference to `makecontext'
/usr/lib/gcc/aarch64-linux-musl/10.2.1/../../../../aarch64-linux-musl/bin/ld: /usr/aarch64-linux-musl/usr/lib/libgo.so: undefined reference to `setcontext'
...
```

which indicates that something is wrong with libgo in the crosstoolchain; not exactly sure what's going on here

for now i disabled gccgo for cross+musl, but once we've figured this out we will need to reenable it and revbump gcc

could use some help figuring this out

@pullmoll @Johnnynator 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcc fails to build with gccgo enabled for cross targets since gcc10
  2021-01-21 11:24 [ISSUE] gcc fails to build with gccgo enabled for cross targets since gcc10 q66
                   ` (6 preceding siblings ...)
  2021-01-21 13:19 ` pullmoll
@ 2021-01-21 13:20 ` q66
  2021-01-21 13:20 ` [ISSUE] [CLOSED] " q66
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: q66 @ 2021-01-21 13:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 257 bytes --]

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/issues/28076#issuecomment-764637773

Comment:
yes, i had it too at one point, but it seems some last-minute changes accidentally dropped it... oh well, shit happens

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcc fails to build with gccgo enabled for cross targets since gcc10
  2021-01-21 11:24 [ISSUE] gcc fails to build with gccgo enabled for cross targets since gcc10 q66
                   ` (8 preceding siblings ...)
  2021-01-21 13:20 ` [ISSUE] [CLOSED] " q66
@ 2021-01-21 13:20 ` pullmoll
  2021-01-21 13:33 ` q66
  10 siblings, 0 replies; 12+ messages in thread
From: pullmoll @ 2021-01-21 13:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 400 bytes --]

New comment by pullmoll on void-packages repository

https://github.com/void-linux/void-packages/issues/28076#issuecomment-764637454

Comment:
Fine!
I found out I didn't see this with gcc `10.2.0` because I had a **modified** `common/build-styles/void-cross.sh` in my branch, and which I dropped with master update to `10.2.1pre1`. There I had the defined the `-DEXPORT_UNPREFIXED` in the CFLAGS...

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcc fails to build with gccgo enabled for cross targets since gcc10
  2021-01-21 11:24 [ISSUE] gcc fails to build with gccgo enabled for cross targets since gcc10 q66
                   ` (9 preceding siblings ...)
  2021-01-21 13:20 ` pullmoll
@ 2021-01-21 13:33 ` q66
  10 siblings, 0 replies; 12+ messages in thread
From: q66 @ 2021-01-21 13:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 290 bytes --]

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/issues/28076#issuecomment-764645442

Comment:
looks like the fix works, i have a crosstoolchain now that no longer fails... gonna test a native gcc build as well as a crossbuild of gcc just in case

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-01-21 13:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-21 11:24 [ISSUE] gcc fails to build with gccgo enabled for cross targets since gcc10 q66
2021-01-21 11:27 ` q66
2021-01-21 11:30 ` q66
2021-01-21 12:43 ` pullmoll
2021-01-21 13:05 ` pullmoll
2021-01-21 13:15 ` q66
2021-01-21 13:19 ` q66
2021-01-21 13:19 ` pullmoll
2021-01-21 13:20 ` q66
2021-01-21 13:20 ` [ISSUE] [CLOSED] " q66
2021-01-21 13:20 ` pullmoll
2021-01-21 13:33 ` q66

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 NNTP newsgroup(s).