* [Buildroot] [PATCH 1/1] package/flashrom: fix redefinition of 'struct termios'
@ 2019-07-23 8:55 Vadim Kochan
2019-07-29 7:13 ` Thomas Petazzoni
2019-08-02 8:57 ` Thomas Petazzoni
0 siblings, 2 replies; 4+ messages in thread
From: Vadim Kochan @ 2019-07-23 8:55 UTC (permalink / raw)
To: buildroot
Both libc and linux defines 'struct termios', in termbits.h and
termios.h which leads to the compilation error:
In file included from custom_baud.c:23:0:
/home/buildroot/autobuild/instance-3/output/host/powerpc-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/termbits.h:12:8:
error: redefinition of 'struct termios'
struct termios {
^~~~~~~
In file included from
/home/buildroot/autobuild/instance-3/output/host/powerpc-buildroot-linux-uclibc/sysroot/usr/include/termios.h:39:0,
from
/home/buildroot/autobuild/instance-3/output/host/powerpc-buildroot-linux-uclibc/sysroot/usr/include/bits/ioctl-types.h:5,
from
/home/buildroot/autobuild/instance-3/output/host/powerpc-buildroot-linux-uclibc/sysroot/usr/include/sys/ioctl.h:29,
from custom_baud.c:21:
/home/buildroot/autobuild/instance-3/output/host/powerpc-buildroot-linux-uclibc/sysroot/usr/include/bits/termios.h:33:8:
note: originally defined here
struct termios {
^~~~~~~
So fix it by renaming 'termios' to 'asmtermios' before termbits.h only,
because 'struct termios2' is used only.
Fixes:
http://autobuild.buildroot.net/results/797dde5cbf0e94162c7cc7b557841605c78ac2f3/
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
---
...d-fix-redefinition-of-struct-termios.patch | 36 +++++++++++++++++++
1 file changed, 36 insertions(+)
create mode 100644 package/flashrom/0002-custom_baud-fix-redefinition-of-struct-termios.patch
diff --git a/package/flashrom/0002-custom_baud-fix-redefinition-of-struct-termios.patch b/package/flashrom/0002-custom_baud-fix-redefinition-of-struct-termios.patch
new file mode 100644
index 0000000000..5c4a681303
--- /dev/null
+++ b/package/flashrom/0002-custom_baud-fix-redefinition-of-struct-termios.patch
@@ -0,0 +1,36 @@
+From e94fd14bba4fe21dcb791a44d700ad7f036b8c7e Mon Sep 17 00:00:00 2001
+From: Vadim Kochan <vadim4j@gmail.com>
+Date: Tue, 23 Jul 2019 11:37:17 +0300
+Subject: [PATCH] custom_baud: fix redefinition of 'struct termios'
+
+both libc and linux kernel defines 'struct termios', once it is defined
+via termbits.h and second time it is re-defined via sys/ioctl.h. But
+because only termios2 is used so hide 'struct termios' by renaming it as
+'struct asmtermios'.
+
+Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
+---
+ custom_baud.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/custom_baud.c b/custom_baud.c
+index caf2b78..22fb74f 100644
+--- a/custom_baud.c
++++ b/custom_baud.c
+@@ -18,10 +18,12 @@
+ #include "custom_baud.h"
+
+ #if IS_LINUX
+-#include <sys/ioctl.h>
+ #include <fcntl.h>
++#define termios asmtermios
+ #include <asm-generic/termbits.h>
+ #include <asm-generic/ioctls.h>
++#undef termios
++#include <sys/ioctl.h>
+
+ /*
+ * This include hell above is why this is in a separate source file. See eg.
+--
+2.17.1
+
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [Buildroot] [PATCH 1/1] package/flashrom: fix redefinition of 'struct termios' 2019-07-23 8:55 [Buildroot] [PATCH 1/1] package/flashrom: fix redefinition of 'struct termios' Vadim Kochan @ 2019-07-29 7:13 ` Thomas Petazzoni 2019-08-02 8:57 ` Thomas Petazzoni 1 sibling, 0 replies; 4+ messages in thread From: Thomas Petazzoni @ 2019-07-29 7:13 UTC (permalink / raw) To: buildroot Hello, +Waldemar in Cc. On Tue, 23 Jul 2019 11:55:16 +0300 Vadim Kochan <vadim4j@gmail.com> wrote: > Both libc and linux defines 'struct termios', in termbits.h and > termios.h which leads to the compilation error: > > In file included from custom_baud.c:23:0: > > /home/buildroot/autobuild/instance-3/output/host/powerpc-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/termbits.h:12:8: > error: redefinition of 'struct termios' > struct termios { > ^~~~~~~ > In file included from > /home/buildroot/autobuild/instance-3/output/host/powerpc-buildroot-linux-uclibc/sysroot/usr/include/termios.h:39:0, > from > /home/buildroot/autobuild/instance-3/output/host/powerpc-buildroot-linux-uclibc/sysroot/usr/include/bits/ioctl-types.h:5, > from > /home/buildroot/autobuild/instance-3/output/host/powerpc-buildroot-linux-uclibc/sysroot/usr/include/sys/ioctl.h:29, > from custom_baud.c:21: > /home/buildroot/autobuild/instance-3/output/host/powerpc-buildroot-linux-uclibc/sysroot/usr/include/bits/termios.h:33:8: > note: originally defined here > struct termios { > ^~~~~~~ > > So fix it by renaming 'termios' to 'asmtermios' before termbits.h only, > because 'struct termios2' is used only. This issue only happens on PowerPC/uClibc, and on no other architecture. Do we have any idea why ? Couldn't this issue instead be a problem in uClibc headers ? Thanks, Thomas -- Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH 1/1] package/flashrom: fix redefinition of 'struct termios' 2019-07-23 8:55 [Buildroot] [PATCH 1/1] package/flashrom: fix redefinition of 'struct termios' Vadim Kochan 2019-07-29 7:13 ` Thomas Petazzoni @ 2019-08-02 8:57 ` Thomas Petazzoni 2019-08-06 8:55 ` Vadim Kochan 1 sibling, 1 reply; 4+ messages in thread From: Thomas Petazzoni @ 2019-08-02 8:57 UTC (permalink / raw) To: buildroot Hello Vadim, On Tue, 23 Jul 2019 11:55:16 +0300 Vadim Kochan <vadim4j@gmail.com> wrote: > Both libc and linux defines 'struct termios', in termbits.h and > termios.h which leads to the compilation error: > > In file included from custom_baud.c:23:0: > > /home/buildroot/autobuild/instance-3/output/host/powerpc-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/termbits.h:12:8: > error: redefinition of 'struct termios' > struct termios { > ^~~~~~~ > In file included from > /home/buildroot/autobuild/instance-3/output/host/powerpc-buildroot-linux-uclibc/sysroot/usr/include/termios.h:39:0, > from > /home/buildroot/autobuild/instance-3/output/host/powerpc-buildroot-linux-uclibc/sysroot/usr/include/bits/ioctl-types.h:5, > from > /home/buildroot/autobuild/instance-3/output/host/powerpc-buildroot-linux-uclibc/sysroot/usr/include/sys/ioctl.h:29, > from custom_baud.c:21: > /home/buildroot/autobuild/instance-3/output/host/powerpc-buildroot-linux-uclibc/sysroot/usr/include/bits/termios.h:33:8: > note: originally defined here > struct termios { > ^~~~~~~ > > So fix it by renaming 'termios' to 'asmtermios' before termbits.h only, > because 'struct termios2' is used only. > > Fixes: > http://autobuild.buildroot.net/results/797dde5cbf0e94162c7cc7b557841605c78ac2f3/ > > Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Peter and I had a look at the issue, and our conclusion is that the actual problem is in uClibc-ng, and should be fixed here. The problem is that the powerpc-specific ioctl-types.h in uClibc-ng includes <termios.h>, see ./libc/sysdeps/linux/powerpc/bits/ioctl-types.h. But neither the MIPS-specific or the generic ioctl-types.h in uClibc-ng do that. If you look at the history of libc/sysdeps/linux/powerpc/bits/ioctl-types.h, before commit e66d628551d918d4ee89d67fe62b627cae27d210, it was like the generic and MIPS ioctl-types.h, i.e defining a number of macros and structures, but certainly not including <termios.h>. Then, if you look at glibc, indeed until commit d4795e4a43e6f0c221bc5dc64c612206a21a177b, the powerpc-specific ioctl-types.h was just including <termios.h>, but in this commit, they changed it back to define the different macros and structures. So basically, the powerpc-specific ioctl-types.h in uClibc-ng needs to be resync'ed with the one from glibc, and it should fix the issue, in a proper way. Could you test this, and if it works, send the patch to upstream uClibc-ng, and add it in package/uclibc/ in Buildroot, until uClibc-ng integrates it in a release ? Thanks a lot! Thomas -- Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH 1/1] package/flashrom: fix redefinition of 'struct termios' 2019-08-02 8:57 ` Thomas Petazzoni @ 2019-08-06 8:55 ` Vadim Kochan 0 siblings, 0 replies; 4+ messages in thread From: Vadim Kochan @ 2019-08-06 8:55 UTC (permalink / raw) To: buildroot Hi Thomas, On Fri, Aug 2, 2019 at 11:57 AM Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote: > > Hello Vadim, > > On Tue, 23 Jul 2019 11:55:16 +0300 > Vadim Kochan <vadim4j@gmail.com> wrote: > > > Both libc and linux defines 'struct termios', in termbits.h and > > termios.h which leads to the compilation error: > > > > In file included from custom_baud.c:23:0: > > > > /home/buildroot/autobuild/instance-3/output/host/powerpc-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/termbits.h:12:8: > > error: redefinition of 'struct termios' > > struct termios { > > ^~~~~~~ > > In file included from > > /home/buildroot/autobuild/instance-3/output/host/powerpc-buildroot-linux-uclibc/sysroot/usr/include/termios.h:39:0, > > from > > /home/buildroot/autobuild/instance-3/output/host/powerpc-buildroot-linux-uclibc/sysroot/usr/include/bits/ioctl-types.h:5, > > from > > /home/buildroot/autobuild/instance-3/output/host/powerpc-buildroot-linux-uclibc/sysroot/usr/include/sys/ioctl.h:29, > > from custom_baud.c:21: > > /home/buildroot/autobuild/instance-3/output/host/powerpc-buildroot-linux-uclibc/sysroot/usr/include/bits/termios.h:33:8: > > note: originally defined here > > struct termios { > > ^~~~~~~ > > > > So fix it by renaming 'termios' to 'asmtermios' before termbits.h only, > > because 'struct termios2' is used only. > > > > Fixes: > > http://autobuild.buildroot.net/results/797dde5cbf0e94162c7cc7b557841605c78ac2f3/ > > > > Signed-off-by: Vadim Kochan <vadim4j@gmail.com> > > Peter and I had a look at the issue, and our conclusion is that the > actual problem is in uClibc-ng, and should be fixed here. > > The problem is that the powerpc-specific ioctl-types.h in uClibc-ng > includes <termios.h>, > see ./libc/sysdeps/linux/powerpc/bits/ioctl-types.h. But neither the > MIPS-specific or the generic ioctl-types.h in uClibc-ng do that. > > If you look at the history of > libc/sysdeps/linux/powerpc/bits/ioctl-types.h, before commit > e66d628551d918d4ee89d67fe62b627cae27d210, it was like the generic and > MIPS ioctl-types.h, i.e defining a number of macros and structures, but > certainly not including <termios.h>. > > Then, if you look at glibc, indeed until commit > d4795e4a43e6f0c221bc5dc64c612206a21a177b, the powerpc-specific > ioctl-types.h was just including <termios.h>, but in this commit, they > changed it back to define the different macros and structures. > > So basically, the powerpc-specific ioctl-types.h in uClibc-ng needs to > be resync'ed with the one from glibc, and it should fix the issue, in a > proper way. > > Could you test this, and if it works, send the patch to upstream > uClibc-ng, and add it in package/uclibc/ in Buildroot, until uClibc-ng > integrates it in a release ? > > Thanks a lot! > > Thomas I will try to handle this. Regards, Vadim Kochan ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-08-06 8:55 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-07-23 8:55 [Buildroot] [PATCH 1/1] package/flashrom: fix redefinition of 'struct termios' Vadim Kochan 2019-07-29 7:13 ` Thomas Petazzoni 2019-08-02 8:57 ` Thomas Petazzoni 2019-08-06 8:55 ` Vadim Kochan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox