Jump to content

Mingw Compile Issue

Recommended Posts

Im setting up SystemC with qmake:

TARGET = systemc

CONFIG += staticlib
CONFIG -= qt

QMAKE_CXXFLAGS = -Wall -O3 #-std=c++11


SOURCES += $$files(src/sysc/communication/*.cpp, true)
SOURCES += $$files(src/sysc/datatypes/bit/*.cpp, true)
SOURCES += $$files(src/sysc/datatypes/fx/*.cpp, true)
SOURCES += $$files(src/sysc/datatypes/int/*.cpp, true)
SOURCES += $$files(src/sysc/datatypes/misc/*.cpp, true)
SOURCES += $$files(src/sysc/kernel/*.cpp, true)
SOURCES += $$files(src/sysc/tracing/*.cpp, true)
SOURCES += $$files(src/sysc/utils/*.cpp, true)

HEADERS += $$files(src/sysc/communication/*.h, true)
HEADERS += $$files(src/sysc/datatypes/bit/*.h, true)
HEADERS += $$files(src/sysc/datatypes/fx/*.h, true)
HEADERS += $$files(src/sysc/datatypes/int/*.h, true)
HEADERS += $$files(src/sysc/datatypes/misc/*.h, true)
HEADERS += $$files(src/sysc/kernel/*.h, true)
HEADERS += $$files(src/sysc/packages/boost/*.hpp, true)
HEADERS += $$files(src/sysc/packages/boost/bind/*.hpp, true)
HEADERS += $$files(src/sysc/packages/boost/config/*.hpp, true)
HEADERS += $$files(src/sysc/packages/boost/config/compiler/*.hpp, true)
HEADERS += $$files(src/sysc/packages/boost/config/platform/*.hpp, true)
HEADERS += $$files(src/sysc/packages/boost/config/stdlib/*.hpp, true)
HEADERS += $$files(src/sysc/packages/boost/detail/*.hpp, true)
HEADERS += $$files(src/sysc/packages/boost/mpl/*.hpp, true)
HEADERS += $$files(src/sysc/packages/boost/mpl/aux_/*.hpp, true)
HEADERS += $$files(src/sysc/packages/boost/mpl/aux_/config/*.hpp, true)
HEADERS += $$files(src/sysc/packages/boost/utility/*.hpp, true)
HEADERS += $$files(src/sysc/tracing/*.h, true)
HEADERS += $$files(src/sysc/utils/*.h, true)
HEADERS += $$files(src/sysc/qt/qt.h, true)

SOURCES += $$files(src/sysc/qt/qt.c, true)

!contains(QMAKE_TARGET.arch, x86_64) {
    message("x86 build")
    SOURCES += $$files(src/sysc/qt/md/i386.s, true)
} else {
    message("x86_64 build")
    SOURCES += $$files(src/sysc/qt/md/iX86_64.s, true)

Under Windows I have this compilation issue when I use Mingw as compiler:

..\systemc-2.3.2-qmake\src\sysc\kernel\sc_ver.cpp:166:1: error: specialization of 'sc_core::sc_api_version_2_3_2_cxx201103L<DisableVirtualBind>::sc_api_version_2_3_2_cxx201103L(sc_core::sc_writer_policy) [with const int* DisableVirtualBind = (& sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_)]' after instantiation



Has somebody an idea whats going on here?


I assume that it has something to do with the order of the building?

Link to post
Share on other sites

Hello @Matthias Jung,

It seems you are missing some of the compiler definition flags for the build:

-DSC_BUILD ... etc.

You can get the set of compiler flags for the SystemC library from the CMake generator(Only works with Makefile generator).

# Using CMake to create compile_commands.json
# SYSTEMC_SRC: SystemC source directory.
# Create a build directory
mkdir build
cd build

# Run CMake configuration for Make file generator.

Note: Also the quick thread library for user space thread support will not work on Windows since it is compatible only on Linux systems.


Ameya Vikram Singh

Link to post
Share on other sites

Hi @Matthias Jung,

You should use cmake generator provided from MinGW package manager.

In-case you are using the version from CMake official release then you would need to add the MinGW utilities to the system PATH environment variable.



# Check if you have make available on the cmd.exe
make --version

# Check if gcc/g++ is available on the cmd.exe
gcc --version
g++ --version

# Configure CMake to use the make file generator on the configuer step in SystemC build directory.

# or in-case the previous one doesn't work.

Note: To find the list of supported generator from CMake you can use this command:

cmake -G --help

Update: Here is the official documentation on the CMake Makefile Generator: https://cmake.org/cmake/help/latest/generator/MinGW Makefiles.html#generator:MinGW Makefiles


Ameya Vikram Singh

Edited by AmeyaVS
Added link for the official documentation for CMake
Link to post
Share on other sites

So I can build sucessfully SystemC with QtCreator under Windows with MinGW that is provided with QtCreator using CMake. So it should now be pretty save that the SystemC compiling process is correct.

However, when I use the SystemC Library withing one of my projects, I have again this error:

C:/<...>/Qt/Tools/mingw530_32/bin/mingw32-make -f Makefile.Release

mingw32-make[1]: Entering directory 'C:/<...>/Programming/SCVP.artifacts/build-tlm_at_1-Desktop_Qt_5_10_0_MinGW_32bit-Release'

g++ -Wl,-s -Wl,-subsystem,console -mthreads -o release\tlm_at_1.exe release/main.o release/memory_manager.o -LC:\Users\jung\Programming\systemc-2.3.2\build-systemc-2.3.2-Desktop_Qt_5_10_0_MinGW_32bit-Default\src -lsystemc

C:\<...>\main.cpp:-1: error: undefined reference to `sc_core::sc_api_version_2_3_2_cxx201103L<&sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_2_cxx201103L(sc_core::sc_writer_policy)'

This are the Flags used by CMake 

  "directory": "C:/<...>/Programming/systemc-2.3.2/build-systemc-2.3.2-Desktop_Qt_5_10_0_MinGW_32bit-Default/src",
  "command": "C:\\<...>\\Qt\\Tools\\mingw530_32\\bin\\g++.exe  -DSC_BUILD -DSC_ENABLE_ASSERTIONS -DSC_ENABLE_EARLY_MAXTIME_CREATION -DSC_ENABLE_SIMULATION_PHASE_CALLBACKS_TRACING -DSC_INCLUDE_FX -DWIN32 @CMakeFiles/systemc.dir/includes_CXX.rsp -O3 -DNDEBUG   -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -std=gnu++98 -o CMakeFiles\\systemc.dir\\sysc\\communication\\sc_clock.cpp.obj -c C:\\<...>\\Programming\\systemc-2.3.2\\systemc-2.3.2\\src\\sysc\\communication\\sc_clock.cpp",
  "file": "C:/<...>/Programming/systemc-2.3.2/systemc-2.3.2/src/sysc/communication/sc_clock.cpp"

Here is the qmake project example:

TARGET = tlm_at_1

CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

INCLUDEPATH += C:\<...>\Programming\systemc-2.3.2\systemc-2.3.2\src
LIBS += -LC:\<...>\Programming\systemc-2.3.2\build-systemc-2.3.2-Desktop_Qt_5_10_0_MinGW_32bit-Default\src -lsystemc

HEADERS += ../tlm_memory_manager/memory_manager.h
HEADERS += initiator.h
HEADERS += target.h
HEADERS += util.h

SOURCES += main.cpp
SOURCES += ../tlm_memory_manager/memory_manager.cpp

It seams that Systemc was build with -std=gnu++98 also adding this flag to the qt-project does not help to solve the issue.

Link to post
Share on other sites
C:\<...>\main.cpp:-1: error: undefined reference to `sc_core::sc_api_version_2_3_2_cxx201103L<&sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_2_cxx201103L(sc_core::sc_writer_policy)'

This error suggests that you are building your application with cxx201103L = C++11.  But SystemC library was build with C++98.

So you either have to rebuild SystemC library with C++11, or use C++98 for your application.

Here is an example how to build SystemC and Applications using CMake (with option to enable C++11):


If you are using CMake, you can configure your application to use same C++ standard you were using for library build automatically:

find_package(SystemCLanguage CONFIG REQUIRED)

Btw, g++ 5.3 you are using supports C++14, so you can use it instead of C++11. Just pass -DCMAKE_CXX_STANDARD=14 when generating Makefile using CMake.


Link to post
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...