Esp32 Arduino Linker error: multiple definition of `analogWriteResolution'

I’m resurrecting an older project Esp32CameraRover2. It is based on the Esp32Cam and uses the Arduino api. It compiles ok (some warnings but no errors). I’m getting a linker error because two versions of the esp32-hal are included in the link;

Here is my platform.ini

[env]
build_src_flags = 
	-D SERIAL_DISABLE=1         ; remove to enable serial on tx/rx pins
	-D USE_WHEEL_ENCODERS=1     ; remove to turn off use of wheel encoders
                                ; you may need to do this to use serial port
	-D USE_ENCODER_INTERRUPTS=1 ; remoe to using polling of encoder pins
    -D ENABLE_CAMERA=1          ; remove to disable camera code
    -include Arduino.h

[env:esp32cam]
platform = espressif32
board = esp32cam
framework = arduino
monitor_speed = 115200
lib_deps = 
	ESP Async WebServer
	WebSockets

Here is the linker output

Processing esp32cam (platform: espressif32; board: esp32cam; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32cam.html
PLATFORM: Espressif 32 (6.1.0) > AI Thinker ESP32-CAM
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.20007.0 (2.0.7) 
 - tool-esptoolpy @ 1.40500.0 (4.5.0) 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 37 compatible libraries
Scanning dependencies...
Dependency Graph
|-- ESP Async WebServer @ 1.2.3
|-- WebSockets @ 2.3.7
|-- Esp32AnalogWrite
|-- AsyncTCP @ 1.1.1
|-- WiFi @ 2.0.0
Building in release mode
Linking .pio/build/esp32cam/firmware.elf
/Users/edmurphy/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32cam/libFrameworkArduino.a(esp32-hal-ledc.c.o): in function `analogWriteResolution':
/Users/edmurphy/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-ledc.c:252: multiple definition of `analogWriteResolution'; .pio/build/esp32cam/liba40/libEsp32AnalogWrite.a(analogWrite.cpp.o):/Users/edmurphy/projects/Esp32CameraRover2/lib/Esp32AnalogWrite/analogWrite.cpp:88: first defined here
collect2: error: ld returned 1 exit status
*** [.pio/build/esp32cam/firmware.elf] Error 1
================================================================= [FAILED] Took 22.37 seconds =================================================================

I’m not sure how to fix this issue. This did not happen in the past, so it is some issue with newer versions of the frameworks.

Ok this is because of code rot. The original project used an older version of PlatformIO that required a shim library for the analogWrite() method. Newer versions do not need this shim. Once I removed it everything compiled and uploaded to the Esp32Cam.