diff mbox

[bug#32953,core-updates-next,0/8] Use GCC7 as the default compiler.

Message ID 871s4kpswz.fsf@fastmail.com
State Accepted
Headers show

Commit Message

Marius Bakke Feb. 6, 2019, 8:23 p.m. UTC
Efraim Flashner <efraim@flashner.co.il> writes:

> On Sat, Jan 19, 2019 at 07:09:04PM +0200, Efraim Flashner wrote:
>> 
>> I'm going to see if I can build hello --target=arm-linux-gnueabihf next
>> and see how that works.
>
> When I get to gcc-cross-arm-linux-gnueabihf it fails during configure,
> cannot find gmp.h. Looking at (gnu packages cross-base), I don't think
> there are any package-inputs for xgcc. I still thought gcc bundled its
> own gmp et. al.

I'm happy to report that the cross-compilation issues are resolved with
this trivial patch:
Silly me for not catching the CROSS_C_INCLUDE_PATH issue earlier.  But,
at least I got to know the GCC build processes and GDB better...  ;-)

I will commit this series shortly and work on a followup patch that
removes the various GCC5/C++14 workarounds in one go.

Comments

Ricardo Wurmus Feb. 6, 2019, 10:35 p.m. UTC | #1
Hi Marius,

> Efraim Flashner <efraim@flashner.co.il> writes:
>
>> On Sat, Jan 19, 2019 at 07:09:04PM +0200, Efraim Flashner wrote:
>>> 
>>> I'm going to see if I can build hello --target=arm-linux-gnueabihf next
>>> and see how that works.
>>
>> When I get to gcc-cross-arm-linux-gnueabihf it fails during configure,
>> cannot find gmp.h. Looking at (gnu packages cross-base), I don't think
>> there are any package-inputs for xgcc. I still thought gcc bundled its
>> own gmp et. al.
>
> I'm happy to report that the cross-compilation issues are resolved with
> this trivial patch:
>
> 2 files changed, 5 insertions(+), 11 deletions(-)
> gnu/build/cross-toolchain.scm | 9 +++------
> gnu/packages/cross-base.scm   | 7 ++-----
>
> modified   gnu/build/cross-toolchain.scm
> @@ -36,11 +36,8 @@
>  
>  (define %gcc-include-paths
>    ;; Environment variables for header search paths.
> -  ;; Note: See <http://bugs.gnu.org/22186> for why not 'CPATH'.
> -  '("C_INCLUDE_PATH"
> -    "CPLUS_INCLUDE_PATH"
> -    "OBJC_INCLUDE_PATH"
> -    "OBJCPLUS_INCLUDE_PATH"))
> +  ;; Note: See <http://bugs.gnu.org/30756> for why not 'C_INCLUDE_PATH' & co.
> +  '("CPATH"))
>  
>  (define %gcc-cross-include-paths
>    ;; Search path for target headers when cross-compiling.
> @@ -179,7 +176,7 @@ a target triplet."
>              ;; header" such that #include_next does the right thing.
>              (for-each (lambda (var)
>                          (setenv var (string-append libc "/include")))
> -                      '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH")))
> +                      '("CROSS_C_INCLUDE_PATH" "CROSS_CPLUS_INCLUDE_PATH")))
>            #t)))
>      (add-after 'install 'make-cross-binutils-visible
>        (cut make-cross-binutils-visible #:target target <...>))
> modified   gnu/packages/cross-base.scm
> @@ -51,11 +51,8 @@
>  
>  (define %gcc-include-paths
>    ;; Environment variables for header search paths.
> -  ;; Note: See <http://bugs.gnu.org/22186> for why not 'CPATH'.
> -  '("C_INCLUDE_PATH"
> -    "CPLUS_INCLUDE_PATH"
> -    "OBJC_INCLUDE_PATH"
> -    "OBJCPLUS_INCLUDE_PATH"))
> +  ;; Note: See <http://bugs.gnu.org/30756> for why not 'C_INCLUDE_PATH' & co.
> +  '("CPATH"))
>  
>  (define %gcc-cross-include-paths
>    ;; Search path for target headers when cross-compiling.
>
> [back]
> Silly me for not catching the CROSS_C_INCLUDE_PATH issue earlier.  But,
> at least I got to know the GCC build processes and GDB better...  ;-)
>
> I will commit this series shortly and work on a followup patch that
> removes the various GCC5/C++14 workarounds in one go.

Will this break compilation with GCC5 and older, when they are installed
in a profile or used as inputs?  Do we need copies of these variables
and use different variants for different compiler versions?
Marius Bakke Feb. 6, 2019, 11:03 p.m. UTC | #2
Ricardo Wurmus <rekado@elephly.net> writes:

> Hi Marius,
>
>> Efraim Flashner <efraim@flashner.co.il> writes:
>>
>>> On Sat, Jan 19, 2019 at 07:09:04PM +0200, Efraim Flashner wrote:
>>>> 
>>>> I'm going to see if I can build hello --target=arm-linux-gnueabihf next
>>>> and see how that works.
>>>
>>> When I get to gcc-cross-arm-linux-gnueabihf it fails during configure,
>>> cannot find gmp.h. Looking at (gnu packages cross-base), I don't think
>>> there are any package-inputs for xgcc. I still thought gcc bundled its
>>> own gmp et. al.
>>
>> I'm happy to report that the cross-compilation issues are resolved with
>> this trivial patch:
>>
>> 2 files changed, 5 insertions(+), 11 deletions(-)
>> gnu/build/cross-toolchain.scm | 9 +++------
>> gnu/packages/cross-base.scm   | 7 ++-----
>>
>> modified   gnu/build/cross-toolchain.scm
>> @@ -36,11 +36,8 @@
>>  
>>  (define %gcc-include-paths
>>    ;; Environment variables for header search paths.
>> -  ;; Note: See <http://bugs.gnu.org/22186> for why not 'CPATH'.
>> -  '("C_INCLUDE_PATH"
>> -    "CPLUS_INCLUDE_PATH"
>> -    "OBJC_INCLUDE_PATH"
>> -    "OBJCPLUS_INCLUDE_PATH"))
>> +  ;; Note: See <http://bugs.gnu.org/30756> for why not 'C_INCLUDE_PATH' & co.
>> +  '("CPATH"))
>>  
>>  (define %gcc-cross-include-paths
>>    ;; Search path for target headers when cross-compiling.
>> @@ -179,7 +176,7 @@ a target triplet."
>>              ;; header" such that #include_next does the right thing.
>>              (for-each (lambda (var)
>>                          (setenv var (string-append libc "/include")))
>> -                      '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH")))
>> +                      '("CROSS_C_INCLUDE_PATH" "CROSS_CPLUS_INCLUDE_PATH")))
>>            #t)))
>>      (add-after 'install 'make-cross-binutils-visible
>>        (cut make-cross-binutils-visible #:target target <...>))
>> modified   gnu/packages/cross-base.scm
>> @@ -51,11 +51,8 @@
>>  
>>  (define %gcc-include-paths
>>    ;; Environment variables for header search paths.
>> -  ;; Note: See <http://bugs.gnu.org/22186> for why not 'CPATH'.
>> -  '("C_INCLUDE_PATH"
>> -    "CPLUS_INCLUDE_PATH"
>> -    "OBJC_INCLUDE_PATH"
>> -    "OBJCPLUS_INCLUDE_PATH"))
>> +  ;; Note: See <http://bugs.gnu.org/30756> for why not 'C_INCLUDE_PATH' & co.
>> +  '("CPATH"))
>>  
>>  (define %gcc-cross-include-paths
>>    ;; Search path for target headers when cross-compiling.
>>
>> [back]
>> Silly me for not catching the CROSS_C_INCLUDE_PATH issue earlier.  But,
>> at least I got to know the GCC build processes and GDB better...  ;-)
>>
>> I will commit this series shortly and work on a followup patch that
>> removes the various GCC5/C++14 workarounds in one go.
>
> Will this break compilation with GCC5 and older, when they are installed
> in a profile or used as inputs?  Do we need copies of these variables
> and use different variants for different compiler versions?

I believe using (CROSS_)CPATH will work for all GCC versions, whereas
(CROSS_)C_INCLUDE_PATH are broken for GCC >= 6.

We do use C_INCLUDE_PATH for GCC < 6 in (gnu packages gcc), but I don't
think the added complexity is worth it for the cross-compiler
infrastructure.
Ricardo Wurmus Feb. 8, 2019, 12:28 p.m. UTC | #3
Marius Bakke <mbakke@fastmail.com> writes:

> Ricardo Wurmus <rekado@elephly.net> writes:
>
>> Hi Marius,
>>
>>> Efraim Flashner <efraim@flashner.co.il> writes:
>>>
>>>> On Sat, Jan 19, 2019 at 07:09:04PM +0200, Efraim Flashner wrote:
>>>>> 
>>>>> I'm going to see if I can build hello --target=arm-linux-gnueabihf next
>>>>> and see how that works.
>>>>
>>>> When I get to gcc-cross-arm-linux-gnueabihf it fails during configure,
>>>> cannot find gmp.h. Looking at (gnu packages cross-base), I don't think
>>>> there are any package-inputs for xgcc. I still thought gcc bundled its
>>>> own gmp et. al.
>>>
>>> I'm happy to report that the cross-compilation issues are resolved with
>>> this trivial patch:
>>>
>>> 2 files changed, 5 insertions(+), 11 deletions(-)
>>> gnu/build/cross-toolchain.scm | 9 +++------
>>> gnu/packages/cross-base.scm   | 7 ++-----
>>>
>>> modified   gnu/build/cross-toolchain.scm
>>> @@ -36,11 +36,8 @@
>>>  
>>>  (define %gcc-include-paths
>>>    ;; Environment variables for header search paths.
>>> -  ;; Note: See <http://bugs.gnu.org/22186> for why not 'CPATH'.
>>> -  '("C_INCLUDE_PATH"
>>> -    "CPLUS_INCLUDE_PATH"
>>> -    "OBJC_INCLUDE_PATH"
>>> -    "OBJCPLUS_INCLUDE_PATH"))
>>> +  ;; Note: See <http://bugs.gnu.org/30756> for why not 'C_INCLUDE_PATH' & co.
>>> +  '("CPATH"))
>>>  
>>>  (define %gcc-cross-include-paths
>>>    ;; Search path for target headers when cross-compiling.
>>> @@ -179,7 +176,7 @@ a target triplet."
>>>              ;; header" such that #include_next does the right thing.
>>>              (for-each (lambda (var)
>>>                          (setenv var (string-append libc "/include")))
>>> -                      '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH")))
>>> +                      '("CROSS_C_INCLUDE_PATH" "CROSS_CPLUS_INCLUDE_PATH")))
>>>            #t)))
>>>      (add-after 'install 'make-cross-binutils-visible
>>>        (cut make-cross-binutils-visible #:target target <...>))
>>> modified   gnu/packages/cross-base.scm
>>> @@ -51,11 +51,8 @@
>>>  
>>>  (define %gcc-include-paths
>>>    ;; Environment variables for header search paths.
>>> -  ;; Note: See <http://bugs.gnu.org/22186> for why not 'CPATH'.
>>> -  '("C_INCLUDE_PATH"
>>> -    "CPLUS_INCLUDE_PATH"
>>> -    "OBJC_INCLUDE_PATH"
>>> -    "OBJCPLUS_INCLUDE_PATH"))
>>> +  ;; Note: See <http://bugs.gnu.org/30756> for why not 'C_INCLUDE_PATH' & co.
>>> +  '("CPATH"))
>>>  
>>>  (define %gcc-cross-include-paths
>>>    ;; Search path for target headers when cross-compiling.
>>>
>>> [back]
>>> Silly me for not catching the CROSS_C_INCLUDE_PATH issue earlier.  But,
>>> at least I got to know the GCC build processes and GDB better...  ;-)
>>>
>>> I will commit this series shortly and work on a followup patch that
>>> removes the various GCC5/C++14 workarounds in one go.
>>
>> Will this break compilation with GCC5 and older, when they are installed
>> in a profile or used as inputs?  Do we need copies of these variables
>> and use different variants for different compiler versions?
>
> I believe using (CROSS_)CPATH will work for all GCC versions, whereas
> (CROSS_)C_INCLUDE_PATH are broken for GCC >= 6.
>
> We do use C_INCLUDE_PATH for GCC < 6 in (gnu packages gcc), but I don't
> think the added complexity is worth it for the cross-compiler
> infrastructure.

Thanks for the explanation.

Will this allow us to close bug #30756?
Ludovic Courtès Feb. 9, 2019, 3 p.m. UTC | #4
Hi Marius,

Marius Bakke <mbakke@fastmail.com> skribis:

> Efraim Flashner <efraim@flashner.co.il> writes:
>
>> On Sat, Jan 19, 2019 at 07:09:04PM +0200, Efraim Flashner wrote:
>>> 
>>> I'm going to see if I can build hello --target=arm-linux-gnueabihf next
>>> and see how that works.
>>
>> When I get to gcc-cross-arm-linux-gnueabihf it fails during configure,
>> cannot find gmp.h. Looking at (gnu packages cross-base), I don't think
>> there are any package-inputs for xgcc. I still thought gcc bundled its
>> own gmp et. al.
>
> I'm happy to report that the cross-compilation issues are resolved with
> this trivial patch:

Awesome!  I think you could squash this with the “gnu: Use GCC 7 as the
default compiler.” commit, and then go ahead and push.

I’m happy we’ll soon have a more recent base compiler!

Thank you,
Ludo’.
Marius Bakke Feb. 9, 2019, 8:57 p.m. UTC | #5
Ludovic Courtès <ludo@gnu.org> writes:

> Hi Marius,
>
> Marius Bakke <mbakke@fastmail.com> skribis:
>
>> Efraim Flashner <efraim@flashner.co.il> writes:
>>
>>> On Sat, Jan 19, 2019 at 07:09:04PM +0200, Efraim Flashner wrote:
>>>> 
>>>> I'm going to see if I can build hello --target=arm-linux-gnueabihf next
>>>> and see how that works.
>>>
>>> When I get to gcc-cross-arm-linux-gnueabihf it fails during configure,
>>> cannot find gmp.h. Looking at (gnu packages cross-base), I don't think
>>> there are any package-inputs for xgcc. I still thought gcc bundled its
>>> own gmp et. al.
>>
>> I'm happy to report that the cross-compilation issues are resolved with
>> this trivial patch:
>
> Awesome!  I think you could squash this with the “gnu: Use GCC 7 as the
> default compiler.” commit, and then go ahead and push.
>
> I’m happy we’ll soon have a more recent base compiler!

Merged in 01e8263febb9634564b4b73af49b81a36567a11b !
diff mbox

Patch

2 files changed, 5 insertions(+), 11 deletions(-)
gnu/build/cross-toolchain.scm | 9 +++------
gnu/packages/cross-base.scm   | 7 ++-----

modified   gnu/build/cross-toolchain.scm
@@ -36,11 +36,8 @@ 
 
 (define %gcc-include-paths
   ;; Environment variables for header search paths.
-  ;; Note: See <http://bugs.gnu.org/22186> for why not 'CPATH'.
-  '("C_INCLUDE_PATH"
-    "CPLUS_INCLUDE_PATH"
-    "OBJC_INCLUDE_PATH"
-    "OBJCPLUS_INCLUDE_PATH"))
+  ;; Note: See <http://bugs.gnu.org/30756> for why not 'C_INCLUDE_PATH' & co.
+  '("CPATH"))
 
 (define %gcc-cross-include-paths
   ;; Search path for target headers when cross-compiling.
@@ -179,7 +176,7 @@  a target triplet."
             ;; header" such that #include_next does the right thing.
             (for-each (lambda (var)
                         (setenv var (string-append libc "/include")))
-                      '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH")))
+                      '("CROSS_C_INCLUDE_PATH" "CROSS_CPLUS_INCLUDE_PATH")))
           #t)))
     (add-after 'install 'make-cross-binutils-visible
       (cut make-cross-binutils-visible #:target target <...>))
modified   gnu/packages/cross-base.scm
@@ -51,11 +51,8 @@ 
 
 (define %gcc-include-paths
   ;; Environment variables for header search paths.
-  ;; Note: See <http://bugs.gnu.org/22186> for why not 'CPATH'.
-  '("C_INCLUDE_PATH"
-    "CPLUS_INCLUDE_PATH"
-    "OBJC_INCLUDE_PATH"
-    "OBJCPLUS_INCLUDE_PATH"))
+  ;; Note: See <http://bugs.gnu.org/30756> for why not 'C_INCLUDE_PATH' & co.
+  '("CPATH"))
 
 (define %gcc-cross-include-paths
   ;; Search path for target headers when cross-compiling.

[back]