mariusmm/RISC-V-TLM

collect2: error: ld returned 1 exit status

Closed this issue · 3 comments

Instruction.cpp:(.text.startup+0x2e): undefined reference to sc_core::sc_api_ve rsion_2_3_2_cxx201103L<&sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_ver sion_2_3_2_cxx201103L(sc_core::sc_writer_policy)' obj/Trace.o:Trace.cpp:(.text.startup+0xea): more undefined references to sc_cor e::sc_api_version_2_3_2_cxx201103L<&sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_> ::sc_api_version_2_3_2_cxx201103L(sc_core::sc_writer_policy)' follow
collect2: error: ld returned 1 exit status
Makefile:31: recipe for target 'RISCV_TLM' failed
make: *** [RISCV_TLM] Error 1

I have the same issue here on a Ubuntu 18.04 box:
obj/Simulator.o: In function _GLOBAL__sub_I__Z8filenameB5cxx11': Simulator.cpp:(.text.startup+0xf1): undefined reference to sc_core::sc_api_version_2_3_2_cxx201103L<&sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_2_cxx201103L(sc_core::sc_writer_policy)'
obj/CPU.o: In function _GLOBAL__sub_I__ZN3CPUC2EN7sc_core14sc_module_nameEj': CPU.cpp:(.text.startup+0xf1): undefined reference to sc_core::sc_api_version_2_3_2_cxx201103L<&sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_2_cxx201103L(sc_core::sc_writer_policy)'

g++ (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I fixed the error by rebuilding SystemC by using
../configure 'CXXFLAGS=-std=c++11'
so it matches the version used by RISC-V-TLM
I found the explanation here:
http://forums.accellera.org/topic/6119-build-error-with-232/

Thank you Ronan, I'll add this setting to Documentation