Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: runtime error (assertion failed) in qsynth compiled with MSVC #39

Closed
pedrolcl opened this issue Apr 10, 2021 · 1 comment
Closed

Comments

@pedrolcl
Copy link
Contributor

When testing qsynth compiled with the MSVC++ compiler, pressing the "setup..." button throws this message box and dies:

qsynth_runtime_error_20210410

It is the same problem documented here: https://docs.microsoft.com/en-us/answers/questions/240332/assert-when-using-mtd-dynamic-library.html

The problem comes because qsynth and Qt are linked to the DLL C runtime (dynamic runtime, flag /MD) but fluidsynth is linked with the static C runtime library, flag /MT).

The solution is to compile everything using dynamic or static C runtime library, but not mixing both. The easiest fix is to modify fluidsynth CMake buildsystem to make use of the DLL C runtime, because rebuilding each Qt version with the static C runtime is very time consuming.

This is the relevant part of fluidsynth's CMakeList.txt

  if  ( MSVC )
    # statically link in the CRT library to avoid a bunch of runtime DLL dependencies and allow 
    # the CI windows builds to be run under WinXP
#    foreach ( flag_var
#        CMAKE_C_FLAGS
#        CMAKE_C_FLAGS_DEBUG
#        CMAKE_C_FLAGS_RELEASE
#        CMAKE_C_FLAGS_MINSIZEREL
#        CMAKE_C_FLAGS_RELWITHDEBINFO
#        CMAKE_CXX_FLAGS
#        CMAKE_CXX_FLAGS_DEBUG
#        CMAKE_CXX_FLAGS_RELEASE
#        CMAKE_CXX_FLAGS_MINSIZEREL
#        CMAKE_CXX_FLAGS_RELWITHDEBINFO
#        )
#      if ( ${flag_var} MATCHES "/MD" )
#        string ( REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}" )
#      endif ( ${flag_var} MATCHES "/MD" )
#    endforeach ( flag_var )

I will request to add a new configurable option to fluidsynth. Meanwhile, lets keep this ticket as a remainder.

@pedrolcl
Copy link
Contributor Author

After merging PR #40 and FluidSynth/fluidsynth/pull/848 this issue can be closed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant