Arduino CC - Linker not including ldflags library

OK,
I am using Mega 2560, Arduino CC Version 1.8.12, Seeed Grove BME680 Sensor
and DFRobot Library, modified to use the latest BSEC Library.

The BSEC Library includes a set of precompiled archive library files named libalgobsec.a located within subfolders of src below the Library base folder.

I tested the DFRobot code initially, and found it would compile the example sketches OK, and they produced expected results.
I then added appropriate function calls to my own sketch. The desired result was to gain additional functionality over the standard SEEED libraries for the sensor. Specifically this would allow me to
get calibrated pressure including pressure readings compensated for Altitude above sea level.

When the sketch is compiled, all of the normal .h, .c and .cpp files compile OK
But at the linker stage, the linkage fails because it is unable to resolve the location of several key function calls that are defined in the libalgobsec.a library. this includes bsec_update_subscription which tells the BME680 what sensors to turn on.

After several hours of debugging and trying things and reading documentation, my attention focuses on the verbose output of the compiler/linker and the library.properties file.
this contains two settings of interest:

  1. precompiled=true
    precompiled - (available from Arduino IDE 1.8.6/arduino-builder 1.4.0) (optional) set to true to allow the use of .a (archive) and .so (shared object) files. The .a/.so file must be located at src/{build.mcu} where {build.mcu} is the architecture name of the target the file was compiled for. Ex: cortex-m3 for the Arduino DUE. The static library should be linked as an ldflag.

  2. ldflags=-l algobsec
    ldflags - (available from Arduino IDE 1.8.6/arduino-builder 1.4.0) (optional) the linker flags to be added. Ex: ldflags=-lm

What I find is that when precompiled is present and set to true, the compiler does not compile anything in the src folder:
:::
Compiling libraries...
Compiling library "DFRobot_BME680"
Compiling library "SPI"

when it is absent, the src folder compiles OK
:::
Compiling library "DFRobot_BME680"
Using previously compiled file: C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\DFRobot_BME680\bme680.c.o
Using previously compiled file: C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\DFRobot_BME680\bsec_integration.c.o
Using previously compiled file: C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\DFRobot_BME680\DFRobot_BME680.cpp.o
Using previously compiled file: C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\DFRobot_BME680\DFRobot_BME680_SPI.cpp.o
Using previously compiled file: C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\DFRobot_BME680\DFRobot_BME680_I2C.cpp.o
Using previously compiled file: C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\DFRobot_BME680\bsec.cpp.o

However the linker then fails to include the -l algobsec item in the command line for the linker (Instead it adds '-lm') , and the result is several unresolved references like this:
:(.text+0x2cac): undefined reference to `bsec_update_subscription'

The linker command line:
"C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.33.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin/avr-gcc" -Wall -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections,--relax -mmcu=atmega2560 -o "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712/DFRobot_ReadSensor_Display.ino.elf" "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\sketch\DFRobot_ReadSensor_Display.ino.cpp.o" "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\DFRobot_BME680\bme680.c.o" "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\DFRobot_BME680\bsec_integration.c.o" "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\DFRobot_BME680\DFRobot_BME680.cpp.o" "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\DFRobot_BME680\DFRobot_BME680_I2C.cpp.o" "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\DFRobot_BME680\DFRobot_BME680_SPI.cpp.o" "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\DFRobot_BME680\bsec.cpp.o" "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\SPI\SPI.cpp.o" "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\Wire\Wire.cpp.o" "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\Wire\utility\twi.c.o" "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\Grove_-_OLED_Display_0.96\SeeedOLED.cpp.o" "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\Grove_High_Precision_RTC_PCF85063TP-master\PCF85063TP.cpp.o" "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\Seeed_PM2_5_sensor_HM3301-master\I2COperations.cpp.o" "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\Seeed_PM2_5_sensor_HM3301-master\Seeed_HM330X.cpp.o" "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\SD\File.cpp.o" "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\SD\SD.cpp.o" "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\SD\utility\Sd2Card.cpp.o" "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\SD\utility\SdFile.cpp.o" "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712\libraries\SD\utility\SdVolume.cpp.o" "C:\Users\Bryn\AppData\Local\Temp\arduino_build_806712/..\arduino_cache_674398\core\core_arduino_avr_mega_cpu_atmega2560_2cb511727fd0f7bc3455e21cd7b42d76.a" "-LC:\Users\Bryn\AppData\Local\Temp\arduino_build_806712" -lm

So, first of all this would indicate a documentation issue in:
https://arduino.github.io/arduino-cli/library-specification/

Or, it might be a bug in Arduino cc (which creates the linker command line).

Secondly, has anyone else seen this sort of thing, and is there a fix or work-around ?

Thanks, and apologies in advance if I have done something stupid.

OK, looks like my post was so verbose it overflowed, nobody can read the question at the bottom. I cant find an edit button....

brynparrott:
I cant find an edit button....

You should see this at bottom-right of one of your own posts. There's full edit in the "More" drop-down. You can enable full edit functionality for Quick Edit, in you profile settings.

edit.PNG

edit.PNG