From f4a28c4bc53589c3b985a3b967519e808bcda3c7 Mon Sep 17 00:00:00 2001 From: Liangfu Chen Date: Wed, 4 Sep 2019 00:31:32 +0800 Subject: [PATCH] [VTA] Fix TSIM compile error in Linux (add missing -fPIC flag) (#3876) * [VTA] Fix TSIM compile error in Linux (add missing -fPIC flag); * [VTA] Fix TSIM compile error in Linux (add missing -fPIC flag); * fix indentation problem; --- vta/hardware/chisel/Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/vta/hardware/chisel/Makefile b/vta/hardware/chisel/Makefile index f8bb55d..6cd2802 100644 --- a/vta/hardware/chisel/Makefile +++ b/vta/hardware/chisel/Makefile @@ -82,7 +82,6 @@ cxx_flags += -I$(tvm_dir)/3rdparty/dlpack/include ld_flags = -fPIC -shared cxx_objs = $(verilator_build_dir)/verilated.o $(verilator_build_dir)/verilated_dpi.o $(verilator_build_dir)/tsim_device.o -cxx_objs += $(patsubst %.cpp,%.o,$(wildcard $(verilator_build_dir)/*.cpp)) ifneq ($(USE_TRACE), 0) verilator_opt += --trace @@ -108,13 +107,16 @@ default: lib lib: $(lib_path) $(verilator_build_dir)/%.o: %.cpp - $(CXX) -c $(cxx_flags) $^ -o $@ + $(CXX) -fPIC $(cxx_flags) -c $^ -o $@ $(verilator_build_dir)/tsim_device.o: tsim_device.cc - $(CXX) -c $(cxx_flags) $^ -o $@ + $(CXX) -fPIC $(cxx_flags) -c $^ -o $@ $(lib_path): $(verilator_build_dir)/V$(TOP_TEST).cpp $(cxx_objs) - $(CXX) $(cxx_flags) $(ld_flags) $(cxx_objs) -o $@ + for f in $(shell find $(verilator_build_dir)/*.cpp); do \ + $(CXX) -fPIC $(cxx_flags) -c $${f} -o $${f}.o ; \ + done + $(CXX) $(ld_flags) $(cxx_flags) $(cxx_objs) $(patsubst %.cpp,%.cpp.o,$(shell find $(verilator_build_dir)/*.cpp)) -o $@ verilator: $(verilator_build_dir)/V$(TOP_TEST).cpp $(verilator_build_dir)/V$(TOP_TEST).cpp: $(chisel_build_dir)/$(TOP_TEST).$(CONFIG).v -- 2.7.4