AVR-Toolchain-5 avr/io not found

  • Done
  • quality assurance status badge
Details
2 participants
  • Arun Isaac
  • Ekaitz Zarraga
Owner
unassigned
Submitted by
Ekaitz Zarraga
Severity
normal
E
E
Ekaitz Zarraga wrote on 25 Feb 2020 23:12
(name . bug-guix@gnu.org)(address . bug-guix@gnu.org)
I-mxT4KmnM0TbAqtK4PxzrULw5U_nc-p9KeICdpguLfoZ_yd1gHfaUv5aaRYNzbJhMnCB4BpsSgGppr8b9oLSyPpUJezr9vyCwRA2JDLljY=@elenq.tech
Hi,

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


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:

Toggle diff (30 lines)
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
E
E
Ekaitz Zarraga wrote on 26 Feb 2020 09:44
(name . 39794@debbugs.gnu.org)(address . 39794@debbugs.gnu.org)
Njc39txIEjQ6O7lDB2nDaOrq-h0nUKskq1P21OqKT8Pzl-c5NVhDW1c9gln13E4cVKfVTsxriWRPSFhXpdLyAf6ZKa8fmPZ7Qkw-9rhZQlM=@elenq.tech
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
E
E
Ekaitz Zarraga wrote on 28 Feb 2020 23:42
(name . 39794@debbugs.gnu.org)(address . 39794@debbugs.gnu.org)
8-mv7qVc3d25SUttosRz1Kv28rGlUBHVbzOVM08cdZOa6K9O6e8RVgQFGnwI1Mh1MW2IlaqwgaBYP3W8gqMHzn8_kGzxpuwRvDfPO-0alAo=@elenq.tech
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
A
A
Arun Isaac wrote on 29 Feb 2020 16:06
Re: bug#39794: AVR-Toolchain-5 avr/io not found
cu77e058mb2.fsf@systemreboot.net
Hi,

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

Regards,
Arun.

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEf3MDQ/Lwnzx3v3nTLiXui2GAK7MFAl5afhEACgkQLiXui2GA
K7Oa+Qf8DIBT3jPYZ/RA2r1V80AbhK3l97pssIS/YHIzjri0R/Zj9Tdh3yc+i+VS
nK1eXyP8JTpeqXjKHIsYvCacV8b2VXGGtBp3+uM1BHKWTazBSKwzV1dnnZWMsZ0b
uVfppaizVGbgqjEXu/TimzwiWS6bCAR4PRlypuiX4Y7C4XM/8zE73/+KWlhGIAEO
yUPnWt27efPbOx0wmZ/2EWNCXGCrWescroxe7yMQFFRLSyY3LpKVXr10s9HmJwHy
JdsaMm6JKas8omJXeGDNtT/BHKiTTHGZkf7rCcLuPNgq5tn3Da6oLeNpQC+Er8RE
LVWF1zXUwZmzlXc8WodbQqL6b8JavA==
=qMHy
-----END PGP SIGNATURE-----

E
E
Ekaitz Zarraga wrote on 29 Feb 2020 16:46
(name . Arun Isaac)(address . arunisaac@systemreboot.net)(name . 39794@debbugs.gnu.org)(address . 39794@debbugs.gnu.org)
oA29bIHZ_fTXvpsci0dfZivkQ-2w54UWb4vEG4vbtIQvRo43X_QQlB8qb5X-H0AmJjtjAN5XhUESUM8umWtmT7E86XZ__EZynZO2hSaxwsg=@elenq.tech
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:

Toggle quote (11 lines)
>
>
> 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
E
E
Ekaitz Zarraga wrote on 29 Feb 2020 16:58
(name . Arun Isaac)(address . arunisaac@systemreboot.net)(name . 39794@debbugs.gnu.org)(address . 39794@debbugs.gnu.org)
5CXgvlz8Cp1-AKLftQMD3twyLCcm099SM6x892Gm4tIeZ1L6fbCb9lVuByULu-P0zCPvZ7oOm4erczC3hJZh17iPB1DAy8widMfjTQgz4kQ=@elenq.tech
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?
A
A
Arun Isaac wrote on 29 Feb 2020 20:14
(name . Ekaitz Zarraga)(address . ekaitz@elenq.tech)(name . 39794@debbugs.gnu.org)(address . 39794@debbugs.gnu.org)
cu74kv98ava.fsf@systemreboot.net
Toggle quote (9 lines)
> ```
> 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.

Toggle snippet (3 lines)
$ ./pre-inst-env guix environment --ad-hoc avr-toolchain

Check the version of avr-gcc.

Toggle snippet (8 lines)
$ 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.

Check avr-gcc include paths.

Toggle snippet (22 lines)
$ 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

Navigate to qmk-firmware and clean previous build results.

Toggle snippet (4 lines)
$ cd qmk-firmware
$ make clean

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

Toggle snippet (22 lines)
$ 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]
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEf3MDQ/Lwnzx3v3nTLiXui2GAK7MFAl5at/kACgkQLiXui2GA
K7MHSQgAlBhc5KeSg3TiSVqZ9wwlr1cm/16H5KF+kXSB4Jmrsr7XEBkHYtB4DJ5p
3P+zaBhRIzzDbqNy38Bc1MnMGd//zstSD6yRitDsQ69R9hEFcr2zeAEI9od0pbdb
dRV9OG416ETPYjKzVGWnqOVLuB+YgLY2F1FePLBnANEFaoB6uBs/LzRTXndIgdfq
5H1d0+ujP7Oyi7Cps9kIkkdeWTN9WOwwbN3vUGFha0c7tKkjjk9M3Jh5MSUuDXGG
S3VKD5064EmtdKbXZEWz1brUHLSXqCyDU6Gpl6VTZpKRokYwA8grqtOFFl1y0Onw
B7T/wCtkwQtg7+1OX7cg8M2VVtvT9Q==
=g19I
-----END PGP SIGNATURE-----

E
E
Ekaitz Zarraga wrote on 29 Feb 2020 20:26
(name . Arun Isaac)(address . arunisaac@systemreboot.net)(name . 39794\@debbugs.gnu.org)(address . 39794@debbugs.gnu.org)
hQd8uOaeGJrNV83ihseiPQdWnfLCnImzeGbFxvg5mnPxFQuZbZjjnjTHl0bUTJbxqgkqi71ocL25zu7P-35d8eqAYDub8Aw4Bj6EmDBAr-I=@elenq.tech
Toggle quote (3 lines)
> 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
A
A
Arun Isaac wrote on 29 Feb 2020 21:42
(name . Ekaitz Zarraga)(address . ekaitz@elenq.tech)(address . 39794@debbugs.gnu.org)
cu71rqd86s7.fsf@systemreboot.net
Toggle quote (2 lines)
> I can replicate what you did and it works.

Nice! :-)

Toggle quote (2 lines)
> 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.

Toggle snippet (20 lines)
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.

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.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEf3MDQ/Lwnzx3v3nTLiXui2GAK7MFAl5azKgACgkQLiXui2GA
K7NhCggAk74UeDW3Z3I0NcGe3hYabJrI/nMRrUdExDKsaneca1d+kgOGMPI4EXN6
9hQhESkZgj8RV4nAwxUsbDHdHTtYlyTzMdjleGac3lLiAnxm5V3u3gC4w6dv1vG0
geXC0Ok3pKMLtaSPp8Ge/HwrwDRlBQFGwJdFe4alQBo/r8lOuzA5mRVj7IsLk5m5
jHpXhRjqzyjQUc7QJU7v0oJWBKqFEdRJuZXp9/ouORO/8c0cC5T+t1fhzYhFQy6v
Kud50fBZUPRwezl0lH4iMWmWIduA42Bmvnkuo0FLmIEdGAQ/gA7rHUaFjr5wNX76
F9VrJ1bfSNXh0gRexjJyzJDm9rOqfg==
=i4Cy
-----END PGP SIGNATURE-----

E
E
Ekaitz Zarraga wrote on 29 Feb 2020 22:19
(name . Arun Isaac)(address . arunisaac@systemreboot.net)(name . 39794@debbugs.gnu.org)(address . 39794@debbugs.gnu.org)
teqkfqKd4bxil3Yku25y4E4jS6VEDQ5c3jCzbfgEbKVMQi84OUB-Aleh2ZzhyumwddW1fSPf629LaUwAtNBUXm_HeGIqH-XmcPgvW3Ghl38=@elenq.tech
Toggle quote (12 lines)
> > 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.

Toggle quote (3 lines)
> 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.
A
A
Arun Isaac wrote on 1 Mar 2020 08:07
(name . Ekaitz Zarraga)(address . ekaitz@elenq.tech)(address . 39794-done@debbugs.gnu.org)
cu7v9no7du0.fsf@systemreboot.net
Toggle quote (9 lines)
>> 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

Toggle quote (6 lines)
> 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.

Toggle quote (3 lines)
> We can start by pushing it and then keep solving the conflict issue
> and the upgrades to gcc-9.

Agreed.

Toggle quote (6 lines)
>> 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! :-)
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEf3MDQ/Lwnzx3v3nTLiXui2GAK7MFAl5bXzcACgkQLiXui2GA
K7NLqAf9HMUBEiLvg2bvllufZ2BD/c1lKgW4aLDYhjTQs3gYUYUTyxTzodng72GV
llzgpa3Gr+NHk4iR2HeHltptkiBsRKM7QyPv+yMYD9LydVDicgFlY9a+1jELsBf8
l8ZrkpSTSjSYVbyWlFkDzDm2GEaVqQ2hCAmyim5+OclOo2yoCzc/5iwj6Q9ieR1m
+nV8KUIQTtPsSl7P7sjXsujVk3fcbY9qp3AS66IEnguh7hE+LK6d9hN7YRorvH98
UXw9MbodPkZuPjMPNeVTInLc22gOkvVqrJ56j5qV9YOWRoCeVEYQc4FXVfLthugb
VteLrmu2GtRd6FoMFKuF0c4gCRoi5w==
=tx4A
-----END PGP SIGNATURE-----

Closed
?