systemc
systemc copied to clipboard
Linking SystemC on Windows with MinGW produces Error with QuickThreads
C:\Users\...\systemc\src\sysc\packages\qt\md\iX86_64.s: Assembler messages:
C:\Users\...\systemc\src\sysc\packages\qt\md\iX86_64.s:77: Error: junk at end of line, first unrecognized character is `-'
mingw32-make.exe[2]: *** [...\systemc\src\CMakeFiles\systemc.dir\build.make:1266: .../systemc/src/CMakeFiles/systemc.dir/sysc/packages/qt/md/iX86_64.s.obj] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:1006: .../systemc/src/CMakeFiles/systemc.dir/all] Error 2
mingw32-make.exe: *** [Makefile:129: all] Error 2
SystemC was build with CMAKE in the context of a CMAKE project. Under Linux and macOS its works, but on windows I get this assembler error shown above. It can be fixed by using pthreads but I think qt are much better.
Any ideas to fix it?
One of my workaround would be to switch to pthreads/fibers. However this code in the CMAKE file prevents me of doing that:
if (WIN32 AND ENABLE_PTHREADS)
message (FATAL_ERROR "Pthreads is not supported on ${CMAKE_SYSTEM}.")
endif (WIN32 AND ENABLE_PTHREADS)
Commenting out the last 3 lines in the .s file helps:
//#if defined(__linux__) && defined(__ELF__)
//.section .note.GNU-stack,"",%progbits
//#endif
I assume that MinGW is still detected as linux
Thanks for reporting this issue and analysing the cause! We are going to look at the issue in the LWG. Could you please try to make the preprocessor condition more strict by adding !defined(__MINGW32__)
(see here and here) and report back whether this fixes the issue? If not, please provide more information on your platform (versions of Windows and MinGW, etc.).
User @moayman posted on 2020-07-15 on the SystemC forum about his effort to fix QuickThreads on Win64. He has created a branch containing the current state of his fixes, which is based on SystemC 2.3.2.
In my CMake build, I was able to fix the issue by overriding some properties before loading the SystemC library:
if (MINGW)
set(MSVC true) # SystemC tries to assemble quick threads if this isn't added
endif(MINGW)
Hello @myzinsky and @mattgately ,
What environment are you using for MinGW
setup?
I faced a similar issue recently and figured out that the issue was with my CMake setup.
I am using MSYS2
for managing my MinGW 64-bit
environment.
As it seems the environment is split between MSYS2, MinGW 64-bit, MinGW 32-bit
.
For MSYS2
and MinGW
it has separate binaries for CMake which handles the SystemC project quite differently.
For reference: cmake packages in MSYS2
In case you are using MSYS2 to manage the setup it is quite easy to fix the issue:
pacman -S mingw64/mingw-w64-x86_64-cmake
Which resolved most of the build issues in the MinGW
environment.
Note:
- Regarding the
MinGW
cmake build one has to specify the CMake generator as "Unix Makefiles" by default it tries to configure forNMake
/MSBuild
project. - I have not tried with native windows
CMake
Binary forMinGW/MSYS2
environment.
Hope this helps.