ollie_lin Posted January 12, 2022 Report Posted January 12, 2022 Hi everyone. I'm newbie. I have some problem about build scv library. please help me to fix issue. thanks a lot. systemC Version: systemc-2.3.3 scv Version: scv-2.0.1 ubuntu Version : Ubuntu 20.04.3 LTS main.cpp: #include <scv.h> using namespace std; int sc_main(int argc, char* argv[]) { scv_startup(); cout << "Hello world, SCV library." << endl; return 0; } Makefile: TARGET = out IDIR = . SDIR = . ODIR = . SRC = $(wildcard $(SDIR)/*.cpp) OBJ = $(SRC:$(SDIR)/%.c=$(ODIR)/%.o) CXX = g++ CXXFLAGS = -I$(IDIR) CXXFLAGS += -g -O0 CXXFLAGS += -Iinclude CFLAGS += -Wall SCPATH = /usr/local/systemc LIBS = -lm $(TARGET): $(OBJ) $(CXX) $(CXXFLAGS) $(LDFLAGS) -I$(SCPATH)/include -L. -L$(SCPATH)/lib-linux64 -Wl,-rpath $(SCPATH)/lib-linux64 $^ $(LIBS) -o $@ -lsystemc $(ODIR)/%.o: $(SDIR)/%.c $(CXX) $(CXXFLAGS) $(CFLAGS) -c $< -o $@ clean: $(RM) $(TARGET) Error log: g++ -I. -g -O0 -Iinclude -I/usr/local/systemc/include -L. -L/usr/local/systemc/lib-linux64 -Wl,-rpath /usr/local/systemc/lib-linux64 main.cpp -lm -o out -lsystemc /usr/bin/ld: /tmp/ccjI5lPb.o: in function `sc_main': /home/ollie/Desktop/digital/systemC_verify/hello/main.cpp:9: undefined reference to `scv_startup()' collect2: error: ld returned 1 exit status make: *** [Makefile:19: out] Error 1 Quote
maehne Posted January 12, 2022 Report Posted January 12, 2022 As for SystemC, you have to pass for SCV the right include path, library path and link flags. The error message indicates that the linker is not finding the implementation of `scv_startup()`, so you have to find the location of libscv.a or libscv.so on your system, add the the appropriate `-L` and `-rpath` flags and then tell the linker to also link against it. Note, the order is important: first `-lscv` and then `-lsystemc`. Quote
ollie_lin Posted January 13, 2022 Author Report Posted January 13, 2022 Hi maehne, add the `-lscv` flag in Makefile that compile is pass after see your comment. thanks you for your reply. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.