Weird errors depending on CFLAGS/CPPFLAGS/LDFLAGS

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Weird errors depending on CFLAGS/CPPFLAGS/LDFLAGS

Sven Schwermer
Hi,

I have an Attiny817 Xplained Mini board which I want to use with
AVRDUDE. I am using the trunk as I realize, I need commit 1417 for the
Xplained Mini to work at all. I am using Arch Linux which is why I tried
the avrdude-svn AUR (https://aur.archlinux.org/packages/avrdude-svn) but
I got the following error message after building and running that:

avrdude: jtag3_edbg_recv(): Inconsistent fragment number; expect 1, got 0

When building straight from source, everything works great. I went ahead
and verified that the makepkg tool which Arch uses to build these
packages was in fact checking out the latest trunk. Next, I investigated
the environment that the package was being built in. I saw the following
interesting settings:

LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
CPPFLAGS=-D_FORTIFY_SOURCE=2
CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt

When unsetting all those variables right before the configure call, the
built binary works as expected with makepkg. When not unsetting any of
the above variables, the binary emits the aforementioned error. I also
verified that the problem arises when I build from source without
makepkg like so:

make distclean
./bootstrap
CPPFLAGS='-D_FORTIFY_SOURCE=2' CFLAGS='-march=x86-64 -mtune=generic -O2
-pipe -fno-plt'
LDFLAGS='-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' ./configure
--sysconfdir=/etc
make
./avrdude -p t817 -c xplainedmini_updi

Does anyone know how those variables can alter the build process so that
the software doesn't work properly? I'll try to play with the values of
the variables a little bit and I'll try attach a debugger. I'm using GCC
8.2.1 and GNU libc 2.28.

Best regards,
Sven


_______________________________________________
avrdude-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avrdude-dev
Reply | Threaded
Open this post in threaded view
|

Re: Weird errors depending on CFLAGS/CPPFLAGS/LDFLAGS

Sven Schwermer
Hi again,

I think the error is caused by the way the programmer ID is compared
against "xplainedmini_updi". The attached patch seems to fix the issue.
However, I don't quite understand why a programmer would need a list of
IDs in the first place, so I'd appreciate it if some sceptical eyes
looked over my patch :)

Best regards,
Sven

On 1/30/19 7:28 PM, Sven Schwermer wrote:

> Hi,
>
> I have an Attiny817 Xplained Mini board which I want to use with
> AVRDUDE. I am using the trunk as I realize, I need commit 1417 for the
> Xplained Mini to work at all. I am using Arch Linux which is why I tried
> the avrdude-svn AUR (https://aur.archlinux.org/packages/avrdude-svn) but
> I got the following error message after building and running that:
>
> avrdude: jtag3_edbg_recv(): Inconsistent fragment number; expect 1, got 0
>
> When building straight from source, everything works great. I went ahead
> and verified that the makepkg tool which Arch uses to build these
> packages was in fact checking out the latest trunk. Next, I investigated
> the environment that the package was being built in. I saw the following
> interesting settings:
>
> LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
> CPPFLAGS=-D_FORTIFY_SOURCE=2
> CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt
>
> When unsetting all those variables right before the configure call, the
> built binary works as expected with makepkg. When not unsetting any of
> the above variables, the binary emits the aforementioned error. I also
> verified that the problem arises when I build from source without
> makepkg like so:
>
> make distclean
> ./bootstrap
> CPPFLAGS='-D_FORTIFY_SOURCE=2' CFLAGS='-march=x86-64 -mtune=generic -O2
> -pipe -fno-plt'
> LDFLAGS='-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' ./configure
> --sysconfdir=/etc
> make
> ./avrdude -p t817 -c xplainedmini_updi
>
> Does anyone know how those variables can alter the build process so that
> the software doesn't work properly? I'll try to play with the values of
> the variables a little bit and I'll try attach a debugger. I'm using GCC
> 8.2.1 and GNU libc 2.28.
>
> Best regards,
> Sven
>
>
> _______________________________________________
> avrdude-dev mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/avrdude-dev
>

_______________________________________________
avrdude-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avrdude-dev