unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#39794: AVR-Toolchain-5 avr/io not found
@ 2020-02-25 22:12 Ekaitz Zarraga
  2020-02-26  8:44 ` Ekaitz Zarraga
  0 siblings, 1 reply; 11+ messages in thread
From: Ekaitz Zarraga @ 2020-02-25 22:12 UTC (permalink / raw)
  To: 39794

Hi,

I've been trying to debug AVR toolchain errors found in here:

https://lists.gnu.org/archive/html/help-guix/2020-02/msg00204.html

I'm not experienced enough to know all that's going on here and I need some assistance to make everything work.


I'm working on QMK-Firmware (helix keyboard specifically, that is an Atmega32u4) has and I'm able to make it compile with avr-gcc@4.9 but when I try with 5 first it fails because it doesn't find `avr/io.h`.

Exporting a new CPATH variable fixes it:

`export CPATH=$CPATH:/gnu/store/.../avr/include`

Once the export is done it fails because it's unable to find `gnu/stubs-32.h` and I don't know which package carries that. Can you point me to it?
Should it be added to avr-gcc dependencies?

If someone has the time to help me make it work I'll make the patches and the tests needed, but now I don't know what else to do.

First I'd say the package for avr-gcc@5 should not inherit from avr-gcc@4.9 because 4.9 uses CROSS_* variables and works correctly but 5 doesn't use them like that. So these changes solve that issue:

diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index 1f99f636e0..74caec5b94 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -76,7 +76,15 @@
   (package
     (inherit avr-gcc-4.9)
     (version (package-version gcc-5))
-    (source (package-source gcc-5))))
+    (source (package-source gcc-5))
+    (native-search-paths
+      (list (search-path-specification
+              (variable "CPATH")
+              (files '("avr/include")))
+            (search-path-specification
+              (variable "LIBRARY_PATH")
+              (files '("avr/lib")))))))
+

 (define (avr-libc avr-gcc)
   (package


But I don't see how to solve the `gnu/stubs-32.h` error.
Can anyone help me a little on this?

Thanks,

ElenQ Technology
Ethical Innovation

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

* bug#39794: AVR-Toolchain-5 avr/io not found
  2020-02-25 22:12 bug#39794: AVR-Toolchain-5 avr/io not found Ekaitz Zarraga
@ 2020-02-26  8:44 ` Ekaitz Zarraga
  2020-02-28 22:42   ` Ekaitz Zarraga
  0 siblings, 1 reply; 11+ messages in thread
From: Ekaitz Zarraga @ 2020-02-26  8:44 UTC (permalink / raw)
  To: 39794@debbugs.gnu.org

Follow up of the problem:

Looks like what it's missing is `multilib`, avr-gcc-4.9 package description clearly activates multilib and states that in a comment:


(define-public avr-gcc-4.9
  (let ((xgcc (cross-gcc "avr" #:xgcc gcc-4.9 #:xbinutils avr-binutils)))
    (package
      (inherit xgcc)
      (name "avr-gcc")
      (arguments
       (substitute-keyword-arguments (package-arguments xgcc)
         ((#:phases phases)
          `(modify-phases ,phases
             ;; Without a working multilib build, the resulting GCC lacks
             ;; support for nearly every AVR chip.
             (add-after 'unpack 'fix-genmultilib
               (lambda _
                 ;; patch-shebang doesn't work here because there are actually
                 ;; several scripts inside this script, each with a #!/bin/sh
                 ;; that needs patching.
                 (substitute* "gcc/genmultilib"
                   (("#!/bin/sh") (string-append "#!" (which "sh"))))
                 #t))))
         ((#:configure-flags flags)
          `(delete "--disable-multilib" ,flags))))
...


But looks like the avr-gcc-5.5, which is just inheriting the same description, is not able to create the multilib.
Any idea about why?

I think once we solve that we could have a reasonable avr-toolchain and also go for newer versions.

Regards,

Ekaitz


ElenQ Technology
Ethical Innovation

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

* bug#39794: AVR-Toolchain-5 avr/io not found
  2020-02-26  8:44 ` Ekaitz Zarraga
@ 2020-02-28 22:42   ` Ekaitz Zarraga
  2020-02-29 15:06     ` Arun Isaac
  0 siblings, 1 reply; 11+ messages in thread
From: Ekaitz Zarraga @ 2020-02-28 22:42 UTC (permalink / raw)
  To: 39794@debbugs.gnu.org

I'm checking the output by avr-gcc-4.9 in order to compare, and it doesn't have the stubs-32.h file neither but the compilation with avr-gcc-4.9 doesn't ask for it so it doesn't break.

Instead, if I use avr-gcc-5 it asks for the stubs-32.h file and it fails because it's not installed.

Both of them must be checking stubs.h (maybe the compilation with 4.9 isn't?) file that makes the include of the -64 or the -32 depending on the platform :S


Also I tried compiling glibc for 32 bytes because stubs-32 is on it. It worked but carried a different error, probably because I didn't compile it correctly:

/gnu/store/86yn7zgf6yx0gcbma9rxgd6d47ibp9ck-profile/include/bits/floatn.h:86:9: error: unknown type name '__float128'


This error shouldn't happen because the bits/floatn.h file is making checks before doing the typedef that fails... So there are a couple of options here:
- The checks are not enough to find my case
- I made the 32 bit GLIBC wrong and it's carrying wrong parameters to that header file, and makes it fall in a weird case.

Ideas?

Thanks!

Ekaitz

ElenQ Technology
Ethical Innovation

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

* bug#39794: AVR-Toolchain-5 avr/io not found
  2020-02-28 22:42   ` Ekaitz Zarraga
@ 2020-02-29 15:06     ` Arun Isaac
  2020-02-29 15:46       ` Ekaitz Zarraga
  0 siblings, 1 reply; 11+ messages in thread
From: Arun Isaac @ 2020-02-29 15:06 UTC (permalink / raw)
  To: Ekaitz Zarraga, 39794

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


Hi,

I tried the last patch at bug 24416 [1] and it does fix the issue. Can
you confirm?

Regards,
Arun.

[1]: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24416#17

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

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

* bug#39794: AVR-Toolchain-5 avr/io not found
  2020-02-29 15:06     ` Arun Isaac
@ 2020-02-29 15:46       ` Ekaitz Zarraga
  2020-02-29 15:58         ` Ekaitz Zarraga
  2020-02-29 19:14         ` Arun Isaac
  0 siblings, 2 replies; 11+ messages in thread
From: Ekaitz Zarraga @ 2020-02-29 15:46 UTC (permalink / raw)
  To: Arun Isaac; +Cc: 39794@debbugs.gnu.org

Not working for me:

```
QMK Firmware 0.7.163
Making helix/rev2 with keymap default                                                                  [ERRORS]
In file included from drivers/avr/pro_micro.h:28:0,
                 from keyboards/helix/rev2/matrix.c:33:
/gnu/store/gq69j5j0458dcc4jp5ymq62wgnd0mscl-profile/avr/include/avr/pgmspace.h:1456:25: error: unknown type name 'uint_farptr_t'
 extern size_t strlen_PF(uint_farptr_t src) __ATTR_CONST__; /* program memory can't change */
```

ElenQ Technology
Ethical Innovation

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, February 29, 2020 4:06 PM, Arun Isaac <arunisaac@systemreboot.net> wrote:

>
>
> Hi,
>
> I tried the last patch at bug 24416 [1] and it does fix the issue. Can
> you confirm?
>
> Regards,
> Arun.
>
> [1]: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24416#17

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

* bug#39794: AVR-Toolchain-5 avr/io not found
  2020-02-29 15:46       ` Ekaitz Zarraga
@ 2020-02-29 15:58         ` Ekaitz Zarraga
  2020-02-29 19:14         ` Arun Isaac
  1 sibling, 0 replies; 11+ messages in thread
From: Ekaitz Zarraga @ 2020-02-29 15:58 UTC (permalink / raw)
  To: Arun Isaac; +Cc: 39794@debbugs.gnu.org

But looks like some part of the code is not including the
/avr/include/inttypes.h file because it's declared on it.

Ideas on this?

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

* bug#39794: AVR-Toolchain-5 avr/io not found
  2020-02-29 15:46       ` Ekaitz Zarraga
  2020-02-29 15:58         ` Ekaitz Zarraga
@ 2020-02-29 19:14         ` Arun Isaac
  2020-02-29 19:26           ` Ekaitz Zarraga
  1 sibling, 1 reply; 11+ messages in thread
From: Arun Isaac @ 2020-02-29 19:14 UTC (permalink / raw)
  To: Ekaitz Zarraga; +Cc: 39794@debbugs.gnu.org

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


> ```
> QMK Firmware 0.7.163
> Making helix/rev2 with keymap default                                                                  [ERRORS]
> In file included from drivers/avr/pro_micro.h:28:0,
>                  from keyboards/helix/rev2/matrix.c:33:
> /gnu/store/gq69j5j0458dcc4jp5ymq62wgnd0mscl-profile/avr/include/avr/pgmspace.h:1456:25: error: unknown type name 'uint_farptr_t'
>  extern size_t strlen_PF(uint_farptr_t src) __ATTR_CONST__; /* program memory can't change */
> ```

I'm not able to reproduce this error. Could you provide the exact steps
you did? Here's what I did.

After applying the patch, drop into an environment with the new avr-toolchain.

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix environment --ad-hoc avr-toolchain
--8<---------------cut here---------------end--------------->8---

Check the version of avr-gcc.

--8<---------------cut here---------------start------------->8---
$ avr-gcc --version

avr-gcc (GCC) 5.5.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--8<---------------cut here---------------end--------------->8---

Check avr-gcc include paths.

--8<---------------cut here---------------start------------->8---
$ avr-gcc -E -v -

Using built-in specs.
Reading specs from /gnu/store/cwsiyrcm1c4c25dw0zrgajjnr9mf5k3g-avr-gcc-5.5.0/lib/gcc/avr/5.5.0/device-specs/specs-avr2
COLLECT_GCC=avr-gcc
Target: avr
Configured with: 
Thread model: single
gcc version 5.5.0 (GCC) 
COLLECT_GCC_OPTIONS='-E' '-v' '-specs=device-specs/specs-avr2'
 /gnu/store/cwsiyrcm1c4c25dw0zrgajjnr9mf5k3g-avr-gcc-5.5.0/libexec/gcc/avr/5.5.0/cc1 -E -quiet -v - -mn-flash=6 -mskip-bug
ignoring nonexistent directory "/gnu/store/cwsiyrcm1c4c25dw0zrgajjnr9mf5k3g-avr-gcc-5.5.0/lib/gcc/avr/5.5.0/../../../../avr/sys-include"
ignoring nonexistent directory "/gnu/store/cwsiyrcm1c4c25dw0zrgajjnr9mf5k3g-avr-gcc-5.5.0/lib/gcc/avr/5.5.0/../../../../avr/include"
#include "..." search starts here:
#include <...> search starts here:
 /gnu/store/siwsk54afs7i2g04vmqmxzj69b4rb1rg-profile/avr/include
 /gnu/store/cwsiyrcm1c4c25dw0zrgajjnr9mf5k3g-avr-gcc-5.5.0/lib/gcc/avr/5.5.0/include
 /gnu/store/cwsiyrcm1c4c25dw0zrgajjnr9mf5k3g-avr-gcc-5.5.0/lib/gcc/avr/5.5.0/include-fixed
End of search list.
^C
--8<---------------cut here---------------end--------------->8---

Navigate to qmk-firmware and clean previous build results.

--8<---------------cut here---------------start------------->8---
$ cd qmk-firmware
$ make clean
--8<---------------cut here---------------end--------------->8---

I'm checking out 0.7.163 and building helix since that's what you seem
to be doing.

--8<---------------cut here---------------start------------->8---
$ git checkout 0.7.163
$ make helix

QMK Firmware 0.7.163
WARNING:
 Python 3 is not installed. It will be required by a future version
 of qmk_firmware.

 Please run util/qmk_install.sh to install all the dependencies QMK requires.

WARNING: Some git submodules are out of date or modified.
 Please consider running make git-submodule.

Making helix/rev2 with keymap default                                                                  [OK]
Making helix/rev2 with keymap edvorakjp                                                                [OK]
Making helix/rev2 with keymap five_rows                                                                [OK]
Making helix/rev2 with keymap five_rows_jis                                                            [OK]
Making helix/rev2 with keymap froggy                                                                   [OK]
Making helix/rev2 with keymap led_test                                                                 [OK]
Making helix/rev2 with keymap xulkal                                                                   [OK]
Making helix/rev2 with keymap yshrsmz                                                                  [OK]
--8<---------------cut here---------------end--------------->8---

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

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

* bug#39794: AVR-Toolchain-5 avr/io not found
  2020-02-29 19:14         ` Arun Isaac
@ 2020-02-29 19:26           ` Ekaitz Zarraga
  2020-02-29 20:42             ` Arun Isaac
  0 siblings, 1 reply; 11+ messages in thread
From: Ekaitz Zarraga @ 2020-02-29 19:26 UTC (permalink / raw)
  To: Arun Isaac; +Cc: 39794\@debbugs.gnu.org

> I'm not able to reproduce this error. Could you provide the exact steps
> you did? Here's what I did.

Oh...

I saw what's happening...

I was using `guix environment --manifest=manifest.scm`

Being manifest:

 (specifications->manifest
  '("unzip"
    "zip"
    "git"
    "wget"
    "dfu-programmer"
    "dfu-util"
    "avr-toolchain"
    "glibc"
    "gcc-toolchain"
    "arm-none-eabi-toolchain"))

Which are all the development packages needed by QMK keyboard.

I can replicate what you did and it works.

May it be conflicting with other packages? Or using environment like that isn't doing what I expect?


ElenQ Technology
Ethical Innovation

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

* bug#39794: AVR-Toolchain-5 avr/io not found
  2020-02-29 19:26           ` Ekaitz Zarraga
@ 2020-02-29 20:42             ` Arun Isaac
  2020-02-29 21:19               ` Ekaitz Zarraga
  0 siblings, 1 reply; 11+ messages in thread
From: Arun Isaac @ 2020-02-29 20:42 UTC (permalink / raw)
  To: Ekaitz Zarraga; +Cc: 39794

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


> I can replicate what you did and it works.

Nice! :-)

> May it be conflicting with other packages?

arm-none-eabi-toolchain is conflicting with avr-toolchain since both are
setting the CROSS_* environment variables. See the output of `avr-gcc -E
-v -` below.

--8<---------------cut here---------------start------------->8---
Using built-in specs.
Reading specs from /gnu/store/cwsiyrcm1c4c25dw0zrgajjnr9mf5k3g-avr-gcc-5.5.0/lib/gcc/avr/5.5.0/device-specs/specs-avr2
COLLECT_GCC=avr-gcc
Target: avr
Configured with: 
Thread model: single
gcc version 5.5.0 (GCC) 
COLLECT_GCC_OPTIONS='-E' '-v' '-specs=device-specs/specs-avr2'
 /gnu/store/cwsiyrcm1c4c25dw0zrgajjnr9mf5k3g-avr-gcc-5.5.0/libexec/gcc/avr/5.5.0/cc1 -E -quiet -v - -mn-flash=6 -mskip-bug
ignoring nonexistent directory "/gnu/store/cwsiyrcm1c4c25dw0zrgajjnr9mf5k3g-avr-gcc-5.5.0/lib/gcc/avr/5.5.0/../../../../avr/sys-include"
ignoring nonexistent directory "/gnu/store/cwsiyrcm1c4c25dw0zrgajjnr9mf5k3g-avr-gcc-5.5.0/lib/gcc/avr/5.5.0/../../../../avr/include"
#include "..." search starts here:
#include <...> search starts here:
 /gnu/store/1bcgk0mwxwsgjpaybvb8h4dd1xp3x19x-profile/arm-none-eabi/include
 /gnu/store/1bcgk0mwxwsgjpaybvb8h4dd1xp3x19x-profile/avr/include
 /gnu/store/cwsiyrcm1c4c25dw0zrgajjnr9mf5k3g-avr-gcc-5.5.0/lib/gcc/avr/5.5.0/include
 /gnu/store/cwsiyrcm1c4c25dw0zrgajjnr9mf5k3g-avr-gcc-5.5.0/lib/gcc/avr/5.5.0/include-fixed
End of search list.
--8<---------------cut here---------------end--------------->8---

This should probably be considered a bug. But I have no idea how to fix
this. :-( What do you think?

Also, our avr-gcc package should probably be updated to the latest
avr-gcc-9.

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

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

* bug#39794: AVR-Toolchain-5 avr/io not found
  2020-02-29 20:42             ` Arun Isaac
@ 2020-02-29 21:19               ` Ekaitz Zarraga
  2020-03-01  7:07                 ` Arun Isaac
  0 siblings, 1 reply; 11+ messages in thread
From: Ekaitz Zarraga @ 2020-02-29 21:19 UTC (permalink / raw)
  To: Arun Isaac; +Cc: 39794@debbugs.gnu.org


> > I can replicate what you did and it works.
>
> Nice! :-)
>
> > May it be conflicting with other packages?
>
> arm-none-eabi-toolchain is conflicting with avr-toolchain since both are
> setting the CROSS_* environment variables. See the output of `avr-gcc -E -v -` below.
>
> This should probably be considered a bug. But I have no idea how to fix
> this. :-( What do you think?

I agree. The problem I see here is the environment variable game we have here.
One option is to create cross compilers with the include paths inserted on them instead of taking environment variables as a default.

If they had the correct directories in their default includepaths everything would work correctly.

I never did this before but it should be possible, probably affecting cross-gcc's configure step.

> Also, our avr-gcc package should probably be updated to the latest
> avr-gcc-9.

Once the current fix is applied next fixes should be possible.

Why wasn't the patch included in the project?
We can start by pushing it and then keep solving the conflict issue and the upgrades to gcc-9.

Have to say that nature of Guix makes the conflict issue easy to avoid while we find a solution for it.

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

* bug#39794: AVR-Toolchain-5 avr/io not found
  2020-02-29 21:19               ` Ekaitz Zarraga
@ 2020-03-01  7:07                 ` Arun Isaac
  0 siblings, 0 replies; 11+ messages in thread
From: Arun Isaac @ 2020-03-01  7:07 UTC (permalink / raw)
  To: Ekaitz Zarraga; +Cc: 39794-done

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


>> arm-none-eabi-toolchain is conflicting with avr-toolchain since both are
>> setting the CROSS_* environment variables. See the output of `avr-gcc -E -v -` below.
>>
>> This should probably be considered a bug. But I have no idea how to fix
>> this. :-( What do you think?
>
> I agree. The problem I see here is the environment variable game we have here.
> One option is to create cross compilers with the include paths inserted on them instead of taking environment variables as a default.

Or, we could have separate environment variables CROSS_AVR_C_INCLUDE_PATH
and CROSS_ARM_C_INCLUDE_PATH. But that sounds like too many environment
variables! :-P

> If they had the correct directories in their default includepaths
> everything would work correctly.
>
> I never did this before but it should be possible, probably affecting
> cross-gcc's configure step.

Something like this is possible too.

> We can start by pushing it and then keep solving the conflict issue
> and the upgrades to gcc-9.

Agreed.

>> Also, our avr-gcc package should probably be updated to the latest
>> avr-gcc-9.
>
> Once the current fix is applied next fixes should be possible.
> Why wasn't the patch included in the project?

I don't know. I have asked Danny at bug 24416 to push the patch. Let's
wait for a response.

Once Danny's patch is pushed, I'll open a new bug reporting the arm avr
conflict.

Also, I'm closing this bug report now since this issue is handled by
24416.

Thanks! :-)

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

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

end of thread, other threads:[~2020-03-01  7:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-25 22:12 bug#39794: AVR-Toolchain-5 avr/io not found Ekaitz Zarraga
2020-02-26  8:44 ` Ekaitz Zarraga
2020-02-28 22:42   ` Ekaitz Zarraga
2020-02-29 15:06     ` Arun Isaac
2020-02-29 15:46       ` Ekaitz Zarraga
2020-02-29 15:58         ` Ekaitz Zarraga
2020-02-29 19:14         ` Arun Isaac
2020-02-29 19:26           ` Ekaitz Zarraga
2020-02-29 20:42             ` Arun Isaac
2020-02-29 21:19               ` Ekaitz Zarraga
2020-03-01  7:07                 ` Arun Isaac

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