Trouble using native-macos-static v1.0.9 on OS X for OSC Query in C++ application


This relates to an early conversation with @avilleret Antoine Villeret on gitter - but since it got longwinded I figured a forum post is better:

I’ve tried a bit more to get OSC Query working again also on OSX. v1.0.9, having moved from the simple CPP98 implementation (which DID work also on OS X), to the more complete “Modern/Fast C++” one.

I get the issues both when using statically linked and dynamically linked “modern C++” libraries - libossia-native-macos-static.tar.gz / libossia-native-macos.tar.gz

On windows the exact same codebase, also using v1.0.9, work fine, querying the same server, the “OSCQuery Helper” hosting the SampleDocument.json on localhost…

Also on OSX it works to significant extent - it fetches the json, and parses it into a mirror node structure too, correctly containing parameters.

I still have the get_description issue mentioned the other day, but not only that, I’ve realised. The same EXC_BAD_ACCESS happens with a ossia::net::get_instance_bounds(node); call.

And many of the calls return “garbage” data, compared to when running the exact same way on windows.

Crucially n.osc_address(); returns an empty string, or garbage (see below) - on windows it is a proper string.
Sometimes instead of empty strings, weirdly it gives lines like below:
“Internal: 757632.0305567 loc (1831.0, 1172.3) conn”
“Internal: 757629.8284284 loc (1836.7, 1196.5) conn”

But, I can fetch a parameter, and parameter->get_value_type() does return sensible values, as do:
auto& dom = parameter->get_domain();
auto min = dom.get_min();
auto max = dom.get_max();

And disconnecting from the OSC Server does cause the libossia library to output the below to the console:

removing param : /test/my_char
removing param : /test/my_2Dpos
removing param : /test/timetag
removing param : /test/my_true
removing param : /test/my_longlong
removing param : /test/my_infinity
removing param : /test/my_double
removing param : /test/my_int
removing param : /test/my_string
removing param : /test/my_color
removing param : /test/my_false
removing param : /test/my_int_as_toggle
removing param : /test/my_float
removing param : /test/my_midi

The Xcode project is exported from JUCE’s Projucer, with deployment target set to 10.14.
Any ideas as to what may be causing the above?

It’d be great to fix - with this, The Wizard of OSC will have your great OSC Query implementation also on OS X!


Now I managed to reproduce this with a smaller project, easier to share - here it is!
The issue happens both with static and dynamic linking, also with libossia 1.2.2

The zipfile is big as I threw all dependencies in as well.

It doesn’t contain all of JUCE, which you will need if you want to run the projucer file, but otherwise the xcode project should in theory work out of the box…

IP and port is hardcoded to and 2345, those of the OSCQuery helper, but they can be changed in the MainComponent constructor.

There is a lot of unused code in the OSCQuery_Address.cpp file, but the main call tree is what is triggered when pressing the button in the GUI, from connectAndQuery() and the methods it calls.

On OS X 10.15.5, with XCode 12.3

The same code works consistently on Windows, the crashing has only been on OS X.