#2771 closed defect (wontfix)

Empty C++ file with just <rtems.h> does not compile with HEAD.

Reported by: Chris Johns Owned by:
Priority: highest Milestone: 5.1
Component: score Version: 5
Severity: blocker Keywords:
Cc: Blocked By:
Blocking:

Description (last modified by Chris Johns)

I have an application that does not build.

The following C++ file:

$ cat t1.cpp
#include <rtems.h>

does not compile with git head 5fe6d07ad5690e3d9c6445ca3a465a700a5a5015 on Zynq ARM. Build with:

$ /opt/work/rtems/4.12/bin/arm-rtems4.12-g++ \
  -B/opt/work/rtems/4.12/arm-rtems4.12/xilinx_zynq_zc706/lib \
  -B/opt/work/bsps/rtems/4.12/arm-rtems4.12/xilinx_zynq_zc706/lib \
  -specs bsp_specs -qrtems \
  -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -mtune=cortex-a9 \
  -g -O2 -DNDEBUG -std=c++11 \
  -Werror -Wall -Wextra \
  -o t1.o \
  -c t1.cpp

Some (too much to post) of the output is:

In file included from /opt/work/bsps/rtems/4.12/arm-rtems4.12/xilinx_zynq_zc706/lib/include/rtems/score/thread.h:36:0,
                 from /opt/work/bsps/rtems/4.12/arm-rtems4.12/xilinx_zynq_zc706/lib/include/rtems/score/heap.h:22,
                 from /opt/work/bsps/rtems/4.12/arm-rtems4.12/xilinx_zynq_zc706/lib/include/rtems/rtems/types.h:26,
                 from /opt/work/bsps/rtems/4.12/arm-rtems4.12/xilinx_zynq_zc706/lib/include/rtems.h:31,
                 from t1.cpp:1:
/opt/work/bsps/rtems/4.12/arm-rtems4.12/xilinx_zynq_zc706/lib/include/rtems/score/timestamp.h: In function 'void _Timestamp_Set(Timestamp_Control*, time_t, long int)':
/opt/work/bsps/rtems/4.12/arm-rtems4.12/xilinx_zynq_zc706/lib/include/rtems/score/timestamp.h:78:33: error: 'timespec2bintime' was not declared in this scope
   timespec2bintime( &_ts, _time );
                                 ^
/opt/work/si/rtems/4.12/arm-rtems4.12/xilinx_zynq_zc706/lib/include/rtems/score/timestamp.h: In function 'void _Timestamp_Set_to_zero(Timestamp_Control*)':
/opt/work/bsps/rtems/4.12/arm-rtems4.12/xilinx_zynq_zc706/lib/include/rtems/score/timestamp.h:94:8: error: invalid use of incomplete type 'Timestamp_Control {aka struct bintime}'
   _time->sec = 0;
        ^~
In file included from /opt/work/rtems/4.12/arm-rtems4.12/include/sys/time.h:299:0,
                 from /opt/work/bsps/rtems/4.12/arm-rtems4.12/xilinx_zynq_zc706/lib/include/rtems/score/timestamp.h:43,
                 from /opt/work/bsps/rtems/4.12/arm-rtems4.12/xilinx_zynq_zc706/lib/include/rtems/score/thread.h:36,
                 from /opt/work/bsps/rtems/4.12/arm-rtems4.12/xilinx_zynq_zc706/lib/include/rtems/score/heap.h:22,
                 from /opt/work/bsps/rtems/4.12/arm-rtems4.12/xilinx_zynq_zc706/lib/include/rtems/rtems/types.h:26,
                 from /opt/work/bsps/rtems/4.12/arm-rtems4.12/xilinx_zynq_zc706/lib/include/rtems.h:31,
                 from t1.cpp:1:
/opt/work/rtems/4.12/arm-rtems4.12/include/machine/_time.h:40:15: note: forward declaration of 'Timestamp_Control {aka struct bintime}'
 extern struct bintime _Timecounter_Boottimebin;
               ^~~~~~~

If '-std=c++11' is removed or replaced with '-std=gnu++11' the error becomes:

arm-rtems4.12-g++: fatal error: /opt/work/bsps/rtems/4.12/arm-rtems4.12/xilinx_zynq_zc706/lib/bsp_specs: attempt to rename spec 'endfile' to already defined spec 'old_endfile'

Change History (14)

comment:1 Changed on Aug 4, 2016 at 12:22:19 AM by Chris Johns

Description: modified (diff)

comment:2 Changed on Aug 4, 2016 at 12:23:37 AM by Chris Johns

Summary: Empty C++ file does not compile with HEAD.Empty C++ file with just <rtems.h> does not compile with HEAD.

comment:3 Changed on Aug 4, 2016 at 5:19:19 AM by Sebastian Huber

I cannot reproduce this problem. The C++ tests build fine.

comment:4 in reply to:  3 ; Changed on Aug 4, 2016 at 5:33:46 AM by Chris Johns

Replying to sebastian.huber:

I cannot reproduce this problem.

Is this your build or the RSB?

The C++ tests build fine.

Which tests?

comment:5 in reply to:  4 Changed on Aug 4, 2016 at 5:40:29 AM by Sebastian Huber

Replying to chrisj:

Replying to sebastian.huber:

I cannot reproduce this problem.

Is this your build or the RSB?

arm-rtems4.12-g++ --version
arm-rtems4.12-g++ (GCC) 6.1.1 20160609 (RTEMS 4.12, RSB c476de6150f39afdf142c6f4420c59ba2f1aa2fe, Newlib 2.4.0.20160527)

The C++ tests build fine.

Which tests?

For example the iostream test (--enable-tests --enable-cxx).

comment:6 Changed on Aug 4, 2016 at 5:50:55 AM by Chris Johns

I have:

arm-rtems4.12-g++ (GCC) 6.1.1 20160609 (RTEMS 4.12, RSB cac72a2aea711f671816d7c41bb1cfe66d54ee37, Newlib 2.4.0.20160527)

and the tests build OK as well. The problem still exists.

comment:7 Changed on Aug 4, 2016 at 5:54:46 AM by Sebastian Huber

I guess it is a problem with your local BSP/RTEMS installation or command line. Do you have a double "-specs bsp_specs" for example? You must specify the specs exactly once on the command line.

comment:8 Changed on Aug 4, 2016 at 5:56:02 AM by Chris Johns

The second issue with the bsp_specs was a command issue where is was not being show correctly on the terminal. The first issue exists. I will update a .i file.

comment:9 Changed on Aug 4, 2016 at 5:59:24 AM by Sebastian Huber

The <rtems.h> uses BSD extensions, e.g. struct bintime, thus it doesn't work with -std=c++11.

The main problem is that <rtems.h> includes way too many implementation details.

comment:10 Changed on Aug 4, 2016 at 6:00:11 AM by Chris Johns

Ah ok this is the problem. Is this something that needs to be fixed?

comment:11 Changed on Aug 4, 2016 at 6:03:08 AM by Sebastian Huber

Yes, but it has very low priority for me. Its probably something for the new-build-system era.

comment:12 Changed on Aug 4, 2016 at 6:04:59 AM by Chris Johns

Resolution: wontfix
Status: newclosed

comment:13 Changed on May 11, 2017 at 7:31:02 AM by Sebastian Huber

Milestone: 4.124.12.0

comment:14 Changed on Nov 9, 2017 at 6:27:14 AM by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

Note: See TracTickets for help on using tickets.