Jump to content

C++ compiler version again


katang
 Share

Recommended Posts

Hi,

I receive the error

in function `__static_initialization_and_destruction_0(int, int)':
CLI.cpp:(.text+0x64e): undefined reference to `sc_core::sc_api_version_2_3_3_cxx201703L<&sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_3_cxx201703L(sc_core::sc_writer_policy)'

when building my app (I upgraded to Ubuntu 22.04 and I noticed that SystemC was also upgraded)

I found that from another discussion threads that the probable reason is a version mismatch between compiling SystemC and my application. (and as I saw (guess), there is some kind of inconsistency with the version handling)

I did set manually and statically compiler version to 14, and also attempted to provide the compiler location as a CMake -D flag, but the error persists.

How can I diagnose the issue (and more importantly, to fix it?

I also have difficulties with finding out SystemC_CXX_STANDARD; the include and library names are delivered correctly. What extra setting do I need?

Link to comment
Share on other sites

Actually you built your design using C++ 17 as the missing version string indicates. I assume that SystemC has been build with C++ 14 or lower.

In my experience this is a common problem esp. if you use pre-compiled versions of systemc. My suggestion would be to use a package manager like conan. They ensure that the different parts of the design are built consistently. You might want to have a look at https://github.com/Minres/SystemC-Quickstart. This is basically a project template. The only thing to be done before is

pip3 install --user conan 

and your are ready to go. And you need to make sure that SYSTEMC_HOME is not set.

Link to comment
Share on other sites

Thanks for the reply. Still, I do not know why my design uses using C++ 17, despite my mentioned efforts.

If so, can I compile SystemC with using C++ 17?

Concerning 'conan': I attempted to use it earlier (and it works fine with the template), but it did not work with all my tools and packages.

Especially, I have troubles with Python installers.

 

Link to comment
Share on other sites

13 hours ago, katang said:

Thanks for the reply. Still, I do not know why my design uses using C++ 17, despite my mentioned efforts.

If you doi not specify explicitly the compiler uses the default language level which is for gcc 11 c++17.

13 hours ago, katang said:

If so, can I compile SystemC with using C++ 17?

AFAIk yes

13 hours ago, katang said:

Concerning 'conan': I attempted to use it earlier (and it works fine with the template), but it did not work with all my tools and packages.

Especially, I have troubles with Python installers.

Maybe you should use venv coming with Python3 (https://docs.python.org/3.6/library/venv.html)

Link to comment
Share on other sites

If you doi not specify explicitly the compiler uses the default language level which is for gcc 11 c++17.

Ok, but how can I explicitly specify the compiler (the methods I attempted do not work. No error message, but no effect.

If so, can I compile SystemC with using C++ 17?

AFAIk yes

May I suggest then to list in the build file?

Maybe you should use venv coming with Python3 (https://docs.python.org/3.6/library/venv.html)

I have the experience that Python's many versions used by different packages destroy my install chains, drivers, dependencies.

 

 

 

 

Link to comment
Share on other sites

On 11/23/2022 at 10:57 AM, katang said:

Ok, but how can I explicitly specify the compiler (the methods I attempted do not work. No error message, but no effect.

It depends on your build system, e.g. CMake has a specail configuratrion setting. Basically it boils down to provide `-std=c++11`to g++ (see also https://stackoverflow.com/questions/16886591/how-do-i-enable-c11-in-gcc).

 

On 11/23/2022 at 10:57 AM, katang said:

May I suggest then to list in the build file?

Officially it is not tested hence not supported. Therefore it is not listed and will not with the currrent released version.

 

On 11/23/2022 at 10:57 AM, katang said:

I have the experience that Python's many versions used by different packages destroy my install chains, drivers, dependencies.

Actually the use of venv saves you from all the hassle as it creates a clean, local, and reproducable python setup based on the (already installed) python version. I strongly suggest to check into this direction, it will save you some headaches...

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.

 Share

×
×
  • Create New...