Hi all,

the new Debian stable/stretch ships with GCC 6.3.0. When I build
simulavr with this version, I get some errors that I've fixed with the
attached patches.

0001-remove-debugging-defines.patch:

Deletes the GTEST_CXXFLAGS = -Dprivate=public -Dprotected=public from
Makefile.am. Otherwise GCC complains about redeclaration with different
access specifiers of sstream:

> g++ -DHAVE_CONFIG_H -I. -I../../src   -fdiagnostics-color -Dprivate=public 
> -Dprotected=public  -Igtest-1.6.0/include/gtest -Igtest-1.6.0/include 
> -Igtest-1.6.0 -I../../src -g -g -O2 -MT gtest_main.o -MD -MP -MF $depbase.Tpo 
> -c -o gtest_main.o gtest_main.cpp &&\
> mv -f $depbase.Tpo $depbase.Po
> In file included from gtest-1.6.0/include/gtest/internal/gtest-port.h:197:0,
>                  from gtest-1.6.0/include/gtest/internal/gtest-internal.h:40,
>                  from gtest-1.6.0/include/gtest/gtest.h:57,
>                  from session_001/unittest001.cpp:4:
> /usr/include/c++/6/sstream:300:7: error: ‘struct 
> std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>::__xfer_bufptrs’ 
> redeclared with different access
>        struct __xfer_bufptrs
>        ^~~~~~


0002-delete-duplicate-architecture-definition.patch:

> avr-gcc -c -Wa,-gstabs -x assembler-with-cpp -o singlepincomm.o 
> singlepincomm.s
> singlepincomm.s: Assembler messages:
> singlepincomm.s:26: Fatal error: redefinition of mcu type `avr2' to `attiny25'

In two .s files there's a '.arch ATTiny25' pseudo op at the very
beginning. GCC complains that this is a redefinition because the -mmcu=
command line argument defaults to avr2 if missing:

  https://gcc.gnu.org/onlinedocs/gcc/AVR-Options.html

Removing the .arch pseudo op and adding -mmcu=attiny to Makefile.am
fixes the problem.

Don't forget to rerun ./bootstrap and ./configure ...

Cheers,
panic
>From b838672ec515ec7cdb91005581c554c046bfab74 Mon Sep 17 00:00:00 2001
From: panic <li...@xandea.de>
Date: Mon, 19 Jun 2017 14:13:31 +0200
Subject: [PATCH 1/2] remove debugging defines

---
 regress/gtest/Makefile.am | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/regress/gtest/Makefile.am b/regress/gtest/Makefile.am
index b8ab6bd..42cf331 100644
--- a/regress/gtest/Makefile.am
+++ b/regress/gtest/Makefile.am
@@ -7,8 +7,6 @@ GTEST_OBJS = gtest-1.6.0/src/gtest-all.cc
 
 GTEST_INCLUDE = -Igtest-1.6.0/include/gtest -Igtest-1.6.0/include -Igtest-1.6.0
 
-GTEST_CXXFLAGS = -Dprivate=public -Dprotected=public 
-
 GTEST_EXTRA_FILES = gtest-1.6.0/src/gtest-internal-inl.h \
                     gtest-1.6.0/src/gtest-filepath.cc \
                     gtest-1.6.0/src/gtest.cc \
@@ -74,7 +72,7 @@ OBJS_TARGET = session_001/avr_code.atmega32.o \
               session_irq_check/tc5.atmega32.o \
               session_io_pin/tc1.atmega128.o
 
-AM_CXXFLAGS = $(GTEST_CXXFLAGS) $(GTEST_INCLUDE) $(SIMULAVR_INCLUDE) -g
+AM_CXXFLAGS = $(GTEST_INCLUDE) $(SIMULAVR_INCLUDE) -g
 
 EXTRA_DIST = $(OBJS_SRC) $(GTEST_EXTRA_FILES)
 
-- 
2.11.0

>From 85ce9cf2aa059c8ce22e0f7a82552a8a248f1ef3 Mon Sep 17 00:00:00 2001
From: panic <li...@xandea.de>
Date: Mon, 19 Jun 2017 14:14:11 +0200
Subject: [PATCH 2/2] delete duplicate architecture definition

Previously, gcc threw errors similar to

  Fatal error: redefinition of mcu type `avr2' to `attiny25'

The mcu type is already defined via command line parameter -mmcu=.
Removing .arch from the source, avoids the redefinition and the
error.
---
 examples/verilog/Makefile.am     | 2 +-
 examples/verilog/right-unit.s    | 2 +-
 examples/verilog/singlepincomm.s | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/examples/verilog/Makefile.am b/examples/verilog/Makefile.am
index a70941f..6a1aff1 100644
--- a/examples/verilog/Makefile.am
+++ b/examples/verilog/Makefile.am
@@ -54,7 +54,7 @@ vst.elf: vst.cpp
 
 
 .s.o:
-	$(AVR_GCC) -c -Wa,-gstabs -x assembler-with-cpp -o $@ $<
+	$(AVR_GCC) -mmcu=attiny25 -c -Wa,-gstabs -x assembler-with-cpp -o $@ $<
 
 left-unit.elf: left-unit.o csinglepincomm.o
 
diff --git a/examples/verilog/right-unit.s b/examples/verilog/right-unit.s
index f45d2b4..885b4ff 100644
--- a/examples/verilog/right-unit.s
+++ b/examples/verilog/right-unit.s
@@ -14,7 +14,7 @@
 // with this program; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA..
 //  
-.arch ATTiny25
+
 #define __SFR_OFFSET 0
 	
 #define	__AVR_ATtiny25__	1
diff --git a/examples/verilog/singlepincomm.s b/examples/verilog/singlepincomm.s
index 088a359..2bd758c 100644
--- a/examples/verilog/singlepincomm.s
+++ b/examples/verilog/singlepincomm.s
@@ -23,7 +23,7 @@
 // warranty!
 //
 //-----------------------------------------------------------------------------
-.arch ATTiny25
+
 #define	__AVR_ATtiny25__	1
 #define __SFR_OFFSET 0
 #include <avr/io.h>
-- 
2.11.0

_______________________________________________
Simulavr-devel mailing list
Simulavr-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/simulavr-devel

Reply via email to