UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor dommynik
Visitor
4,881 Views
Registered: ‎01-20-2017

Testbench error with gcc

Hi,

 

everytime I start the C simulation with GCC or the Cosimulation I get the following errors:

 

INFO: [SIM 2] *************** CSIM start ***************
INFO: [SIM 4] CSIM will launch GCC as the compiler.
   Compiling ../../../../../testbench/axi_hmc_tb.cpp in debug mode
In file included from /opt/Xilinx/Vivado_HLS/2016.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/include-fixed/features.h:339:0,
                 from /opt/Xilinx/Vivado_HLS/2016.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../include/c++/4.6.3/x86_64-unknown-linux-gnu/bits/os_defines.h:40,
                 from /opt/Xilinx/Vivado_HLS/2016.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../include/c++/4.6.3/x86_64-unknown-linux-gnu/bits/c++config.h:393,
                 from /opt/Xilinx/Vivado_HLS/2016.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../include/c++/4.6.3/bits/stl_algobase.h:60,
                 from /opt/Xilinx/Vivado_HLS/2016.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../include/c++/4.6.3/deque:61,
                 from /opt/Xilinx/Vivado_HLS/2016.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../include/c++/4.6.3/queue:61,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/hls_stream.h:79,
                 from ../../../../../testbench/../inc/axi_hmc.h:3,
                 from ../../../../../testbench/axi_hmc_tb.cpp:1:
/usr/include/sys/cdefs.h:481:49: error: missing binary operator before token "("
In file included from /opt/Xilinx/Vivado_HLS/2016.4/include/hls_stream.h:92:0,
                 from ../../../../../testbench/../inc/axi_hmc.h:3,
                 from ../../../../../testbench/axi_hmc_tb.cpp:1:
/usr/include/stdlib.h:183:17: error: missing binary operator before token "("
In file included from /opt/Xilinx/Vivado_HLS/2016.4/include/etc/ap_int_sim.h:75:0,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/ap_int.h:74,
                 from ../../../../../testbench/../inc/axi_hmc.h:4,
                 from ../../../../../testbench/axi_hmc_tb.cpp:1:
/usr/include/stdio.h:320:43: error: missing binary operator before token "("
/usr/include/stdio.h:399:17: error: missing binary operator before token "("
/usr/include/stdio.h:657:43: error: missing binary operator before token "("
In file included from /opt/Xilinx/Vivado_HLS/2016.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/include-fixed/limits.h:169:0,
                 from /opt/Xilinx/Vivado_HLS/2016.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/include-fixed/syslimits.h:7,
                 from /opt/Xilinx/Vivado_HLS/2016.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/include-fixed/limits.h:34,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/etc/ap_int_sim.h:97,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/ap_int.h:74,
                 from ../../../../../testbench/../inc/axi_hmc.h:4,
                 from ../../../../../testbench/axi_hmc_tb.cpp:1:
/usr/include/limits.h:145:17: error: missing binary operator before token "("
In file included from /opt/Xilinx/Vivado_HLS/2016.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/include/stdint.h:3:0,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/etc/ap_private.h:79,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/etc/ap_int_sim.h:98,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/ap_int.h:74,
                 from ../../../../../testbench/../inc/axi_hmc.h:4,
                 from ../../../../../testbench/axi_hmc_tb.cpp:1:
/usr/include/stdint.h:310:17: error: missing binary operator before token "("
In file included from /opt/Xilinx/Vivado_HLS/2016.4/include/etc/ap_private.h:122:0,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/etc/ap_int_sim.h:98,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/ap_int.h:74,
                 from ../../../../../testbench/../inc/axi_hmc.h:4,
                 from ../../../../../testbench/axi_hmc_tb.cpp:1:
/usr/include/math.h:51:17: error: missing binary operator before token "("
In file included from /opt/Xilinx/Vivado_HLS/2016.4/include/etc/ap_private.h:122:0,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/etc/ap_int_sim.h:98,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/ap_int.h:74,
                 from ../../../../../testbench/../inc/axi_hmc.h:4,
                 from ../../../../../testbench/axi_hmc_tb.cpp:1:
/usr/include/math.h:126:17: error: missing binary operator before token "("
In file included from /opt/Xilinx/Vivado_HLS/2016.4/include/etc/ap_private.h:122:0,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/etc/ap_int_sim.h:98,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/ap_int.h:74,
                 from ../../../../../testbench/../inc/axi_hmc.h:4,
                 from ../../../../../testbench/axi_hmc_tb.cpp:1:
/usr/include/math.h:158:17: error: missing binary operator before token "("
In file included from /usr/include/math.h:213:0,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/etc/ap_private.h:122,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/etc/ap_int_sim.h:98,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/ap_int.h:74,
                 from ../../../../../testbench/../inc/axi_hmc.h:4,
                 from ../../../../../testbench/axi_hmc_tb.cpp:1:
/usr/include/bits/mathcalls.h:118:17: error: missing binary operator before token "("
/usr/include/bits/mathcalls.h:299:17: error: missing binary operator before token "("
/usr/include/bits/mathcalls.h:318:17: error: missing binary operator before token "("
/usr/include/bits/mathcalls.h:387:17: error: missing binary operator before token "("
In file included from /usr/include/math.h:234:0,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/etc/ap_private.h:122,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/etc/ap_int_sim.h:98,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/ap_int.h:74,
                 from ../../../../../testbench/../inc/axi_hmc.h:4,
                 from ../../../../../testbench/axi_hmc_tb.cpp:1:
/usr/include/bits/mathcalls.h:118:17: error: missing binary operator before token "("
/usr/include/bits/mathcalls.h:299:17: error: missing binary operator before token "("
/usr/include/bits/mathcalls.h:318:17: error: missing binary operator before token "("
/usr/include/bits/mathcalls.h:387:17: error: missing binary operator before token "("
In file included from /usr/include/math.h:281:0,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/etc/ap_private.h:122,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/etc/ap_int_sim.h:98,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/ap_int.h:74,
                 from ../../../../../testbench/../inc/axi_hmc.h:4,
                 from ../../../../../testbench/axi_hmc_tb.cpp:1:
/usr/include/bits/mathcalls.h:118:17: error: missing binary operator before token "("
/usr/include/bits/mathcalls.h:299:17: error: missing binary operator before token "("
/usr/include/bits/mathcalls.h:318:17: error: missing binary operator before token "("
/usr/include/bits/mathcalls.h:387:17: error: missing binary operator before token "("
In file included from /opt/Xilinx/Vivado_HLS/2016.4/include/etc/ap_private.h:122:0,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/etc/ap_int_sim.h:98,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/ap_int.h:74,
                 from ../../../../../testbench/../inc/axi_hmc.h:4,
                 from ../../../../../testbench/axi_hmc_tb.cpp:1:
/usr/include/math.h:408:17: error: missing binary operator before token "("
/usr/include/math.h:628:17: error: missing binary operator before token "("
In file included from /opt/Xilinx/Vivado_HLS/2016.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../include/c++/4.6.3/cstring:44:0,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/etc/ap_private.h:124,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/etc/ap_int_sim.h:98,
                 from /opt/Xilinx/Vivado_HLS/2016.4/include/ap_int.h:74,
                 from ../../../../../testbench/../inc/axi_hmc.h:4,
                 from ../../../../../testbench/axi_hmc_tb.cpp:1:
/usr/include/string.h:169:21: error: missing binary operator before token "("
/usr/include/string.h:178:43: error: missing binary operator before token "("
make: *** [csim.mk:73: obj/axi_hmc_tb.o] Error 1
CRITICAL WARNING: [SIM 100] CSim file generation failed: compilation error(s).
INFO: [SIM 3] *************** CSIM finish ***************

 Do you know that error and is there any workaround? I have a fresh installation of Antergos with GCC 6.3.1.

5 Replies
Teacher muzaffer
Teacher
4,858 Views
Registered: ‎03-31-2012

Re: Testbench error with gcc

@dommynik you probably have a typo in one of these files:

 

                 from ../../../../../testbench/../inc/axi_hmc.h:3,
                 from ../../../../../testbench/axi_hmc_tb.cpp:1:

show the first 5 lines of axi_hmc.h and axi_hmc_tb.cpp 

- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.
0 Kudos
Highlighted
Visitor dommynik
Visitor
4,837 Views
Registered: ‎01-20-2017

Re: Testbench error with gcc

@muzaffer

 

axi_hmc.h

#pragma once

#include <hls_stream.h>
#include <ap_int.h>

#define NUM_TAGS 512
#define NUM_TOKENS 16
...

axi_hmc_tb.cpp

#include "../inc/axi_hmc.h"
#include <iostream>

int main() {
	ReadAddress::Stream addressInStr;
	TagStream tagInStr;
	TokenStream tokenInStr;
...

The strange thing is that it works with the clang compiler but not with the gcc compiler. Therefore I assumed that there has to be some misconfiguration, either with gcc or Vivado. 

0 Kudos
Adventurer
Adventurer
4,377 Views
Registered: ‎02-06-2012

Re: Testbench error with gcc

Hi @dommynik,

 

I've had very similiar problem and was able to fix it.

In my case the problem was caused by GLIBC headers. My glibc version was too new for Vivado HLS (openSuse Tumbleweed with glibc 2.25). As you can see in the logs Vivado HLS is mixing some system-wide glibc headers (/usr/include/...) with it's own bundled files (e.g. features.h). This  causes a lot of headache because glibc headers define and use a lot of macros which can appear/disappear/move to another file.

In my case the problem was that Vivado HLS bundled it's own features.h file (which defines a lot of macros used by another glibc headers) but didn't bundle sys/cdefs.h. Because my system-wide /usr/include/sys/cdefs.h expects some macros which are missing in old, Vivado-bundled features.h the whole thing falls apart.

 

These steps fixed it for me:

  1. Download older glibc version (I used 2.17) and unpack it.
  2. Copy glibc-2.17/misc/sys/cdefs.h to Vivado_HLS/2017.1/lnx64/tools/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/include-fixed/sys/ directory.
  3. Now I had problems with limits.h caused by another missing macro ( __GLIBC_USE() )
  4. Open Vivado_HLS/2017.1/lnx64/tools/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/include-fixed/features.h and add this somewhere in the middle:
     /* Whether to use feature set F.  */
     #define __GLIBC_USE(F)  __GLIBC_USE_ ## F
    

Now I can go back to my real work.

 

Cheers,

Adrian

 

Tags (1)
Visitor corna
Visitor
2,368 Views
Registered: ‎04-11-2018

Re: Testbench error with gcc

Maybe a bit late, however running

 

<Vivado install path>/Vivado/2017.3/lnx64/tools/gcc/libexec/gcc/x86_64-unknown-linux-gnu/4.6.3/install-tools/mkheaders <Vivado install path>/Vivado/2017.3/lnx64/tools/gcc

 

fixed the issue for me (Vivado 2017.3 on Ubuntu 17.10).

Observer kadionik
Observer
2,195 Views
Registered: ‎06-02-2008

Re: Testbench error with gcc

Hi corna.

 

I've discovered your tip since my last reading of this thread in march and it solved the problem of HLS simulation under Fedora 27 (glibc-headers too old in Vivado).

 

It works for me with Vivado HLS 2016.3 and 2018.1 (default installation under /opt/Xilinx).

 

For 2016.3:

$ sudo /opt/Xilinx/Vivado_HLS/2016.3/lnx64/tools/gcc/libexec/gcc/x86_64-unknown-linux-gnu/4.6.3/install-tools/mkheaders /opt/Xilinx/Vivado_HLS/2016.3/lnx64/tools/gcc/

 

For 2018.1:

$ sudo /opt/Xilinx/Vivado/2018.1/lnx64/tools/gcc/libexec/gcc/x86_64-unknown-linux-gnu/4.6.3/install-tools/mkheaders /opt/Xilinx/Vivado/2018.1/lnx64/tools/gcc

 

Many thanks!

 

Pat