Jump to content

Compiling Systemc-AMS (POC) gives error.


Recommended Posts

Hi, installing the SystemC-AMS Poc on a new machine with ubuntu-18.04 LTS.  All other programs install without issues. SystemC also nicely installing and working.

When I try to compile the SystemC-AMS now it gives me error:

=========================================================================================================

make[6]: Entering directory '/home/elvis/mProgram/systemc-ams-2.1/src/scams/impl/predefined_moc/tdf'
  CXX      sca_ct_delay_buffer.lo
  CXX      sca_delay_buffer_base.lo
  CXX      sca_tdf_ct_ltf_nd_proxy.lo
sca_tdf_ct_ltf_nd_proxy.cpp: In member function 'void sca_tdf::sca_implementation::sca_ct_ltf_nd_proxy::setup_equation_system()':
sca_tdf_ct_ltf_nd_proxy.cpp:292:2: error: 'memset' was not declared in this scope
  memset((void*) (num2_ltf), 0, new_memsize * sizeof(double)); //set all to zero
  ^~~~~~
sca_tdf_ct_ltf_nd_proxy.cpp:292:2: note: suggested alternative: 'wmemset'
  memset((void*) (num2_ltf), 0, new_memsize * sizeof(double)); //set all to zero
  ^~~~~~
  wmemset
sca_tdf_ct_ltf_nd_proxy.cpp:316:3: error: 'memcpy' was not declared in this scope
   memcpy((void*) num2_ltf, (void*) num_ltf, num_size * sizeof(double));
   ^~~~~~
sca_tdf_ct_ltf_nd_proxy.cpp:316:3: note: suggested alternative: 'wmemcpy'
   memcpy((void*) num2_ltf, (void*) num_ltf, num_size * sizeof(double));
   ^~~~~~
   wmemcpy
Makefile:491: recipe for target 'sca_tdf_ct_ltf_nd_proxy.lo' failed
make[6]: *** [sca_tdf_ct_ltf_nd_proxy.lo] Error 1

=========================================================================================================

I get from other colleagues who try (also in other distributions having issues on the -AMS installation part (never on the SC part).  Maybe the SC-AMS folks need to do some more testing over several environments.

Does anyone have an understanding on my error?  what can i do to fixed it?   I have followed the guidelines (as in the other machines/distribution I used it)

Link to comment
Share on other sites

The compilation issue, which you describe is not a platform-dependent issue. I guess that you are compiling the SystemC AMS 2.1 PoC against the later released SystemC 2.3.2 PoC implementation. The latter contains many bug fixes and clean-ups, one of which is according to the RELEASENOTES:

Quote

  - The implicit inclusions of the system-headers "cstring" and "sstream"
    have been removed.  See INSTALL.
 

The memset() and memcpy() are defined in the header <cstring>. This means that the issue can be easily fixed by adding "#include <cstring>" in line 41 of systemc-ams-2.1/src/scams/impl/predefined_moc/tdf/sca_tdf_ct_ltf_nd_proxy.cpp:

#include "scams/impl/predefined_moc/tdf/sca_tdf_ct_ltf_nd_proxy.h"
#include "scams/impl/core/sca_simcontext.h"
#include "scams/impl/solver/util/sparse_library/linear_analog_solver.h"
#include <cstring>  // needed for memcpy() and memset()

namespace sca_tdf
{
namespace sca_implementation
{

If you still have compilation errors, add the std:: namespace prefix to the calls of memset() and memcpy().

This issue will go away once COSEDA releases a new version of the SystemC AMS PoC, which does not rely anymore on the implicit inclusion of <cstring>, i.e., has been tested agains SystemC 2.3.2.

Link to comment
Share on other sites

Ok, that solves the problem of compiling the sources.

It is interesting that the same PoC would compile in one machine (RH6) and not compile (compile after the suggestions) in an ubuntu.  The only thing which is different is the version of the g++ compiler which in RH6 is older.  Are there other things to take into consideration?

In addition, at the moment I am running an example which is working in RH6 but is not working on the newer Ubuntu (Simple low-pass filter).

Link to comment
Share on other sites

Newer compiler versions usually are accompanied by a newer implementation of the standard library. This newer version might have been optimised to reduce side-effects when including a standard header, i.e., to only include definitions that are mandated by the standard and to reduce as much as possible the inclusion of other headers, which are only needed for the implementation of its functions. Another thing, which might affect you is that newer compilers might use a newer C++ standard by default, e.g., C++'14 or C++'11. SystemC 2.3.2 already contains functions, which make use of C++'11/14 features. If this is not the default C++ version for your compiler, you must make sure that SystemC AMS and your models get compiled with the same compiler flags, i.e., also against the same C++ version.

Regarding your simple SystemC AMS example: You will have to provide more information, i.e., a minimum self-contained code example plus the compiler messages so that we may help you.

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.

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