GNU bug report logs - #36823
gcc bug prevents go program from starting newer gcc results in race condition

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix; Reported by: Malte Frank Gerdes <malte.f.gerdes@HIDDEN>; dated Sat, 27 Jul 2019 17:01:02 UTC; Maintainer for guix is bug-guix@HIDDEN.

Message received at 36823 <at> debbugs.gnu.org:


Received: (at 36823) by debbugs.gnu.org; 4 Jul 2021 20:42:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 04 16:42:02 2021
Received: from localhost ([127.0.0.1]:43318 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1m08wE-00036Z-6F
	for submit <at> debbugs.gnu.org; Sun, 04 Jul 2021 16:42:02 -0400
Received: from out2.migadu.com ([188.165.223.204]:17556)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <iskarian@HIDDEN>) id 1m08wB-00036I-3i
 for 36823 <at> debbugs.gnu.org; Sun, 04 Jul 2021 16:42:00 -0400
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1;
 t=1625431317;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=sYprEYHilqeot5IZBTcN54PSRHKzggDSdn5xsF5VJ8k=;
 b=QlHKVp6ITawvxwmerEiBHWnLLlgf0kdY9boTU0hSgddHDT6VC9BEDCVWnHNsdgYS/mA2En
 TJROXIB6HXaafxvKBLonmWr0FI67Zd9yzU9DmqW/5TGjJw2Z0tTtweb7ZgW7v//p38VIpn
 96Ck0hU/658VHeoDNcBVa9lSr+xhORU=
From: Sarah Morgensen <iskarian@HIDDEN>
To: Malte Frank Gerdes <malte.f.gerdes@HIDDEN>
Subject: Re: bug#36823: gcc bug prevents go program from starting newer gcc
 results in race condition
References: <86wog3tove.fsf@HIDDEN>
Date: Sun, 04 Jul 2021 13:41:54 -0700
In-Reply-To: <86wog3tove.fsf@HIDDEN> (Malte Frank Gerdes's message of "Sat, 
 27 Jul 2019 18:37:41 +0200")
Message-ID: <86fswtak19.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Migadu-Flow: FLOW_OUT
X-Migadu-Auth-User: iskarian@HIDDEN
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 36823
Cc: 36823 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain


Hello,

Thanks for the report.

Malte Frank Gerdes <malte.f.gerdes@HIDDEN> writes:

> Hi,
>
> The precompiled version of Hugo-extended was not able to find some
> runtime dependencies:
>    libstdc++.so.6  => not found
>    libgcc_s.so.1   => not found

In case you haven't discovered this in the past two years (oops), this
is because Guix does not typically work with pre-compiled software that
relies on system libraries being in /lib, since there is no system-wide
/lib.

> This seems like a version mismatch to me, so i built Hugo with the
> following command:
>   go build --tags extended
>
> Now the error is (<HASH> = ypiv8dj4lkvsnm82s639h18l87frrh5g):
>   /gnu/store/<HASH>-gcc-6.5.0-lib/lib/libstdc++.so.6: version
>   `GLIBCXX_3.4.26' not found

If I build hugo with gcc-toolchain@7 in my user profile, it works fine.
However.... I can still repro this issue with gcc-toolchain@8+:

$ go build --tags extended
$ ./hugo --help
./hugo: /gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib/lib/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by ./hugo)
./hugo: /gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib/lib/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by ./hugo)

This is because gcc 7's libraries are shadowing the newer gcc's
libraries:

$ readelf -d hugo | grep RUNPATH
 0x000000000000001d (RUNPATH)            Library runpath: [/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib/lib:/gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib:/gnu/store/3h7xd0d47a286b6r9qhz4ybi5iaxkfwi-gcc-11.1.0-lib/lib:/home/sarah/.guix-profile/lib:/gnu/store/3h7xd0d47a286b6r9qhz4ybi5iaxkfwi-gcc-11.1.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.1.0/../../..]

If I use patchelf to remove the gcc 7 library dir from RUNPATH, hugo
works fine. This is because Go is patched to unconditionally add a
runpath to gcc 7's libraries but erroneously does not explicitly set
CXX. (See also <https://issues.guix.gnu.org/39400>.)

The following patch should explicitly set CXX for Go, so that it always
uses the "system" version:


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline; filename=go-explicitly-set-CXX.patch
Content-Description: go-explicitly-set-CXX.patch

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 0318918a37..a27f57aa30 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -395,6 +395,7 @@ in the style of communicating sequential processes (@dfn{CSP}).")
                ;; FIXME: Some of the .a files are not bit-reproducible.
                (let* ((output (assoc-ref outputs "out")))
                  (setenv "CC" (which "gcc"))
+                 (setenv "CXX" (which "g++"))
                  (setenv "GOOS" "linux")
                  (setenv "GOROOT" (dirname (getcwd)))
                  (setenv "GOROOT_FINAL" output)
@@ -577,6 +578,7 @@ in the style of communicating sequential processes (@dfn{CSP}).")
                       (loader (string-append (assoc-ref inputs "libc")
                                              ,(glibc-dynamic-linker))))
                  (setenv "CC" (which "gcc"))
+                 (setenv "CXX" (which "g++"))
                  (setenv "GO_LDSO" loader)
                  (setenv "GOOS" "linux")
                  (setenv "GOROOT" (dirname (getcwd)))

--=-=-=
Content-Type: text/plain


Hope that helps,
Sarah

--=-=-=--




Information forwarded to bug-guix@HIDDEN:
bug#36823; Package guix. Full text available.
bug reassigned from package 'debbugs.gnu.org' to 'guix'. Request was from Glenn Morris <rgm@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 27 Jul 2019 17:00:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 27 13:00:59 2019
Received: from localhost ([127.0.0.1]:45328 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hrQ42-0005lo-G1
	for submit <at> debbugs.gnu.org; Sat, 27 Jul 2019 13:00:58 -0400
Received: from mail-wr1-f44.google.com ([209.85.221.44]:42409)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <malte.f.gerdes@HIDDEN>) id 1hrPhd-0002u2-7d
 for submit <at> debbugs.gnu.org; Sat, 27 Jul 2019 12:37:50 -0400
Received: by mail-wr1-f44.google.com with SMTP id x1so7540903wrr.9
 for <submit <at> debbugs.gnu.org>; Sat, 27 Jul 2019 09:37:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:user-agent:mime-version;
 bh=K/+/B50d6HFNAMUK/sYC3jXUFeX9XmXL4AAqPKB9OWM=;
 b=PmwIaHYlNBo7MMFoI6vmomVOVB7DWnP2/g7wM7VC2VCLXbxBEQxc/jbPX3qtTy9POx
 rEpjobDLdCRH72Ht0kJ6VX7vecheXz922Mk7CdoCoC4ued2o5T5NBpCg5JWV5UpNEm+X
 yQYivK+44+hgSOxHxLAlBS5Q1vkhdWm//yV0QLjwZ6gn/4NK3YpxA0f3n1c9MrrrTgVj
 J+PvAEUfLuXq1JXyfzyEoRnDrDqY7/C3kUT/JWSgS7s+Q5xCQA87sAB8jMPZ2q/tsVwK
 wEZQ1m78HVL0KA3dMh/1Y/o5+Kpz1B8tJkOExYDBjqsvgCryg40GLsrkFXO1WgDNOj/h
 MQGw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:user-agent
 :mime-version;
 bh=K/+/B50d6HFNAMUK/sYC3jXUFeX9XmXL4AAqPKB9OWM=;
 b=MRIPgSUFdHO3DpVO2Xr1wMJm19KNSLoQXXfCdsHQFvXiDl5Fbkt/mHaUzqHjxM4iA/
 P4gYzXhAzFArGo08TmZY+mUjRykhje3lthrbfCra17qd39CtQw6S06y8ZcwNTLuCDhzL
 tigt7fNJOKFjPH7uRGgGtRMLqQ+yl5/BeE39FXO/Bx3htXt+d74EbS7/v6bFkyrZ39a5
 g5nzW0OUHg+ZWff9gaAovFZ0HGUtIUZ/w0wVvzVY+pS7pG+ZJkDAL5x2yz5MjpJfhEbW
 HQZv7SsjuRzxO3pnyOvMBoqiCtAN2vHHi6CKU5gXZAU779hemwUYuhQXjzgEghnQECz2
 INFg==
X-Gm-Message-State: APjAAAWHrEzai6UEpXwOH/zBYRKEANMaYf4qPUYwNBXT/fZAUTHVpSML
 dDs/Kn5m2GWYCmlef3pmIZomxWn0
X-Google-Smtp-Source: APXvYqyhOb7GTLopNIzVYfB6Un1EfZbeN5XbQCWTFpsncsIFYRVnJb7bKxhCrw9w4fzM7OB2slWFJA==
X-Received: by 2002:adf:80e1:: with SMTP id 88mr22426383wrl.127.1564245462906; 
 Sat, 27 Jul 2019 09:37:42 -0700 (PDT)
Received: from Morphium (ip-95-223-41-27.hsi16.unitymediagroup.de.
 [95.223.41.27])
 by smtp.gmail.com with ESMTPSA id i12sm66136561wrx.61.2019.07.27.09.37.42
 for <submit <at> debbugs.gnu.org>
 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);
 Sat, 27 Jul 2019 09:37:42 -0700 (PDT)
From: Malte Frank Gerdes <malte.f.gerdes@HIDDEN>
To: submit <at> debbugs.gnu.org
Subject: gcc bug prevents go program from starting newer gcc results in race
 condition
Date: Sat, 27 Jul 2019 18:37:41 +0200
Message-ID: <86wog3tove.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sat, 27 Jul 2019 13:00:58 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

The precompiled version of Hugo-extended was not able to find some
runtime dependencies:
   libstdc++.so.6  => not found
   libgcc_s.so.1   => not found

This seems like a version mismatch to me, so i built Hugo with the
following command:
  go build --tags extended

Now the error is (<HASH> = ypiv8dj4lkvsnm82s639h18l87frrh5g):
  /gnu/store/<HASH>-gcc-6.5.0-lib/lib/libstdc++.so.6: version
  `GLIBCXX_3.4.26' not found

The problem seems identical to [1].

I copmiled go-1.4 with gcc:lib from 7, 8 and 9 with no luck (the 9
variant even fails the tests due to a race condition somewhere, i read
that in some other bug report but can't find the ID). Error Message at
the end.

So is there any progress on this? I guess this is necessary to make the
execution of hugo-extended (and maybe other programs?) work.


[1]: https://stackoverflow.com/questions/52663287/glibcxx-3-4-26-not-found

-Malte

##### ../misc/cgo/testsanitizers
--- FAIL: TestShared (0.02s)
    --- FAIL: TestShared/tsan_shared (2.04s)
        cshared_test.go:71: `/tmp/guix-build-go-1.12.7.drv-0/TestShared821009189/tsan_shared` exited with exit status 66
            ==================
            WARNING: ThreadSanitizer: data race (pid=3613)
              Write of size 8 at 0x7ffff6095c20 by thread T1:
                #0 pthread_attr_getstacksize <null> (tsan_shared+0x00000041d5b2)
                #1 x_cgo_init <null> (libtsan_shared.so+0x0000000968e0)
                #2 runtime.rt0_go <null> (libtsan_shared.so+0x00000008cb0e)

              Previous write of size 8 at 0x7ffff6095c20 by main thread:
                #0 <null> <null> (0x000000000001)

              Location is stack of thread T1.

              Thread T1 (tid=3619, running) created by main thread at:
                #0 pthread_create <null> (tsan_shared+0x00000040dec4)
                #1 _cgo_try_pthread_create <null> (libtsan_shared.so+0x0000000967a1)
                #2 x_cgo_sys_thread_create <null> (libtsan_shared.so+0x000000096543)
                #3 _rt0_amd64_lib <null> (libtsan_shared.so+0x00000008ca16)

            SUMMARY: ThreadSanitizer: data race ??:0 pthread_attr_getstacksize
            ==================
            ==================
            WARNING: ThreadSanitizer: data race (pid=3613)
              Read of size 8 at 0x7d080000dfe0 by thread T2:
                #0 threadentry <null> (libtsan_shared.so+0x000000096b03)

              Previous write of size 8 at 0x7d080000dfe0 by thread T1:
                #0 malloc <null> (tsan_shared+0x00000040c2d3)
                #1 x_cgo_thread_start <null> (libtsan_shared.so+0x00000009716c)
                #2 runtime.asmcgocall <null> (libtsan_shared.so+0x00000008e546)

              Location is heap block of size 24 at 0x7d080000dfe0 allocated by thread T1:
                #0 malloc <null> (tsan_shared+0x00000040c2d3)
                #1 x_cgo_thread_start <null> (libtsan_shared.so+0x00000009716c)
                #2 runtime.asmcgocall <null> (libtsan_shared.so+0x00000008e546)

              Thread T2 (tid=3621, running) created by thread T1 at:
                #0 pthread_create <null> (tsan_shared+0x00000040dec4)
                #1 _cgo_try_pthread_create <null> (libtsan_shared.so+0x0000000967a1)
                #2 _cgo_sys_thread_start <null> (libtsan_shared.so+0x000000096a42)
                #3 x_cgo_thread_start <null> (libtsan_shared.so+0x0000000971fa)
                #4 runtime.asmcgocall <null> (libtsan_shared.so+0x00000008e546)

              Thread T1 (tid=3619, running) created by main thread at:
                #0 pthread_create <null> (tsan_shared+0x00000040dec4)
                #1 _cgo_try_pthread_create <null> (libtsan_shared.so+0x0000000967a1)
                #2 x_cgo_sys_thread_create <null> (libtsan_shared.so+0x000000096543)
                #3 _rt0_amd64_lib <null> (libtsan_shared.so+0x00000008ca16)

            SUMMARY: ThreadSanitizer: data race ??:0 threadentry
            ==================
            ==================
            WARNING: ThreadSanitizer: data race (pid=3613)
              Read of size 8 at 0x7ffff7fcc8b8 by thread T2:
                #0 threadentry <null> (libtsan_shared.so+0x000000096b36)

              Previous write of size 8 at 0x7ffff7fcc8b8 by thread T1:
                #0 x_cgo_init <null> (libtsan_shared.so+0x000000096874)
                #1 runtime.rt0_go <null> (libtsan_shared.so+0x00000008cb0e)

              Location is global 'setg_gcc' of size 8 at 0x7ffff7fcc8b8 (libtsan_shared.so+0x00000013a8b8)

              Thread T2 (tid=3621, running) created by thread T1 at:
                #0 pthread_create <null> (tsan_shared+0x00000040dec4)
                #1 _cgo_try_pthread_create <null> (libtsan_shared.so+0x0000000967a1)
                #2 _cgo_sys_thread_start <null> (libtsan_shared.so+0x000000096a42)
                #3 x_cgo_thread_start <null> (libtsan_shared.so+0x0000000971fa)
                #4 runtime.asmcgocall <null> (libtsan_shared.so+0x00000008e546)

              Thread T1 (tid=3619, running) created by main thread at:
                #0 pthread_create <null> (tsan_shared+0x00000040dec4)
                #1 _cgo_try_pthread_create <null> (libtsan_shared.so+0x0000000967a1)
                #2 x_cgo_sys_thread_create <null> (libtsan_shared.so+0x000000096543)
                #3 _rt0_amd64_lib <null> (libtsan_shared.so+0x00000008ca16)

            SUMMARY: ThreadSanitizer: data race ??:0 threadentry
            ==================
            ==================
            WARNING: ThreadSanitizer: data race (pid=3613)
              Read of size 8 at 0x7d080000df80 by thread T6:
                #0 threadentry <null> (libtsan_shared.so+0x000000096b03)

              Previous write of size 8 at 0x7d080000df80 by thread T1:
                #0 malloc <null> (tsan_shared+0x00000040c2d3)
                #1 x_cgo_thread_start <null> (libtsan_shared.so+0x00000009716c)
                #2 runtime.asmcgocall <null> (libtsan_shared.so+0x00000008e507)

              Location is heap block of size 24 at 0x7d080000df80 allocated by thread T1:
                #0 malloc <null> (tsan_shared+0x00000040c2d3)
                #1 x_cgo_thread_start <null> (libtsan_shared.so+0x00000009716c)
                #2 runtime.asmcgocall <null> (libtsan_shared.so+0x00000008e507)

              Thread T6 (tid=3625, running) created by thread T1 at:
                #0 pthread_create <null> (tsan_shared+0x00000040dec4)
                #1 _cgo_try_pthread_create <null> (libtsan_shared.so+0x0000000967a1)
                #2 _cgo_sys_thread_start <null> (libtsan_shared.so+0x000000096a42)
                #3 x_cgo_thread_start <null> (libtsan_shared.so+0x0000000971fa)
                #4 runtime.asmcgocall <null> (libtsan_shared.so+0x00000008e507)

              Thread T1 (tid=3619, running) created by main thread at:
                #0 pthread_create <null> (tsan_shared+0x00000040dec4)
                #1 _cgo_try_pthread_create <null> (libtsan_shared.so+0x0000000967a1)
                #2 x_cgo_sys_thread_create <null> (libtsan_shared.so+0x000000096543)
                #3 _rt0_amd64_lib <null> (libtsan_shared.so+0x00000008ca16)

            SUMMARY: ThreadSanitizer: data race ??:0 threadentry
            ==================
            ThreadSanitizer: reported 4 warnings
FAIL




Acknowledgement sent to Malte Frank Gerdes <malte.f.gerdes@HIDDEN>:
New bug report received and forwarded. Copy sent to help-debbugs@HIDDEN. Full text available.
Report forwarded to help-debbugs@HIDDEN:
bug#36823; Package debbugs.gnu.org. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 4 Jul 2021 20:45:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.