unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Miguel Ángel Arruga Vivas" <rosen644835@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 43579@debbugs.gnu.org, Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: bug#43579: g++ does not provide std::fegetround
Date: Fri, 13 Nov 2020 18:59:53 +0100	[thread overview]
Message-ID: <87r1oxyw6e.fsf@gmail.com> (raw)
In-Reply-To: <87362vhbkl.fsf@gnu.org> ("Ludovic Courtès"'s message of "Sat, 03 Oct 2020 12:02:18 +0200")


[-- Attachment #1.1: Type: text/plain, Size: 1642 bytes --]

Hi!

Ludovic Courtès <ludo@gnu.org> writes:
>[...]
> It’s the same story as <https://issues.guix.gnu.org/42392>.
>[...]
> So this is again #include_next not picking the right <fenv.h> due to
> search path ordering issues and/or duplicate entries.
>
> Thoughts anyone?
>
> I think we need a proper fix but the feedback we got from GCC folks last
> time didn’t give me much insight as to what we should do.

AFAIR, the issue comes from using XXX_INCLUDE_PATH instead of CPATH
because it includes gcc predefined paths:
  1. The order matters.
  2. The internal order may need duplicated paths.
  3. Even providing the right duplicated paths through these variables
  may not be supported may not work, it's an implementation detail after
  all.

This was changed because we wanted to avoid warnings on installed
libraries which could be raised to errors with -Werror.  I personally
don't like that approach, as the included headers are being compiled in
that moment so I think the -Werror should apply too, but indeed I
understand the reasons behind the compatibility with FHS.

The problem comes to generalizing this approach: there should be inputs
that must not enter the realm of these variables, mainly gcc and libc,
libc:static, libstdc++, and so on.

The attached WIP-patch would be a rough approach to that, but it will
take some time until I recompile the world to really test it.  Also this
isn't the best approach as the manifests shouldn't include these
neither, but I still don't find where and how to mark these inputs
cleanly.

WDYT?  Any idea is welcome. :-)

Happy hacking!
Miguel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: wip-gcc.patch --]
[-- Type: text/x-patch, Size: 4483 bytes --]

From ad2e859589ccbd5e9310a921355ef5e7f4926d80 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
 <rosen644835@gmail.com>
Date: Fri, 13 Nov 2020 18:27:03 +0100
Subject: [PATCH] build-system/gnu: Remove libc, libstdc++ and gcc from include
 paths.

* guix/build/gnu-build-system.scm (set-paths)[include-input?]
[include-var?]: New predicates.
[inputs->directories, native-inputs->directories]: Extract code from ...
[input-directories, native-input-directories]: ... here.
[include-directories, native-include-directories]: New variables.
<body>: Select between input-directories, native-input-directories or
include-directories, native-include-directories depending on the
environment variable to set.
---
 guix/build/gnu-build-system.scm | 45 ++++++++++++++++++++++++---------
 1 file changed, 33 insertions(+), 12 deletions(-)

diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index 2e7dff2034..2f8da33066 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -72,18 +72,35 @@ See https://reproducible-builds.org/specs/source-date-epoch/."
 (define* (set-paths #:key target inputs native-inputs
                     (search-paths '()) (native-search-paths '())
                     #:allow-other-keys)
-  (define input-directories
-    (match inputs
+  (define (include-input? input)
+    (let ((compiler-internals '("libc" "libc:static" "libstdc++" "gcc")))
+      (match input
+        ((name . _)
+         (not (member name compiler-internals))))))
+
+  (define (inputs->directories obj)
+    (match obj
       (((_ . dir) ...)
        dir)))
 
-  (define native-input-directories
-    (match native-inputs
+  (define (native-inputs->directories obj)
+    (match obj
       (((_ . dir) ...)
        dir)
       (#f                                         ; not cross compiling
        '())))
 
+  (define input-directories (inputs->directories inputs))
+  (define native-input-directories (native-inputs->directories native-inputs))
+
+  (define (include-var? var)
+    (string-suffix? var "_INCLUDE_PATH"))
+  (define include-directories
+    (inputs->directories (filter include-input? inputs)))
+  (define native-include-directories
+    (native-inputs->directories (filter include-input? native-inputs)))
+
+
   ;; Tell 'ld-wrapper' to disallow non-store libraries.
   (setenv "GUIX_LD_WRAPPER_ALLOW_IMPURITIES" "no")
 
@@ -98,10 +115,12 @@ See https://reproducible-builds.org/specs/source-date-epoch/."
   (for-each (match-lambda
              ((env-var (files ...) separator type pattern)
               (set-path-environment-variable env-var files
-                                             input-directories
-                                             #:separator separator
-                                             #:type type
-                                             #:pattern pattern)))
+                                             (if (include-var? env-var)
+                                                 include-directories
+                                                 input-directories)
+                                                 #:separator separator
+                                                 #:type type
+                                                 #:pattern pattern)))
             search-paths)
 
   (when native-search-paths
@@ -109,10 +128,12 @@ See https://reproducible-builds.org/specs/source-date-epoch/."
     (for-each (match-lambda
                ((env-var (files ...) separator type pattern)
                 (set-path-environment-variable env-var files
-                                               native-input-directories
-                                               #:separator separator
-                                               #:type type
-                                               #:pattern pattern)))
+                                             (if (include-var? env-var)
+                                                 native-include-directories
+                                                 native-input-directories)
+                                                 #:separator separator
+                                                 #:type type
+                                                 #:pattern pattern)))
               native-search-paths))
 
   #t)
-- 
2.29.2


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 658 bytes --]

  reply	other threads:[~2020-11-13 18:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 16:21 bug#43579: g++ does not provide std::fegetround Andreas Enge
2020-09-23 16:36 ` Andreas Enge
2020-09-23 19:03 ` Ricardo Wurmus
2020-09-23 20:05   ` Andreas Enge
2020-09-23 20:20     ` Andreas Enge
2020-09-23 21:28       ` Ricardo Wurmus
2020-10-01 12:36 ` Ludovic Courtès
2020-10-02  2:39   ` Brett Gilio
2020-10-02 18:06     ` Andreas Enge
2020-10-03 10:02       ` Ludovic Courtès
2020-11-13 17:59         ` Miguel Ángel Arruga Vivas [this message]
2021-12-27 21:48 ` Ricardo Wurmus
2022-06-13 17:03 ` bug#43579: Problem still present Andreas Enge
2023-01-29 23:19 ` bug#43579: Sharlatan Hellseher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r1oxyw6e.fsf@gmail.com \
    --to=rosen644835@gmail.com \
    --cc=43579@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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).