Compilation Error with Arduino_POSIXStorage Library

Hello everyone,

I’m encountering a compilation error while trying to build a project for Arduino. Here’s the relevant part of my platformio.ini file:

[env:opta]
platform = ststm32
board = opta
framework = arduino
lib_ldf_mode = deep
lib_deps = 
    adafruit/Adafruit LED Backpack Library@^1.5.0
    adafruit/Adafruit GFX Library@^1.11.9
    arduino-libraries/ArduinoRS485@^1.0.5
    br3ttb/PID@^1.2.1
    lib/ArduinoDuPPaLib
    Arduino_UnifiedStorage@^1.1.1
    ArduinoModbus@^1.0.9

However, during compilation, I’m encountering the following error:

.pio/libdeps/opta/Arduino_POSIXStorage/src/Arduino_POSIXStorage.cpp: In function 'int {anonymous}::register_callback(StorageDevices, void (*)(), CallbackTypes)':
.pio/libdeps/opta/Arduino_POSIXStorage/src/Arduino_POSIXStorage.cpp:561:47: error: 'class USBHostMSD' has no member named 'attach_detected_callback'
         attachCallbackReturn = usbHostDevice->attach_detected_callback(callbackFunction);
                                               ^~~~~~~~~~~~~~~~~~~~~~~~
.pio/libdeps/opta/Arduino_POSIXStorage/src/Arduino_POSIXStorage.cpp:565:47: error: 'class USBHostMSD' has no member named 'attach_removed_callback'
         attachCallbackReturn = usbHostDevice->attach_removed_callback(callbackFunction);
                                               ^~~~~~~~~~~~~~~~~~~~~~~
Compiling .pio/build/opta/lib39b/doom/p_telept.c.o
Compiling .pio/build/opta/lib39b/doom/p_tick.c.o
*** [.pio/build/opta/lib01d/Arduino_POSIXStorage/Arduino_POSIXStorage.cpp.o] Error 1

It seems that the Arduino_POSIXStorage library is causing issues due to compatibility problems with the Arduino_USBHostMbed5 library. PlatformIO automatically downloaded Arduino_USBHostMbed5 version 0.1.1, but according to its GitHub repository, this version might not be compatible.

Does anyone have any ideas on how to resolve this issue? Should I try downgrading Arduino_USBHostMbed5 or is there another workaround?

Thanks in advance for any assistance!

Can you try forcing a higher version of the Arduino_USBHostMbed5 library then? Just add

   https://github.com/arduino-libraries/Arduino_USBHostMbed5/archive/refs/tags/0.3.1.zip

to the lib_deps expression.

Yeah I tried it, but that’s the results:

Library Manager: Installing Arduino_USBHostMbed5 @ ^0.3.1
Warning! Could not find the package with ‘Arduino_USBHostMbed5 @ ^0.3.1’ requirements for your system ‘linux_x86_64’

0.3.1 is not registered in the PIO registry. If you use the direct zip link from above, it should install the library fine.

I ran into the same issue. Maxgerhardt’s solution worked for me.