Jump to content

C++ compiler version again


katang

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

  • 3 weeks later...

I use SystemC compiled with C++17 using GCC and Clang on Intel and Arm architectures without any issues (Ubuntu, macOS, and WSL2 Ubuntu). Better features and better performance. I also regularly use cmake (less hassle).

The key is that SystemC requires you to use the same compiler version for your SystemC code as was built with the library. There are some switches to fall back, but I don't see why you would do that. C++17 has so many nice features.

Link to comment
Share on other sites

  • 1 month later...
On 11/19/2022 at 10:30 AM, Eyck said:

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.

I tried and your template worked fine for me. My first step to extend it was to add another package, Qt. I guessed that such a package is surely supported by conan. Yes, the site said:

https://wiki.qt.io/Using_Conan_for_Qt6#Connecting_to_Conan_remote

detailed the instruction to install Qt. Although, I should have noticed the warning, red, on the top: IMPORTANT: The content of this page is outdated. Reason: The Conan package manager pilot has ended. 

I guessed, it runs without support. As I failed, I asked the help line

and I received the reply https://forum.qt.io/topic/142389/conan-access-to-qt

 

Hi @katang, and welcome!

Conan support has been discontinued, unfortunately: https://www.qt.io/blog/conan-package-manager-pilot-to-end-in-december

 

 

That is about my attempt on using a "package manager like conan". It looks like conan keeps Qt on its list of supported packages, but does not recognize that that package does not support its manager. 😜  It looks like I should have my attempt a couple of weeks earlier. Than I fail only when I added all my tools and packages, and can start the development again. I prefer stable tools and packages.

Is there a hint how to organize  the cooperation between conan and non-conan packages? (preferably in form of .cmake fragments)

Link to comment
Share on other sites

First: to get a list of suported packages you shoudl check https://conan.io/center/. And according to the list of supported packages there is a QT package 'qt/6.4.2'. Although I'm not a user of Qt I would expect that the package builds since conan center provides plenty of prebuilt binary versions: https://conan.io/center/qt?os=&tab=configuration

Aside of that: the use of conan does not restrict seomone from using any other way to get libraries into your project; let it be system libraries, custom installation, cmakes FetchContent, or cpm-cmake.

What the QT folks did was to develop a

Quote

Conan-based package manager

but not a conan package.

Link to comment
Share on other sites

  • 2 weeks later...

What you say, was valid till the end of last December. Recently, I can log in to Qt, but conan cannot. 

Finally, I did make a hybrid (so I could save much headaches).

Concerning Qt folks: without a package, I cannot do anything with a package manager. I just wanted to use it.

Thanks for replying.

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