* bug#24416: avr-gcc@5 is broken
@ 2016-09-11 23:23 Thompson, David
2016-09-12 6:49 ` Danny Milosavljevic
2017-12-22 14:45 ` bug#24416: [PATCH] gnu: avr-gcc: Fix compiler lookup paths Danny Milosavljevic
0 siblings, 2 replies; 8+ messages in thread
From: Thompson, David @ 2016-09-11 23:23 UTC (permalink / raw)
To: 24416
avr-gcc cannot find device-specific libraries when compiling, which
from my reading is due to a problem with multilib. However, avr-gcc@4
works fine!
avr-gcc -O2 -DF_CPU=16000000UL -mmcu=atmega32u4 test.c -o test
avr-ld: cannot find -lm
avr-ld: cannot find -lc
avr-ld: cannot find -latmega32u4
collect2: error: ld returned 1 exit status
The libraries in question here are located within
/gnu/store/...-avr-libc-2.0.0/avr/lib/avr5 but avr-gcc is only
searching within /avr/lib.
For now, I'm just using avr-gcc@4 and moving on with life.
- Dave
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#24416: avr-gcc@5 is broken
2016-09-11 23:23 bug#24416: avr-gcc@5 is broken Thompson, David
@ 2016-09-12 6:49 ` Danny Milosavljevic
2016-09-12 15:29 ` Thompson, David
2017-12-22 14:45 ` bug#24416: [PATCH] gnu: avr-gcc: Fix compiler lookup paths Danny Milosavljevic
1 sibling, 1 reply; 8+ messages in thread
From: Danny Milosavljevic @ 2016-09-12 6:49 UTC (permalink / raw)
To: Thompson, David; +Cc: 24416
As a workaround,
CPPFLAGS += -I${HOME}/.guix-profile/avr/include
LDFLAGS += -L${HOME}/.guix-profile/avr/lib/avr5 -L${HOME}/.guix-profile/avr/lib -B${HOME}/.guix-profile/avr/lib
works with avr-gcc 5.3.0. Unfortunately I don't know enough about avr-gcc to be able to permanently fix it.
I fixed part of it (I made it so that atmega32u4 exists in the first place) in master - but no idea what to do with the search path.
I'm pretty sure that if it uses CROSS_CPATH it's incorrect because cross-base has been changed from CROSS_CPATH to CROSS_C_INCLUDE_PATH, CROSS_CPLUS_INCLUDE_PATH etc in order to suppress warnings. If CROSS_C_INCLUDE_PATH overrides CROSS_CPATH (does it?) then setting CROSS_CPATH like avr.scm does does no good.
I propose to change it to the following:
diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index 9873477..1e5fd73 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -59,9 +59,18 @@
#t))))
((#:configure-flags flags)
`(delete "--disable-multilib" ,flags))))
- (native-search-paths
+ (native-search-paths
(list (search-path-specification
- (variable "CROSS_CPATH")
+ (variable "CROSS_C_INCLUDE_PATH")
+ (files '("avr/include")))
+ (search-path-specification
+ (variable "CROSS_CPLUS_INCLUDE_PATH")
+ (files '("avr/include")))
+ (search-path-specification
+ (variable "CROSS_OBJC_INCLUDE_PATH")
+ (files '("avr/include")))
+ (search-path-specification
+ (variable "CROSS_OBJCPLUS_INCLUDE_PATH")
(files '("avr/include")))
(search-path-specification
(variable "CROSS_LIBRARY_PATH")
^ permalink raw reply related [flat|nested] 8+ messages in thread
* bug#24416: avr-gcc@5 is broken
2016-09-12 6:49 ` Danny Milosavljevic
@ 2016-09-12 15:29 ` Thompson, David
2016-09-13 9:18 ` Danny Milosavljevic
0 siblings, 1 reply; 8+ messages in thread
From: Thompson, David @ 2016-09-12 15:29 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: 24416
On Mon, Sep 12, 2016 at 2:49 AM, Danny Milosavljevic
<dannym@scratchpost.org> wrote:
> As a workaround,
>
> CPPFLAGS += -I${HOME}/.guix-profile/avr/include
> LDFLAGS += -L${HOME}/.guix-profile/avr/lib/avr5 -L${HOME}/.guix-profile/avr/lib -B${HOME}/.guix-profile/avr/lib
>
> works with avr-gcc 5.3.0. Unfortunately I don't know enough about avr-gcc to be able to permanently fix it.
>
> I fixed part of it (I made it so that atmega32u4 exists in the first place) in master - but no idea what to do with the search path.
>
> I'm pretty sure that if it uses CROSS_CPATH it's incorrect because cross-base has been changed from CROSS_CPATH to CROSS_C_INCLUDE_PATH, CROSS_CPLUS_INCLUDE_PATH etc in order to suppress warnings. If CROSS_C_INCLUDE_PATH overrides CROSS_CPATH (does it?) then setting CROSS_CPATH like avr.scm does does no good.
>
> I propose to change it to the following:
>
> diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
> index 9873477..1e5fd73 100644
> --- a/gnu/packages/avr.scm
> +++ b/gnu/packages/avr.scm
> @@ -59,9 +59,18 @@
> #t))))
> ((#:configure-flags flags)
> `(delete "--disable-multilib" ,flags))))
> - (native-search-paths
> + (native-search-paths
> (list (search-path-specification
> - (variable "CROSS_CPATH")
> + (variable "CROSS_C_INCLUDE_PATH")
> + (files '("avr/include")))
> + (search-path-specification
> + (variable "CROSS_CPLUS_INCLUDE_PATH")
> + (files '("avr/include")))
> + (search-path-specification
> + (variable "CROSS_OBJC_INCLUDE_PATH")
> + (files '("avr/include")))
> + (search-path-specification
> + (variable "CROSS_OBJCPLUS_INCLUDE_PATH")
> (files '("avr/include")))
> (search-path-specification
> (variable "CROSS_LIBRARY_PATH")
I don't know if this will have the intended effect and I cannot
experiment with it right now. Could you test? The LDFLAGS above
include the path to the device-specific object files (/avr5), but
avr-gcc is supposed to be able to figure that out on its own using a
"normal" library path, so I'm skeptical that simply changing the
search paths for the package is enough.
Thanks,
- Dave
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#24416: avr-gcc@5 is broken
2016-09-12 15:29 ` Thompson, David
@ 2016-09-13 9:18 ` Danny Milosavljevic
0 siblings, 0 replies; 8+ messages in thread
From: Danny Milosavljevic @ 2016-09-13 9:18 UTC (permalink / raw)
To: Thompson, David; +Cc: 24416
On Mon, 12 Sep 2016 11:29:11 -0400
"Thompson, David" <dthompson2@worcester.edu> wrote:
> On Mon, Sep 12, 2016 at 2:49 AM, Danny Milosavljevic
> <dannym@scratchpost.org> wrote:
> > As a workaround,
> >
> > CPPFLAGS += -I${HOME}/.guix-profile/avr/include
> > LDFLAGS += -L${HOME}/.guix-profile/avr/lib/avr5 -L${HOME}/.guix-profile/avr/lib -B${HOME}/.guix-profile/avr/lib
> >
> > works with avr-gcc 5.3.0. Unfortunately I don't know enough about avr-gcc to be able to permanently fix it.
> >
> > I fixed part of it (I made it so that atmega32u4 exists in the first place) in master - but no idea what to do with the search path.
> >
> > I'm pretty sure that if it uses CROSS_CPATH it's incorrect because cross-base has been changed from CROSS_CPATH to CROSS_C_INCLUDE_PATH, CROSS_CPLUS_INCLUDE_PATH etc in order to suppress warnings. If CROSS_C_INCLUDE_PATH overrides CROSS_CPATH (does it?) then setting CROSS_CPATH like avr.scm does does no good.
> >
> > I propose to change it to the following:
> >
> > diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
> > index 9873477..1e5fd73 100644
> > --- a/gnu/packages/avr.scm
> > +++ b/gnu/packages/avr.scm
> > @@ -59,9 +59,18 @@
> > #t))))
> > ((#:configure-flags flags)
> > `(delete "--disable-multilib" ,flags))))
> > - (native-search-paths
> > + (native-search-paths
> > (list (search-path-specification
> > - (variable "CROSS_CPATH")
> > + (variable "CROSS_C_INCLUDE_PATH")
> > + (files '("avr/include")))
> > + (search-path-specification
> > + (variable "CROSS_CPLUS_INCLUDE_PATH")
> > + (files '("avr/include")))
> > + (search-path-specification
> > + (variable "CROSS_OBJC_INCLUDE_PATH")
> > + (files '("avr/include")))
> > + (search-path-specification
> > + (variable "CROSS_OBJCPLUS_INCLUDE_PATH")
> > (files '("avr/include")))
> > (search-path-specification
> > (variable "CROSS_LIBRARY_PATH")
>
> I don't know if this will have the intended effect and I cannot
> experiment with it right now. Could you test?
(The patch: ) Can't test it right now (out of disk space; updating 2 GB texmf is really annoying) - but I tested it in the past and it wasn't sufficient. On the other hand, before the patch is applied, cross-gcc and avr.scm set *different* variables and that's probably incorrect.
> The LDFLAGS above
> include the path to the device-specific object files (/avr5), but
> avr-gcc is supposed to be able to figure that out on its own using a
> "normal" library path, so I'm skeptical that simply changing the
> search paths for the package is enough.
I've used these LDFLAGS (actually used them as global flags for all gcc invocations) for some weeks with daily success. Also, the "-B" is necessary.
I think that the "native-search-paths" only affect the build system.
As far as I understand, avr-gcc is a "native" compiler in the sense of it-shouldn't-try-to-build-all-Guix-packages-for-it. And it's certainly set up as a "native" compiler. But that means that the avr-gcc port has to hack the search path that gcc usually uses for native compilers to make it search something else - not sure where they do and why it doesn't work for us. It would be good to locate this part.
The atmega32u4 comes from avr-libc (!) - that's why I changed avr-libc to use the same compiler (already in master for some months). That made it work much better.
I hope someone can shed a light on this.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#24416: [PATCH] gnu: avr-gcc: Fix compiler lookup paths.
2016-09-11 23:23 bug#24416: avr-gcc@5 is broken Thompson, David
2016-09-12 6:49 ` Danny Milosavljevic
@ 2017-12-22 14:45 ` Danny Milosavljevic
2020-03-01 6:42 ` Arun Isaac
1 sibling, 1 reply; 8+ messages in thread
From: Danny Milosavljevic @ 2017-12-22 14:45 UTC (permalink / raw)
To: Thompson, David; +Cc: 24416
* gnu/packages/avr.scm (avr-gcc-4.9): Use CROSS_C*_INCLUDE_PATH (like
cross-base does).
(avr-gcc-5)[source]: Apply patch "gcc-cross-environment-variables.patch".
---
gnu/packages/avr.scm | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index ecb7cd19a..60bcbe754 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -61,7 +61,16 @@
`(delete "--disable-multilib" ,flags))))
(native-search-paths
(list (search-path-specification
- (variable "CROSS_CPATH")
+ (variable "CROSS_C_INCLUDE_PATH")
+ (files '("avr/include")))
+ (search-path-specification
+ (variable "CROSS_CPLUS_INCLUDE_PATH")
+ (files '("avr/include")))
+ (search-path-specification
+ (variable "CROSS_OBJC_INCLUDE_PATH")
+ (files '("avr/include")))
+ (search-path-specification
+ (variable "CROSS_OBJCPLUS_INCLUDE_PATH")
(files '("avr/include")))
(search-path-specification
(variable "CROSS_LIBRARY_PATH")
@@ -71,7 +80,10 @@
(package
(inherit avr-gcc-4.9)
(version (package-version gcc-5))
- (source (package-source gcc-5))))
+ (source (origin
+ (inherit (package-source gcc-5))
+ (patches (append (origin-patches (package-source gcc-5))
+ (search-patches "gcc-cross-environment-variables.patch")))))))
(define (avr-libc avr-gcc)
(package
^ permalink raw reply related [flat|nested] 8+ messages in thread
* bug#24416: [PATCH] gnu: avr-gcc: Fix compiler lookup paths.
2017-12-22 14:45 ` bug#24416: [PATCH] gnu: avr-gcc: Fix compiler lookup paths Danny Milosavljevic
@ 2020-03-01 6:42 ` Arun Isaac
2020-03-01 12:25 ` Danny Milosavljevic
0 siblings, 1 reply; 8+ messages in thread
From: Arun Isaac @ 2020-03-01 6:42 UTC (permalink / raw)
To: Danny Milosavljevic, Thompson, David; +Cc: 24416
[-- Attachment #1: Type: text/plain, Size: 258 bytes --]
> * gnu/packages/avr.scm (avr-gcc-4.9): Use CROSS_C*_INCLUDE_PATH (like
> cross-base does).
> (avr-gcc-5)[source]: Apply patch "gcc-cross-environment-variables.patch".
Hi,
I verified that this patch works[1]. Could you please push to master?
Thanks! :-)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#24416: [PATCH] gnu: avr-gcc: Fix compiler lookup paths.
2020-03-01 6:42 ` Arun Isaac
@ 2020-03-01 12:25 ` Danny Milosavljevic
2020-05-13 19:28 ` Efraim Flashner
0 siblings, 1 reply; 8+ messages in thread
From: Danny Milosavljevic @ 2020-03-01 12:25 UTC (permalink / raw)
To: Arun Isaac; +Cc: 24416
[-- Attachment #1: Type: text/plain, Size: 87 bytes --]
Hi Arun,
pushed to guix master as commit 2f3515f7369d91d8922620044f9348cc727b6c10.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#24416: [PATCH] gnu: avr-gcc: Fix compiler lookup paths.
2020-03-01 12:25 ` Danny Milosavljevic
@ 2020-05-13 19:28 ` Efraim Flashner
0 siblings, 0 replies; 8+ messages in thread
From: Efraim Flashner @ 2020-05-13 19:28 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: 24416-done
[-- Attachment #1: Type: text/plain, Size: 243 bytes --]
Closing this bug as fixed.
--
Efraim Flashner <efraim@flashner.co.il> אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-05-13 19:29 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-11 23:23 bug#24416: avr-gcc@5 is broken Thompson, David
2016-09-12 6:49 ` Danny Milosavljevic
2016-09-12 15:29 ` Thompson, David
2016-09-13 9:18 ` Danny Milosavljevic
2017-12-22 14:45 ` bug#24416: [PATCH] gnu: avr-gcc: Fix compiler lookup paths Danny Milosavljevic
2020-03-01 6:42 ` Arun Isaac
2020-03-01 12:25 ` Danny Milosavljevic
2020-05-13 19:28 ` Efraim Flashner
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).