Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16908 Discussions

How to install older version of GCC compiler for HLS?

gwatcha
Beginner
4,970 Views

I'm following the intel® high level synthesis compiler getting started guide for the Linux version it states that GCC compiler must be version 4.4.7 and newer ones are not supported. 

I'm running Manjaro, and have installed gcc 4.4.7, but i++ keeps using the previous version when including files, and I think that is why it is breaking when I make.

 

Here is an example output when I try to make the counter example.

 

```

included fle targets: test-x86-64, test-fpga, test-gpp, clean
i++ counter.cpp -march=x86-64 -o test-x86-64
In file included from counter.cpp:1:
In file included from /home/michael/Program/intelFPGA/19.1/hls/include/HLS/hls.h:11:
In file included from /home/michael/Program/intelFPGA/19.1/hls/include/HLS/hls_internal.h:5:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../include/c++/10.1.0/queue:62:
/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../include/c++/10.1.0/bits/stl_function.h:424:10: error: use of
undeclared identifier '__UINTPTR_TYPE__'
return (__UINTPTR_TYPE__)__x > (__UINTPTR_TYPE__)__y;
^
/usr/lib/gcc/x86_64-pc

```

 

As you can see, it uses `/usr/lib/gcc/x64_64-pc-linux-gnu/10.1.0`, instead of `/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.7`.

 

I don't know how to get it to use the older version, I have put these two lines in my .bashrc but it still does not work:

```

export CC=gcc-4.4
export GXX_INCLUDE=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.7/include/c++

```

Please help, I've been trying to set up this hls thing for about a day now, it's so frustrating

0 Kudos
16 Replies
Kenny_Tan
Moderator
4,962 Views

Have you set the environment variable?

 

https://www.intel.com/content/www/us/en/programmable/documentation/ewa1462824960255.html#ewa1462897780080 look for --gcc-toolchain=<GCC_dir>

 

0 Kudos
gwatcha
Beginner
4,953 Views

I tried setting that option earlier but I believe it is only for the Pro version, and I am using the Lite version (version 19.1, installed via additional software tab on quartus install page).

0 Kudos
Kenny_Tan
Moderator
4,945 Views

https://www.intel.com/content/www/us/en/programmable/documentation/apo1572388959915.html it did mention:

In Intel HLS Compiler Standard Edition Command Options, corrected --gcc-toolchain option syntax.


I can't seems to find it. were you able to find it? If no, I will log a bug on it.


0 Kudos
gwatcha
Beginner
4,937 Views

Hey Kenny, thanks for your help. I think I set the option, but it dosen't seem to do anything. 

I tried setting

`HLS_CXX_FLAGS := -gcc-name=gcc-4.4.7 -gcc-toolchain=/lib/gcc/x86_64-pc-linux-gnu/4.4.7`

in the Makefile for the counter example, and it accepted the option (it does not accept the option with --gcc-toolchain syntax), but I still get the same error message when I build it. The option also isn't listed under --help, so I think this may be a bug.

0 Kudos
Kenny_Tan
Moderator
4,901 Views

This might be a bug for older version of Quartus. Can you try it with the latest release 20.1? I will file a bug to developer to check on this if it still happened on 20.1.

Also, When I check again the export GCC environment, it should show on the Path itsefl.

Example:

# GCC Enviroment

export GCC_ROOTDIR=/usr/local/gcc_version/bin

export PATH=$GCC_ROOTDIR:$PATH

export LD_LIBRARY_PATH=user/...

https://www.intel.co.jp/content/dam/www/programmable/us/en/pdfs/literature/an/an918.pdf

To check gcc version 

gcc --version

0 Kudos
gwatcha
Beginner
4,895 Views

I got it working, although in a sort of hackish way.

 

After installing `gcc44` on manjaro. I altered the Makefile of the counter example to have this at the top:

```

SOURCE_FILES := counter.cpp
HLS_CXX_FLAGS :=
CXXFLAGS := -I/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.7/include/c++ -I/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.7/include/c++/x86_64-pc-linux-gnu
CXX := i++

```

So you can see I include the 4.4.7 library directly.

I also had to rename the `10.1.0` directory in /usr/lib/gcc/x86_64-pc-linux-gnu to `10.1.0_` so it wouldn't be able to find it and stop prioritizing it.

```

[zen x86_64-pc-linux-gnu]# pwd
/usr/lib/gcc/x86_64-pc-linux-gnu

[zen x86_64-pc-linux-gnu]# ls
10.1.0_ 4.4.7

```

After that, the example compiles!

0 Kudos
gwatcha
Beginner
4,894 Views

I would try it with Quartus 20.1, but how do I install the HLS compiler for that version? I noticed that it is not under the additional software tab.

0 Kudos
Kenny_Tan
Moderator
4,891 Views

Yes, you need the same compiler for HLS.

For your Q19.3, you compiler is the same version. Right?

 

0 Kudos
gwatcha
Beginner
4,887 Views

yes my quartus version and hls version is the same, and they are both 19.1

0 Kudos
gwatcha
Beginner
4,875 Views

I tried not doing it my way and reverting the directory name change and following your suggestion. My resulting .bashrc looks like this:

 

 

export PATH=$PATH:/home/michael/Program/intelFPGA/19.1/modelsim_ase/bin
export QUARTUS_ROOTDIR=/home/michael/Program/intelFPGA/19.1
export QSYS_ROOTDIR=/home/michael/Program/intelFPGA/19.1/quartus/sopc_builder/bin

#GCC ENV for HLS
export GCC_ROOTDIR=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.7
export PATH=$GCC_ROOTDIR:$PATH
export LD_LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.7/lib:$LD_LIBRARY_PATH
export CPLUS_INCLUDE_PATH=/home/michael/Program/intelFPGA/19.1/hls/include:/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.7/include
export LIBRARY_PATH=/home/michael/Program/intelFPGA/19.1/hls/host/linux64/lib

source /home/michael/Program/intelFPGA/19.1/hls/init_hls.sh

 

 

 

Yet I still get some errors due to gcc 10.1 being included

 

 

╭─ ~/Program/intelFPGA/19.1/hls/examples/counter
╰─❯ bash
Assuming current directory (/home/michael/Program/intelFPGA/19.1/hls) is root of i++

Will use Quartus at /home/michael/Program/intelFPGA/19.1/hls/../quartus
Will be using  Modelsim at /home/michael/Program/intelFPGA/19.1/modelsim_ase/bin
Adding /home/michael/Program/intelFPGA/19.1/hls/bin to PATH
Adding /home/michael/Program/intelFPGA/19.1/hls/host/linux64/lib to LD_LIBRARY_PATH
[michael@zen counter]$ make
No target specified, defaulting to test-x86-64
Available targets: test-x86-64, test-fpga, test-gpp, clean
i++ counter.cpp -I/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.7/include/c++ -I/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.7/include/c++/x86_64-pc-linux-gnu  -march=x86-64 -o test-x86-64
In file included from counter.cpp:1:
In file included from /home/michael/Program/intelFPGA/19.1/hls/include/HLS/hls.h:11:
In file included from /home/michael/Program/intelFPGA/19.1/hls/include/HLS/hls_internal.h:10:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../include/c++/10.1.0/stdlib.h:36:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.7/include/c++/cstdlib:101:11: error: no member named 'div_t' in the global
      namespace
  using ::div_t;
        ~~^
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.7/include/c++/cstdlib:102:11: error: no member named 'ldiv_t' in the global
      namespace
  using

...

 

 

 

Now my work around is to put this into the Makefile for the counter example:

 

CXXFLAGS := -I/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.7/include/c++ -I/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.7/include/c++/x86_64-pc-linux-gnu

 

As well as changing the directory name:

 

/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0 -> /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0_

 

 To fool the compiler.

 

This fix dosen't get too far however, although `make test-x86-64` works, I get the following error when running `make test-fpga`

 

# vsim -t ps "+nowarnTFMPC" -L work -L work_lib -L tb_count_internal_10 -L tb_altera_irq_mapper_191 -L tb_avalon_split_multibit_conduit_10 -L tb_hls_sim_main_dpi_controller_10 -L tb_count_10 -L tb_avalon_conduit_fanout_10 -L tb_avalon_concatenate_singlebit_conduits_10 -L tb_hls_sim_component_dpi_controller_10 -L tb_hls_sim_clock_reset_10 -L altera_ver -L lpm_ver -L sgate_ver -L altera_mf_ver -L altera_lnsim_ver -L twentynm_ver -L twentynm_hssi_ver -L twentynm_hip_ver -L altera -L lpm -L sgate -L altera_mf -L altera_lnsim -L twentynm -L twentynm_hssi -L twentynm_hip tb 
# Start time: 12:01:41 on Jul 16,2020
# ** Fatal: ** Error: (vsim-3827) Could not compile 'export_tramp.so': cmd = '/bin/gcc   -shared -fPIC -m32  -g  -I. -I"/home/michael/Program/intelFPGA/19.1/modelsim_ase/include" -I"/home/michael/Program/intelFPGA/19.1/modelsim_ase/../oem/include" -o "/tmp/michael@zen_dpi_29969/linuxpe_gcc-10.1.0/export_tramp.so" "/tmp/michael@zen_dpi_29969/linuxpe_gcc-10.1.0/export_tramp.S"'
# (vsim-50) A call to system(/bin/gcc   -shared -fPIC -m32  -g  -I. -I"/home/michael/Program/intelFPGA/19.1/modelsim_ase/include" -I"/home/michael/Program/intelFPGA/19.1/modelsim_ase/../oem/include" -o "/tmp/michael@zen_dpi_29969/linuxpe_gcc-10.1.0/export_tramp.so" "/tmp/michael@zen_dpi_29969/linuxpe_gcc-10.1.0/export_tramp.S" >'/tmp/questatmp.775vJi' 2>&1) returned error code '1'.
# The logfile contains the following messages:
# gcc: fatal error: ‘-fuse-linker-plugin’, but liblto_plugin.so not found
# compilation terminated.
# 
# No such file or directory. (errno = ENOENT)
# 
# 
# FATAL ERROR while loading design
# ** Error: Error loading design
# Executing ONERROR command at macro ./tb/sim/mentor/msim_compile.tcl line 8

 

And I believe this is because the fix dosen't fool `vsim` (you can see it is looking for something in gcc 10.1 and can't find it).

 

So despite my fix, a proper solution would be nice.

There must be some kind of environment variable to set to have it include files from the right directory, right?

0 Kudos
Kenny_Tan
Moderator
4,826 Views

Will get back to you on this..

Btw, I forgot to ask, what OS that you were using?

0 Kudos
Kenny_Tan
Moderator
4,807 Views

any update on the OS?


0 Kudos
gwatcha
Beginner
4,798 Views

Hey sorry I missed your message, I'm using Manjaro Linux.

0 Kudos
Kenny_Tan
Moderator
4,766 Views

Seems like this OS is not supported. You may refer to https://www.intel.com/content/www/us/en/programmable/support/support-resources/download/os-support.html


Can use the supported OS? Usually, engineering will not support for non supported OS for issues.


0 Kudos
Kenny_Tan
Moderator
4,745 Views

any chance you manage to get the supported OS?


0 Kudos
Kenny_Tan
Moderator
4,714 Views

We do not receive any response from you to the previous question that we have provided. Please post a response in the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you with your follow-up questions. 


0 Kudos
Reply