Jump to content

How to compile SCV

Recommended Posts

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



#include <scv.h>

using namespace std;

int sc_main(int argc, char* argv[])
    cout << "Hello world, SCV library." << endl;

    return 0;



TARGET = out

IDIR = .
SDIR = .
ODIR = .

SRC = $(wildcard $(SDIR)/*.cpp)
OBJ = $(SRC:$(SDIR)/%.c=$(ODIR)/%.o)

CXX = g++
CXXFLAGS += -g -O0
CXXFLAGS += -Iinclude
CFLAGS += -Wall
SCPATH = /usr/local/systemc
LIBS = -lm

    $(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 $@

    $(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



Link to comment
Share on other sites

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`.

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...