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

MSVC fixes #4000

Merged
merged 17 commits into from
Nov 24, 2017
Merged

MSVC fixes #4000

merged 17 commits into from
Nov 24, 2017

Conversation

lukas-w
Copy link
Member

@lukas-w lukas-w commented Nov 22, 2017

Some fixes for MSVC support. In progress, things left to do:

  • Fix Linux/macOS build
  • Resolve merge conficts

This changes the minimum CMake version to 3.1.

Summary of the changes that were required to build with MSVC:

  • CMake:
    • A lot of compiler flags that are not understood by MSVC
    • If MSVC is detected, disable plugins that are not yet supported
  • Variable-Length-Arrays are not supported by MSVC because it's not C99-compliant. Replaced by QVarLengthArray
  • Some EXPORT problems
  • Some GCC- or POSIX-specific code:
  • One occurence of inline assembly. MSVC doesn't support the standard asm syntax, it has __asm instead, which in turn doesn't work with x64. Replaced asm("pause") by the _mm_pause() intrinsic

Addresses #3999.

Fixes MSVC warnings "unknown option -std=c++11"
* CMake
  * Compiler flags fixes
  * Don't strip
* Fix default template argument errors
* Fix VLAs. MSVC doesn't support C99, so Variable-Length-Arrays are not
  available. Use QVarLengthArray instead.
The "d" suffix used in debug builds breaks plugin loading because LMMS
expects to find a descriptor named e.g. "kickerd_plugin_descriptor" instead
of "kicker_plugin_descriptor" when discovering a plugin with the filename
"kickerd.dll".
Make AboutDialog support MSVC compiler info so we can use a screenshot of
it to brag with on #devtalk
# Conflicts:
#	plugins/LadspaEffect/CMakeLists.txt
#	plugins/Xpressive/Xpressive.cpp
#	plugins/opl2/CMakeLists.txt
#	plugins/papu/CMakeLists.txt
#	plugins/xpressive/CMakeLists.txt
#	src/CMakeLists.txt
@Umcaruje
Copy link
Member

What a nice addition to be out 4000th issue/pull request 🎉

@lukas-w lukas-w mentioned this pull request Nov 23, 2017
@lukas-w
Copy link
Member Author

lukas-w commented Nov 23, 2017

Some change introduced on master causes an assertion to fail on Windows now whenever I play a note:

ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread 5c86fd0. Receiver '' (of type 'TrackContentObject') was created in thread 37b220", file kernel\qcoreapplication.cpp, line 541
QObject::~QObject: Timers cannot be stopped from another thread

Edit: Appears to only occur when previeweing a note (such as in preset view or piano roll). Opening a demo project and playing works fine.

Backtrace, though I'm not sure it's really related:

1   QBitArray::size                                 Qt5Cored                  0x5bfca78b  
2   QBitArray::size                                 Qt5Cored                  0x5bfc8fb2  
3   QBitArray::size                                 Qt5Cored                  0x5bfbc6e1  
4   QBitArray::size                                 Qt5Cored                  0x5c39e9be  
5   QGestureEvent::~QGestureEvent                   Qt5Widgetsd               0x57051974  
6   QBitArray::size                                 Qt5Cored                  0x5c39cd16  
7   QBitArray::size                                 Qt5Cored                  0x5c3a7ca2  
8   QBitArray::size                                 Qt5Cored                  0x5c3fad40  
9   QBitArray::size                                 Qt5Cored                  0x5c3f4d4a  
10  Model::~Model                                   Model.h               48  0x13f164e6a 
11  AutomatableModel::~AutomatableModel             AutomatableModel.cpp  84  0x13f17956b 
12  BoolModel::~BoolModel                           lmms                      0x13f1cf6b8 
13  TrackContentObject::~TrackContentObject         Track.cpp             130 0x13f26017f 
14  AutomationPattern::~AutomationPattern           AutomationPattern.cpp 106 0x13f181ee6 
15  AutomationPattern::`vector deleting destructor' lmms                      0x13f189f58 
16  InlineAutomation::~InlineAutomation             InlineAutomation.h    46  0x13f21d2d7 
17  DetuningHelper::~DetuningHelper                 DetuningHelper.h      44  0x13f21d21a 
18  DetuningHelper::`scalar deleting destructor'    lmms                      0x13f21d57c 
19  sharedObject::unref<DetuningHelper>             shared_object.h       64  0x13f21cf62 
20  Note::~Note                                     Note.cpp              89  0x13f21ba30 
... <More>                                                                                

Crash occurs upon release of the note.

@lukas-w
Copy link
Member Author

lukas-w commented Nov 23, 2017

After recompiling about 5 times, I suddenly get a proper backtrace:

1   qt_message_fatal                                qlogging.cpp          1681 0x6669a78b  
2   QMessageLogger::fatal                           qlogging.cpp          795  0x66698fb2  
3   qt_assert_x                                     qglobal.cpp           3078 0x6668c6e1  
4   QCoreApplicationPrivate::checkReceiverThread    qcoreapplication.cpp  533  0x66a6e9be  
5   QApplication::notify                            qapplication.cpp      2970 0x558d1974  
6   QCoreApplication::notifyInternal2               qcoreapplication.cpp  988  0x66a6cd16  
7   QCoreApplication::sendEvent                     qcoreapplication.h    231  0x66a77ca2  
8   QObjectPrivate::setParent_helper                qobject.cpp           1996 0x66acad40  
9   QObject::~QObject                               qobject.cpp           1048 0x66ac4d4a  
10  Model::~Model                                   Model.cpp             30   0x1400bc03a 
11  AutomatableModel::~AutomatableModel             AutomatableModel.cpp  84   0x14001a91b 
12  BoolModel::~BoolModel                           lmms                       0x140005338 
13  TrackContentObject::~TrackContentObject         Track.cpp             130  0x140100ddf 
14  AutomationPattern::~AutomationPattern           AutomationPattern.cpp 106  0x1400230c6 
15  AutomationPattern::`vector deleting destructor' lmms                       0x14002ae68 
16  InlineAutomation::~InlineAutomation             InlineAutomation.h    46   0x1400bdfb7 
17  DetuningHelper::~DetuningHelper                 DetuningHelper.h      44   0x1400bdefa 
18  DetuningHelper::`scalar deleting destructor'    lmms                       0x1400be25c 
19  sharedObject::unref<DetuningHelper>             shared_object.h       64   0x1400bdc42 
20  Note::~Note                                     Note.cpp              89   0x1400bc710 
... <More>                                                                                 

Looks like some object is in a different thread than its parent, which is disallowed by Qt.

@lukas-w
Copy link
Member Author

lukas-w commented Nov 24, 2017

I took a look at Qt's source code and found that the reason this only surfaces on Windows for me is that the checkReceiverThread is only called when Qt is built in debug mode, which is not the case with packages provided by Linux distros. So this bug is not specific to Windows and therefore not related to this PR. Merging.

@lukas-w lukas-w mentioned this pull request May 31, 2018
sdasda7777 pushed a commit to sdasda7777/lmms that referenced this pull request Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants