Library LDF mode ignored for lib_deps

Hello everyone!

I have a strange issue with one of my libraries (GitHub - jgromes/RadioLib: Universal wireless communication library for embedded devices). The library contains a library.json file, which specifies that LDF mode chain+ should be used - there’s a lot of #ifdefs which control compilation for different platforms, so chain+ is needed to resolve dependecies.

The strange thing is, when the library is included in a PlatformIO project using lib_deps in platformio.ini, it seems that chain+ LDF mode is not used for the library anymore, as LDF tries to compile a library that is guarded by an #ifdef.

Is there a way to specify LDF mode to be used on the library, or am I misunderstanding something?


Anyone has any ideas? I’m a bit lost here, I’m not used to Platformio.

Can you provide the exact project tat fails?

@maxgerhardt thanks! The library is this one: GitHub - jgromes/RadioLib: Universal wireless communication library for embedded devices

There’s an open issue regarding this problem: STM32 with RFM95 not compiling · Issue #696 · jgromes/RadioLib · GitHub
With the following .ini file:

platform =
board = bluepill_f103c8
framework = arduino
upload_protocol = stlink
monitor_port = COM7
lib_deps = 

But with which example .cpp code is this happening?

Any of the examples in that library. When compiling anything for STM32, the LDF tries to load SubGhz.h because it finds it in one of the files (src/modules/SX126x/STM32WLx_Module.cpp), but it ignores that it’s guarded by a macro.

Where? When you use

lib_deps = 

there’s none of that.


And the build does fail with RF69Transmitter.ino.

If I however let PlatformIO use the latest git version

lib_deps =

there’s 0 problems with the build

RAM:   [=         ]   6.6% (used 1348 bytes from 20480 bytes)
Flash: [=====     ]  45.4% (used 29736 bytes from 65536 bytes)
Building .pio\build\bluepill_f103c8\firmware.bin
============================== [SUCCESS] Took 16.28 seconds ==============================

So your new library.json fixes the build correctly. All that’s needed now is to push it as a new stable version.

Weird. When I download on the CLI

pio pkg install -l "jgromes/RadioLib@5.7.0"

the library.json is missing compared to what’s displayed as 5.7.0 in

So it looks like the PlatformIO registry packages for the library are not correct. How did you publish the library? Via pio pkg publish?

No, I previously only published libraries to the Arduino IDE Library Manager, which fetches the update based on existing tag and the value in Platformio shows the version does exist though, so I assumed there was some automated process here as well.

Hm. CC @ivankravets could you please take a look why jgromes/RadioLib@5.7.0 doesn’t match The library.json is missing and it’s thus failing the build :frowning:


Sorry, strange issue. Should be fixed now. Could you re-test?

Thank you very much! I think that did help, my test project builds now. I can also see on the registry page that it does show the information from library.json which were missing previously (keywords etc.).

I will try to verify this with the person who originally reported the issue, but it seems fixed.

What was the root cause? Was it the presence of both and library.json, or something I did wrong in one of those files? I’d like to avoid this situation in the future.

We just switched the library to the library.json manifest. It could be an issue that you tried to update the “version” field in the manifest BEFORE making the final release/tag.

We recommend incrementing the “version” field only when you are ready to push the new release/tag.

1 Like

I update the library by changing the version number in (and now in library.json as well), and then tagging this commit as the release. So I guess that should be OK, right?

One potential issue is that the CI on the library takes quite long for releases (because some platforms take forever to build all the examples), 2 hours or more. So effectively, there’s a 2-hour window between the change in library.json and a new tag with the corresponding version number. Could this be a problem?

Sorry if this is a basic question, unfortunately a quick google search didn’t reveal much. Thank you for the help so far!

We can disable automatic version publishing (legacy mode) for your library. This is actually how developers manage their new libraries.

Every time you have a new version/release, you will need manually publish the version to the registry using pio pkg publish — PlatformIO latest documentation command.

Would you like us to disable the automatic version publishing for this library?

I think that would be better, honestly it’s a bit weird to not have control over when exactly the package is published.