mauer / xmidictrl

XMidiCtrl is an X-Plane plugin to use midi controllers within the flight simulator
https://mauer.github.io/xmidictrl/#/
GNU Affero General Public License v3.0
32 stars 10 forks source link

CTD after upgrade to 1.0 #12

Closed zumbrunnen closed 2 years ago

zumbrunnen commented 2 years ago

After upgrading to 1.0, X-Plane 11.55r2 under Linux keeps crashing.

Log.txt:

--=={This application has crashed because of the plugin: XMidiCtrl}==--

XMidiCtrl_Log.txt:

2022-05-22 09:50:26   [INFO]    Plugin �� loaded successfully
2022-05-22 09:50:26   [INFO]    Plugin enabled
2022-05-22 09:50:48   [INFO]    Aircraft Profile '|�' found
2022-05-22 09:50:48   [INFO]    Sublayer mode activated
2022-05-22 09:50:48   [INFO]    0 Device(s) found in aircraft profile

Also note the garbled chars. In version 0.62 this was not the case.

This happens even if I start from scratch (i.e. Output/preferences/XMidiCtrl deleted). The folder structure gets recreated, but the sim crashes during loading the flight:

2022-05-22 09:58:38   [INFO]    Plugin �� loaded successfully
2022-05-22 09:58:38   [INFO]    Plugin enabled
2022-05-22 09:58:38   [INFO]    Directory '��' not found
2022-05-22 09:58:38   [INFO]    Directory '��' created
2022-05-22 09:58:38   [INFO]    Directory '��' not found
2022-05-22 09:58:38   [INFO]    Directory '��' created
2022-05-22 09:58:44   [INFO]    No profile found for current aircraft

AFAIK this is independent of:

When downgrading the plugin to version 0.62, everything works as expected again.

mauer commented 2 years ago

Hi,

Many thanks for the bug report. That is really strange. May I ask which Linux Distribution you use? Could you try to activate the debug mode, please? It might log some additional infos.

You can activate by adding the following line to the XMidiCtrl_Settings.toml: debug_mode = true

Thanks, Marco

zumbrunnen commented 2 years ago

It's Ubuntu 22.04, fresh installation. The weird thing: version 0.62 is still working :thinking:

OK, fresh install of 1.00, emptied Output/preferences/XMidiCtrl, except XMidiCtrl_Settings.toml with debug_mode = true and a copy of the plugin's template profile for the X-Touch (I only adjusted port_in to match my setup):

2022-05-22 10:34:54   [INFO]    Plugin b�E loaded successfully
2022-05-22 10:34:54   [INFO]    Plugin enabled
2022-05-22 10:34:54   [DEBUG]    --> Set dataref 'xmidictrl/sublayer' to value '(n
2022-05-22 10:34:54   [DEBUG]   Flight loop registered
2022-05-22 10:35:00   [DEBUG]   Load aircraft profile
mauer commented 2 years ago

Normally I compile XMidiCtrl using a Ubuntu 20.04 docker container.

I just installed 22.04 WSL on my Windows system and compiled the plugin again. The strange characters in the log file worry me a bit. Looks like a core library is working differently, but I'm not quite sure.

Would you mind testing the attached file for me, please?

I will install Ubuntu 22.04 later on a spare partition to run some additional tests.

XMidiCtrl.zip

zumbrunnen commented 2 years ago

Hi Marco

Unfortunately, X-Plane now already crashes during "Will initialize plugins"...

Log.txt:

Plugin XMidiCtrl 1.00 loaded successfully--=={This application has crashed because of the plugin: XMidiCtrl}==--

XMidiCtrl_log.txt:

2022-05-22 12:49:26   [INFO]    Plugin (null) loaded successfully
2022-05-22 12:49:26   [INFO]    Plugin enabled

I'll try to recreate the build process (as in .github/workflows/cmake.yml) and report back if I find something.

Thanks for the tips and hints!

zumbrunnen commented 2 years ago

I just tried to compile the plugin by starting Docker containers (ubuntu:jammy and ubuntu:focal). Commands used:

apt update
apt install -y --no-install-recommends freeglut3-dev libudev-dev libopenal-dev pkg-config libalsa-ocaml-dev build-essential cmake
cmake -B ./build -DCMAKE_BUILD_TYPE=Release
cmake --build ./build --config Release

The last command then fails with this output in both containers, so Ubuntu 20.04 and Ubuntu 22.04:

[...]
[ 45%] Building CXX object src/CMakeFiles/XMidiCtrl.dir/profile/device.cpp.o
In file included from /src/src/profile/map/map_init/map_init.h:26,
                 from /src/src/profile/device.h:40,
                 from /src/src/profile/device.cpp:18:
/src/src/common/outbound_task.h:40:26: error: declaration of 'std::shared_ptr<xmidictrl::map> xmidictrl::outbound_task::map' changes meaning of 'map' [-fpermissive]
   40 |     std::shared_ptr<map> map;
      |                          ^~~
In file included from /src/src/profile/map/map_in/map_in.h:26,
                 from /src/src/profile/device.h:38,
                 from /src/src/profile/device.cpp:18:
/src/src/profile/map/map.h:34:7: note: 'map' declared here as 'class xmidictrl::map'
   34 | class map : public std::enable_shared_from_this<map> {
      |       ^~~
make[2]: *** [src/CMakeFiles/XMidiCtrl.dir/build.make:219: src/CMakeFiles/XMidiCtrl.dir/profile/device.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:239: src/CMakeFiles/XMidiCtrl.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

Unfortunately, I'm not a "C/C++ guy", so :man_shrugging: :rofl:

mauer commented 2 years ago

Looks like GCC or not as forgiving as Clang. Just modified the source code slightly. the MAIN branch should compile now.

zumbrunnen commented 2 years ago

Thanks, Marco. I can now build it, but running it results in the same behaviour as with your version in the ZIP: CTD while "Will initialize plugins".

I also tried building the tag "v0.62" - that version works perfectly fine (building & running in X-Plane)! So there must be something in between 0.62 and the present code base that causes the CTD.

mauer commented 2 years ago

Hi,

I installed Ubuntu 22.04 last night and was able to reproduce the issue. According to the debugger it fails in my new logging class. It seems like Ubuntu 22.04 has an issue with the variadic function I wrote.

Leave it with me, I'll try to rewrite it. Hopefully it will not be too much work.

Thanks, Marco

mauer commented 2 years ago

Hi,

I think I fixed it - at least its working on my system with a fresh installation of Ubuntu 22.04 and X-Plane. Could you try the attached file, please?

XMidiCtrl_1.01.zip

Thanks, Marco

zumbrunnen commented 2 years ago

Thank you, Marco! Everything works great with version 1.1! Even the log output is no longer "garbled". :+1:

XMidiCtrl_Log.txt