Jump to content

Modifying systemc-2.3.0 kernel


Recommended Posts



I am working on Runtime Monitoring of SystemC models. One of my projects requires adding some callbacks to the systemc kernel.


In systemc-2.3.0/src/sysc/kernel:


I added 4 new files:




I also did some minimal modification(adding callbacks) to:






I did the required modification to : systemc-2.3.0/src/systemc.


There are hierarchical Makefiles: Makefile.in and Makefile.am in systemc-2.3.0


My question is: what is the clean way of doing this Makefile modifications? How many Makefiles do I need to modify manually?


I definitely need to change one of the Makefile.in and Makefile.am in src/sysc/kernel. My guess is that I can regenerate the other Makefiles(modified) using automake and aclocal. I need to know the right way to do it.


Finally, I want to release the modified systems-2.3.0 kernel that can be compiled and installed using the same steps described in systems-2.3.0/INSTALL.


Can anybody from the developer group advise me in this respect?




Link to comment
Share on other sites

Hi Sonali,

  I think the only file you should have to change is




Makefile.in should be re-generated by running the autoconf tools.


Unfortunately that's the limit of my knowledge :-(  I don't know exactly how the release is done,




Link to comment
Share on other sites

Dear Sir/Madam,

As Alan says, almost all the Makefiles are generated by the

autoconf tool. Manually editing is very error-prone, because

it is necessary to track each dependency in the hierarchy.

Please try a 'make unistall' followed by a 'make distcleam'

and then repeat the 'configure', 'make' and 'make install'

steps. That would correctly include all the dependencies

and indicate errors if there are any. Hope that helps.

Link to comment
Share on other sites

Thanks Alan!


Dear Developer,


Can you please specifically tell me the following ? :


1. Which Makefile do I need to modify manually?

2. What commands do I need to run to auto-generate the rest of the Makefiles?


gmake, gmake install are the final steps to compile and install the systemc package. But before that I need to generate the necessary Makefiles.


How do I do that?


As mentioned before I modified files in kernel and added 4 new files in kernel.


Please let me know the commands.




Link to comment
Share on other sites

Dear Developer,


Here is the solution.


For installation I modified:


1. /systemc-2.3.0/src/sysc/kernel/Makefile.am to add the new 4 files I have added to kernel (see above for detail)

2. /systemc-2.3.0/configure.in to add a new flag called -DDEBUG_PRINT_IN_SCHEDULER


Now I ran:


autoconf: This takes aclocal.m4 and configure.in as input and generates ./configure file as output.

automake: This takes configure.in and Makefile.am as input and generates Makefile.in as output.


Now I follow the steps in INSTALL file for the rest of the installation process.


I must mention here that systemc-2.3.0 package is not able to deal with any versions other than





If I use other higher versions I need to do aclocal again to regenerate aclocal.m4 and that's when gmake gives wierd errors.


 For example:

/bin/sh ../../../libtool --tag=CXX   --mode=compile g++ -DSC_INCLUDE_FX   -I. -I../../../../src/sysc/kernel -I../../../../src   -Wall -m64 -DSC_INCLUDE_FX -DDEBUG_PRINT_IN_SCHEDULER  -O3  -Wall -m64 -DSC_INCLUDE_FX -DDEBUG_PRINT_IN_SCHEDULER -O3 -MT sc_attribute.lo -MD -MP -MF .deps/sc_attribute.Tpo -c -o sc_attribute.lo ../../../../src/sysc/kernel/sc_attribute.cpp
mv -f .deps/sc_attribute.Tpo .deps/sc_attribute.Plo
mv: cannot stat `.deps/sc_attribute.Tpo': No such file or directory


I do not know if it is some issue with the packaging or something else. It will be good if anyone from the developer group sheds some light on it.


But using the above versions of automake and autoconf, the problem is solved!




Link to comment
Share on other sites

I remember having problems with versions of autotools when I was merging TLM2 into SystemC 2.3.0. There are some mentions of autotools 1.12 in the source code on git, so someone is aware that there are problems.


I have a feeling it may have something to do with the presence or not of pthreads on the build system, but I'm not sure.

If I can create the problem repeatedly, I'll report a bug,




Link to comment
Share on other sites

I'm not aware of a (real) bug in the autotools setup of SystemC 2.3.0.


If you want/need to regenerate the autotools files, the easiest solution is to run "autoreconf":

[pah@yab:~/scm/code/osci/systemc]$ autoreconf -v -i
autoreconf2.50: Entering directory `.'
autoreconf2.50: configure.in: not using Gettext
autoreconf2.50: running: aclocal -I config
autoreconf2.50: configure.in: tracing
autoreconf2.50: running: libtoolize --copy
autoreconf2.50: running: /usr/bin/autoconf
autoreconf2.50: configure.in: not using Autoheader
autoreconf2.50: running: automake --add-missing --copy --no-force
autoreconf2.50: Leaving directory `.'


Most importantly, note the call to "aclocal" above, which adds the "config" subdirectory (with the required ax_pthread.m4) to the search path.  This should solve your pthreads "issue" during the build.


Greetings from Oldenburg,

Link to comment
Share on other sites

Hi Philipp,


Thanks for the reply.


But autoreconf basically does nothing extra than running aclocal, automake and autoconf individually. But as you said, I tried to recreate the error. Here is what I did:


1. I deleted autoconf-1.10 from my system using make distclean

2. I installed autoconf-1.10.1

3. Now I took a fresh systemc-2.3.0(configure.in and /src/sysc/kernel/Makefile.am modified)

4. I ran autoreconf -v -i


Here is the output:


[root@localhost test]# autoreconf -v -i
autoreconf: Entering directory `.'
autoreconf: configure.in: not using Gettext
autoreconf: running: aclocal -I config
autoreconf: configure.in: tracing
autoreconf: running: libtoolize --copy
autoreconf: running: /usr/local/bin/autoconf
autoreconf: configure.in: not using Autoheader
autoreconf: running: automake --add-missing --copy --no-force
autoreconf: Leaving directory `.'


5. mkdir objdir


6. cd objdir


7. gmake


[root@localhost objdir]# gmake
Making all in src
gmake[1]: Entering directory `/root/Desktop/CHIMP_ea/test/objdir/src'
Making all in sysc
gmake[2]: Entering directory `/root/Desktop/CHIMP_ea/test/objdir/src/sysc'
Making all in kernel
gmake[3]: Entering directory `/root/Desktop/CHIMP_ea/test/objdir/src/sysc/kernel'
/bin/sh ../../../libtool --tag=CXX   --mode=compile g++ -DSC_INCLUDE_FX   -I. -I../../../../src/sysc/kernel -I../../../../src   -Wall -m64 -DSC_INCLUDE_FX -DDEBUG_PRINT_IN_SCHEDULER  -O3 -pthread -Wall -m64 -DSC_INCLUDE_FX -DDEBUG_PRINT_IN_SCHEDULER -O3 -MT sc_attribute.lo -MD -MP -MF .deps/sc_attribute.Tpo -c -o sc_attribute.lo ../../../../src/sysc/kernel/sc_attribute.cpp
../../../libtool: line 2089: ../../../../src/sysc/kernel/sc_attribute.cpp: Permission denied
libtool: compile:  g++ -DSC_INCLUDE_FX -I. -I../../../../src/sysc/kernel -I../../../../src -Wall -m64 -DSC_INCLUDE_FX -DDEBUG_PRINT_IN_SCHEDULER -O3 -pthread -Wall -m64 -DSC_INCLUDE_FX -DDEBUG_PRINT_IN_SCHEDULER -O3 -MT sc_attribute.lo -MD -MP -MF .deps/sc_attribute.Tpo -c ""  -fPIC -DPIC -o .libs/sc_attribute.o

g++: : No such file or directory
g++: no input files
gmake[3]: *** [sc_attribute.lo] Error 1
gmake[3]: Leaving directory `/root/Desktop/CHIMP_ea/test/objdir/src/sysc/kernel'
gmake[2]: *** [all-recursive] Error 1
gmake[2]: Leaving directory `/root/Desktop/CHIMP_ea/test/objdir/src/sysc'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/root/Desktop/CHIMP_ea/test/objdir/src'
gmake: *** [all-recursive] Error 1


I see no reason why g++ cannot read sc_attribute.cpp. I hope this helps.




Link to comment
Share on other sites



But autoreconf basically does nothing extra than running aclocal, automake and autoconf individually.


Yes, but with the correct parameters, based on configure.in (here the path to the config/ directory for aclocal).


5. mkdir objdir
6. cd objdir
7. gmake


You need to run configure before running make.  But you probably did, otherwise there would have been no Makefile in your new objdir. ;-)


../../../libtool: line 2089: ../../../../src/sysc/kernel/sc_attribute.cpp: Permission denied


I see no reason why g++ cannot read sc_attribute.cpp. I hope this helps.


To me, it looks like your libtool script is broken.  Please check the line 2089 of your libtool script.  Maybe there is some variable not or incorrectly set.  One explanation would have been the "wrong" call to aclocal in an earlier run.


Hope that helps,


Link to comment
Share on other sites

Hi Philipp,


Yes. I ran ../configure before gmake. :)


Probably you are right! But I will move on since everything is working now. Thanks for your help.


I appreciate that you pointed out about the parameters of aclocal specifically -I config. Something I got to learn! So dealing with these nasty errors sometimes gives you valuable knowledge. Not that bad!




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