Forum Discussion
yes my quartus version and hls version is the same, and they are both 19.1
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?