Arduino library does not compile with Arduino as a IDF component

Hi there,

I am quite new to using PlatformIO with Arduino as a IDF component. After long struggles I finally succeeded to have it working in general. Now I have issues to use an Arduino library (“Adafruit BMP3XX”) in this context.

Building fails with:

.pio/libdeps/lolin_d32_pro/Adafruit Unified Sensor/Adafruit_Sensor.cpp: In member function 'void Adafruit_Sensor::printSensorDetails()':
.pio/libdeps/lolin_d32_pro/Adafruit Unified Sensor/Adafruit_Sensor.cpp:11:3: error: 'Serial' was not declared in this scope
   Serial.println(F("------------------------------------"));
   ^~~~~~
.pio/libdeps/lolin_d32_pro/Adafruit Unified Sensor/Adafruit_Sensor.cpp:11:18: error: 'F' was not declared in this scope
   Serial.println(F("------------------------------------"));
                  ^
*** [.pio\build\lolin_d32_pro\lib149\Adafruit Unified Sensor\Adafruit_Sensor.cpp.o] Error 1

To reproduce it should be sufficient to generate a new esp-idf project and use this platformio.ini:

[env:lolin_d32_pro]
platform = espressif32
board = lolin_d32_pro
framework = arduino, espidf
monitor_speed = 115200
monitor_filters = default, printable
monitor_flags = --raw
platform_packages = 
	framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#idf-release/v4.0
lib_deps = 
	adafruit/Adafruit BMP3XX Library@^2.0.2
	adafruit/Adafruit BusIO@^1.7.2
; needed for Adafruit_BusIO to compile (ESP32 define is missing else -> "'BitOrder' has not been declared")
; https://community.platformio.org/t/add-arduino-library-to-esp-idf-with-arduino-core-as-component/18562/4
build_flags =
    -D ESP32

and this main.cpp:
extern “C” void app_main(void) {}

You will have to use menuconfig to enable:
Component config -> mbedTLS -> TLS Key Exchange Methods-> Enable pre-shared-key ciphersuites

That’s about it. Cam anybody help me to tackle that issue?
Thanks in advance!
Keith

I am one step further: a simple
#include <Arduino.h>
in Adafruit_Sensor.cpp solves the issue.

But I do not want to tweak the library code if avoidable.
Adafruit_Sensor.h comes with:

#ifndef ARDUINO
#include <stdint.h>
#elif ARDUINO >= 100
#include "Arduino.h"
#include "Print.h"
#else
#include "WProgram.h"
#endif

So a
build_flags =
-D ESP32
-D ARDUINO=100
in platformio.ini helps as well.

Thank you anyways!