I think something is wrong with the shared memory implementation, like I mentioned
here. LMMS has a macro for switching between QT shared memory and LMMS' own native implementation. Maybe there is something wrong with LMMS' implementation. We could check with QT.
[EDIT]
I've already made some progress on temporarily moving to Qt, but I could not get it to link, yet:
Code: Select all
diff --git CMakeLists.txt CMakeLists.txt
index aae9ad0..f7b8c38 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -102,7 +102,7 @@ CHECK_INCLUDE_FILES(semaphore.h LMMS_HAVE_SEMAPHORE_H)
CHECK_INCLUDE_FILES(unistd.h LMMS_HAVE_UNISTD_H)
CHECK_INCLUDE_FILES(sys/types.h LMMS_HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILES(sys/ipc.h LMMS_HAVE_SYS_IPC_H)
-CHECK_INCLUDE_FILES(sys/shm.h LMMS_HAVE_SYS_SHM_H)
+#CHECK_INCLUDE_FILES(sys/shm.h LMMS_HAVE_SYS_SHM_H)
CHECK_INCLUDE_FILES(sys/time.h LMMS_HAVE_SYS_TIME_H)
CHECK_INCLUDE_FILES(sched.h LMMS_HAVE_SCHED_H)
CHECK_INCLUDE_FILES(sys/soundcard.h LMMS_HAVE_SYS_SOUNDCARD_H)
diff --git include/RemotePlugin.h include/RemotePlugin.h
index 42caa36..cacd089 100644
--- include/RemotePlugin.h
+++ include/RemotePlugin.h
@@ -52,12 +52,12 @@
#endif
-#ifdef LMMS_HAVE_SYS_SHM_H
-#include <sys/shm.h>
-
#ifdef LMMS_HAVE_UNISTD_H
#include <unistd.h>
#endif
+
+#ifdef LMMS_HAVE_SYS_SHM_H
+#include <sys/shm.h>
#else
#define USE_QT_SHMEM
diff --git plugins/vst_base/RemoteVstPlugin.cpp plugins/vst_base/RemoteVstPlugin.cpp
index 234b89a..be49f13 100644
--- plugins/vst_base/RemoteVstPlugin.cpp
+++ plugins/vst_base/RemoteVstPlugin.cpp
@@ -94,18 +94,16 @@ struct ERect
#include "VstSyncData.h"
-#ifdef LMMS_BUILD_WIN32
+//#ifdef LMMS_BUILD_WIN32
#define USE_QT_SHMEM
-#endif
+//#endif
-#ifndef USE_QT_SHMEM
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
-#endif
static VstHostLanguages hlang = LanguageEnglish;
Save this as patchfile and apply this patch via
Compile via cmake like this:
Code: Select all
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/lmms-test/
CPATH=/opt/wine-staging/include:/usr/include/qt4 make -j6
Things to care about:
# Adjust the CMAKE_INSTALL_PREFIX if you want it to be installed somewhere else.
# CPATH might not necessarily be adjusted, or at least not that much. I use wine-staging by default, I also tried with upstream wine (well since a few days wine-staging is part of wine upstream)
# Adjust -j6 if you have a different processor count. I usually take a bit more than my amount of processors (*1.5 or similar).
But linking still fails:
Code: Select all
RemoteVstPlugin-zsiYyn.o: In function `RemotePluginClient::RemotePluginClient(int, int)':
RemoteVstPlugin.cpp:(.text+0x4a2): undefined reference to `QSharedMemory::QSharedMemory(QObject*)'
RemoteVstPlugin.cpp:(.text+0x4d0): undefined reference to `QSharedMemory::QSharedMemory(QString const&, QObject*)'
RemoteVstPlugin.cpp:(.text+0x52e): undefined reference to `QSharedMemory::attach(QSharedMemory::AccessMode)'
RemoteVstPlugin.cpp:(.text+0x544): undefined reference to `QSharedMemory::data()'
RemoteVstPlugin.cpp:(.text+0x65e): undefined reference to `QSharedMemory::~QSharedMemory()'
RemoteVstPlugin.cpp:(.text+0x674): undefined reference to `QSharedMemory::~QSharedMemory()'
RemoteVstPlugin-zsiYyn.o: In function `RemotePluginClient::~RemotePluginClient()':
RemoteVstPlugin.cpp:(.text+0x6ce): undefined reference to `QSharedMemory::detach()'
RemoteVstPlugin.cpp:(.text+0x713): undefined reference to `QSharedMemory::~QSharedMemory()'
RemoteVstPlugin.cpp:(.text+0x725): undefined reference to `QSharedMemory::~QSharedMemory()'
RemoteVstPlugin.cpp:(.text+0x774): undefined reference to `QSharedMemory::~QSharedMemory()'
RemoteVstPlugin.cpp:(.text+0x78a): undefined reference to `QSharedMemory::~QSharedMemory()'
RemoteVstPlugin-zsiYyn.o: In function `RemotePluginClient::setShmKey(int, int)':
RemoteVstPlugin.cpp:(.text+0xad8): undefined reference to `QString::number(int, int)'
RemoteVstPlugin.cpp:(.text+0xaee): undefined reference to `QSharedMemory::setKey(QString const&)'
RemoteVstPlugin.cpp:(.text+0xb11): undefined reference to `QSharedMemory::attach(QSharedMemory::AccessMode)'
RemoteVstPlugin.cpp:(.text+0xb27): undefined reference to `QSharedMemory::error() const'
RemoteVstPlugin.cpp:(.text+0xb4d): undefined reference to `QSharedMemory::data()'
RemoteVstPlugin.cpp:(.text+0xb6c): undefined reference to `QSharedMemory::error() const'
RemoteVstPlugin-zsiYyn.o: In function `QString::QString(char const*)':
RemoteVstPlugin.cpp:(.text._ZN7QStringC2EPKc[_ZN7QStringC5EPKc]+0x1c): undefined reference to `QString::fromAscii_helper(char const*, int)'
RemoteVstPlugin-zsiYyn.o: In function `QString::~QString()':
RemoteVstPlugin.cpp:(.text._ZN7QStringD2Ev[_ZN7QStringD5Ev]+0x34): undefined reference to `QString::free(QString::Data*)'
RemoteVstPlugin-zsiYyn.o: In function `shmFifo::shmFifo(int)':
RemoteVstPlugin.cpp:(.text._ZN7shmFifoC2Ei[_ZN7shmFifoC5Ei]+0x37): undefined reference to `QString::number(int, int)'
RemoteVstPlugin.cpp:(.text._ZN7shmFifoC2Ei[_ZN7shmFifoC5Ei]+0x4f): undefined reference to `QSharedMemory::QSharedMemory(QString const&, QObject*)'
RemoteVstPlugin.cpp:(.text._ZN7shmFifoC2Ei[_ZN7shmFifoC5Ei]+0x9a): undefined reference to `QSharedMemory::attach(QSharedMemory::AccessMode)'
RemoteVstPlugin.cpp:(.text._ZN7shmFifoC2Ei[_ZN7shmFifoC5Ei]+0xb0): undefined reference to `QSharedMemory::data()'
RemoteVstPlugin.cpp:(.text._ZN7shmFifoC2Ei[_ZN7shmFifoC5Ei]+0x130): undefined reference to `QSharedMemory::~QSharedMemory()'
RemoteVstPlugin-zsiYyn.o: In function `shmFifo::~shmFifo()':
RemoteVstPlugin.cpp:(.text._ZN7shmFifoD2Ev[_ZN7shmFifoD5Ev]+0x4c): undefined reference to `QSharedMemory::~QSharedMemory()'
collect2: Fehler: ld gab 1 als Ende-Status zurück
winegcc: g++ failed
I assume I need to install Qt4 in my WINE distribution, because winegcc ... .
Also note that this patch is not for a final version, it just disables every native shared memory operation (not depending on systems or something).
[EDIT]
I've written some parts in the LMMS irc channel:
Code: Select all
shmat is blocking and freezing the vst loading
I temporarily made all shmget calls create the shared memory block if it doesn't exist
and it sometimes can happen that the wine part hasn't created the shared memory block already
so RemotePlugin.h will try to get the shared memory block before RemoteVstPlugin.cpp has created it.
[EDIT]
After more debugging I found out that some time was wasted because RemoteVstPlugin is a RemotePluginClient. RemotePluginClient itself tries to access a predefined shm, can't find it and will use alternative messaging, but the host (VstPlugin.cpp) doesn't seem to react. VstPlugin itself is also a RemotePlugin, but the host part if I understand it correctly.
Code: Select all
RemotePluginClient
|
v
RemotePluginBase <--- RemotePlugin <--- VstPlugin
[EDIT]
Ok, so it gets a bit further if VST sync is enabled, but not much. In the while(1) loop in RemoteVstPlugin::RemoteVstPlugin no message is received. I think this whole shm thing is bugged. Maybe mmap or shm_open could be the solution.
[EDIT]
You can get rid of the shmget warning, if you enable "VST sync" in the settings.
Here is the log with VST sync disabled:
Code: Select all
VST sync support disabled in your configuration
VstPlugin::tryLoad A
m_commMutex.lock()
RemotePlugin::init A
m_out->lock()
m_out->unlock()
RemotePlugin::init B
m_commMutex.unlock()
RemotePlugin::init E
VstPlugin::tryLoad B
m_commMutex.lock()
VstPlugin::tryLoad C
VstPlugin::tryLoad D
m_out->lock()
m_out->unlock()
VstPlugin::tryLoad E
VstPlugin::tryLoad F
m_out->lock()
m_out->unlock()
VstPlugin::tryLoad G
fixme:winediag:start_process Wine Staging 1.7.50 is a testing version containing experimental patches.
fixme:winediag:start_process Please report bugs at http://bugs.wine-staging.com (instead of winehq.org).
RemotePlugin.h A
RemotePlugin.h B
RemotePluginClient::shmget: Datei oder Verzeichnis nicht gefunden
RemotePlugin.h E
m_out->lock()
fixme:ole:RemUnknown_QueryInterface No interface for iid {00000019-0000-0000-c000-000000000046}
These A, B, C, D, E, .. markers are some printfs I inserted to get a better knowledge about the program flow.
Here is the log with VST sync enabled, however it will still be stuck, as one of the semaphores won't lock (although it should):
Code: Select all
VstPlugin::tryLoad A
m_commMutex.lock()
RemotePlugin::init A
m_out->lock()
m_out->unlock()
RemotePlugin::init B
m_commMutex.unlock()
RemotePlugin::init E
VstPlugin::tryLoad B
m_commMutex.lock()
VstPlugin::tryLoad C
VstPlugin::tryLoad D
m_out->lock()
m_out->unlock()
VstPlugin::tryLoad E
VstPlugin::tryLoad F
m_out->lock()
m_out->unlock()
VstPlugin::tryLoad G
fixme:winediag:start_process Wine Staging 1.7.50 is a testing version containing experimental patches.
fixme:winediag:start_process Please report bugs at http://bugs.wine-staging.com (instead of winehq.org).
RemotePlugin.h A
RemotePlugin.h B
RemotePlugin.h C
RemotePlugin.h D
RemoteVstPlugin.cpp 0
RemoteVstPlugin.cpp A
RemoteVstPlugin.cpp B
RemoteVstPlugin.cpp C
RemoteVstPlugin.cpp D
RemoteVstPlugin.cpp E
RemoteVstPlugin.cpp F
RemotePluginBase::receiveMessage A
RemotePluginBase::receiveMessage B
m_in->lock()
fixme:ole:RemUnknown_QueryInterface No interface for iid {00000019-0000-0000-c000-000000000046}
You could try POSIX mutexes instead.