These instructions provide generic guidelines that need to be applied to your specific platform. For the Mega 2560, I just managed to successfully compile the BSEC library's built-in "basic" example in Arduino 1.8.10. The verbose output can help you find the toolchain used, for me the Mega 2560 used the AVR toolchain in Arduino's default installation path. Therefore I added the "compiler.libraries.ldflags" to the platform.txt file I found under "C:\Program Files (x86)\Arduino\hardware\arduino\avr\platform.txt" in my setup.
[...]
# These can be overridden in platform.local.txt
compiler.c.extra_flags=
compiler.c.elf.extra_flags=
compiler.S.extra_flags=
compiler.cpp.extra_flags=
compiler.ar.extra_flags=
compiler.objcopy.eep.extra_flags=
compiler.elf2hex.extra_flags=
compiler.libraries.ldflags=
[...]
## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" {compiler.libraries.ldflags} "-L{build.path}" -lm
[...]
... View more