Jump to content

Running "Hello SystemC": assertion `m_references_n != 0' failed


Recommended Posts


I am running a slightly modified (for successful compilation) example from the book "SystemC: from ground up, 2nd edition" on my Ubuntu 20.04 with g++-4.8.

SystemC version is 2.3.1.

Here is the source code:

#include <systemc>


    void main_thread(void)
        SC_REPORT_INFO("main", "Hello!");

int sc_main(int sc_argc, char* sc_argv[])
    Hello_SystemC HelloWorld_i("HelloWorld_i");
    sc_start(1, sc_core::sc_time_unit::SC_NS);

    return 0;

Upon execution and after Accellera copyright message I get the following error:

hello: /home/stud4k/fromsrc/systemc/include/sysc/kernel/sc_process.h:616: void sc_core::sc_process_b::reference_increment(): Assertion `m_references_n != 0' failed.

Is something missing or should something be rewritten in the example?

Thanks in advance.

Link to comment
Share on other sites

Code itself looks fine. I ran the above on EDAplayground without problem.

I also ran on MacOS 10.15.7 (Catalina) with Apple clang++ 12.0 (LLVM )

Here is a link to where I ran it: https://edaplayground.com/x/V25h

SystemC 2.3.3-Accellera --- Sep 21 2020 10:55:34
g++ 7.5
Using C++ standard 201402
Ubuntu 18.04

You might consider upgrading g++ (4.8 is pretty old). I use g++ 9.3 normally.

Link to comment
Share on other sites

Thanks for the quick response, David.

Indeed, I have just tried rebuilding the systemc libs and the example with gcc 7.5 and it worked!

Actually, when I chose 4.8 for the compiler version I was only following the README info for the 2.3.1 release where it states "GNU C++ compiler versions gcc-3.4.6 through gcc-4.9.0" as "well tested" configurations for GCC.

But if systemc can as well be used with newer GCCs, I will stick to those of course.

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