-1

I've developed a perl script to run UVM-SystemC example codes.

#!/usr/bin/perl

use warnings;
use strict;

sub main();


my $CLIBS = "\$SYSTEMC_HOME/lib-linux64";
my $UVMCLIBS = "\$UVMSYSTEMC_HOME/lib-linux64";

my $CINC = "\$SYSTEMC_HOME/include";
my $UVMCINC = "\$UVMSYSTEMC_HOME/include";

main();



sub main(){

    eval{
        $ARGV[0];
    }or do{
        print("\n\tRun the script with SystemC <filename> as argument\n\n");
        exit 1;
    };

    system "g++ -I$CINC -I$UVMCINC -L$CLIBS -lsystemc -L$UVMCLIBS -luvm-systemc $ARGV[0] -Wl,-rpath,$CLIBS -Wl,-rpath,$UVMCLIBS";

    #system "./sim";

}

Here, $ variables point to respective paths of SystemC and UVM-SystemC installation. And script expects *.cpp file as argument to $ARGV[0] Both libraries example commands running properly by make check but the script is giving error. Detailed error log error.log

MayurKubavat
  • 341
  • 4
  • 10

2 Answers2

0

Is it possible that the SystemC and UVM libraries were compiled with an older version of g++ than used by your script? I suspect that due to these errors:

undefined reference to `uvm::uvm_report_warning(std::__cxx11::basic_string<char, std::char_traits<char>**, ...etc..
undefined reference to `uvm::uvm_typeid_base::type_name[abi:cxx11]'

It looks like the libraries may have been compiled with gcc 4.x, then your script is executing gcc 5.x, which uses a new ABI:

https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html

Check what version you have for the g++ in your path: g++ --version

Mr Bone
  • 126
  • 5
  • Output of g++ --version is g++ (Ubuntu 5.4.0-6ubuntu1~16.04.1) 5.4.0 20160609. In uvm-systemc library config logs same g++ version is used. – MayurKubavat Jul 23 '16 at 02:27
  • What about SystemC library? Is it compiled with same? If any library needed by your executable has been compiled with gcc 4.x, there can be ABI incompatibilities. You could try re-compiling executable and uvm-systemc lib with old ABI: Add -D_GLIBCXX_USE_CXX11_ABI=0 to CXXFLAGS or g++ command-line. – Mr Bone Jul 25 '16 at 16:47
  • It still gives same error. And 'make check' in uvm-systemc/objdir is working fine and simulates all the examples. Only thing is I am not able to run it with the script. – MayurKubavat Aug 10 '16 at 16:21
0

It error looks like the include files are missing. its mostly because the system command in the script has not passed the right variables. The perl script is using $SYSTEMC_HOME which guessing is a env variable but is not using the $ENV to read it. use $ENV{'SYSTEMC_HOME'} to get the value set in the env variable of the shell.

my $CLIBS = "$ENV{'SYSTEMC_HOME'}/lib-linux64";

links to how to access system variables in perl. http://alvinalexander.com/perl/edu/articles/pl020002

Also print the system line to confirm the settings.

   print "g++ -I$CINC -I$UVMCINC -L$CLIBS -lsystemc -L$UVMCLIBS -luvm-systemc $ARGV[0] -Wl,-rpath,$CLIBS -Wl,-rpath,$UVMCLIBS";
Rahul Menon
  • 792
  • 7
  • 12
  • Hi Rahul, I dont think thats a problem. To confirm I've tried your suggestion. I'm still getting the same error. Print is showing appropriate path. – MayurKubavat Jul 23 '16 at 12:54