Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't create archive without object files #4019

Closed
maxgerhardt opened this issue Aug 3, 2021 · 0 comments
Closed

Don't create archive without object files #4019

maxgerhardt opened this issue Aug 3, 2021 · 0 comments
Assignees
Labels
bug build system ldf Library Dependency Finder
Milestone

Comments

@maxgerhardt
Copy link
Contributor

maxgerhardt commented Aug 3, 2021

What kind of issue is this?

  • [X ] PlatformIO Core.
    If you’ve found a bug, please provide an information below.

You can erase any parts of this template not applicable to your Issue.


Configuration

Operating system: Mac OS
PlatformIO Version (platformio --version): 5.2.0b1

Description of problem

A user in this thread has run into the problem that when a header-only library is used in lib_deps, specifically rlogiacco/CircularBuffer, the program fails to compile at the stage where PlatformIO attempts to create a .a archive file for the library.

Steps to Reproduce

  1. Use platformio.ini and code from below
  2. Compile

Actual Results

Dependency Graph
|-- <CircularBuffer> 1.3.3 (/Users/ali/Documents/PlatformIO/Projects/esp_template/.pio/libdeps/native/CircularBuffer)
Building in debug mode
Retrieved `.pioenvs/native/src/native/main.o' from cache
ar rc .pioenvs/native/libcaf/libCircularBuffer.a
ar: no archive members specified
usage:  ar -d [-TLsv] archive file ...
        ar -m [-TLsv] archive file ...
        ar -m [-abiTLsv] position archive file ...
        ar -p [-TLsv] archive [file ...]
        ar -q [-cTLsv] archive file ...
        ar -r [-cuTLsv] archive file ...
        ar -r [-abciuTLsv] position archive file ...
        ar -t [-TLsv] archive [file ...]
        ar -x [-ouTLsv] archive [file ...]
*** [.pioenvs/native/libcaf/libCircularBuffer.a] Error 1

Expected Results

PlatformIO does not attempt to invoke the archiver if no object files are present as sources.

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:native]
platform = native
build_type = debug
build_flags = -std=gnu++11
lib_compat_mode = off
lib_deps =
    rlogiacco/CircularBuffer @ ^1.3.3

Source file to reproduce issue:

#include <stdio.h>
#include <CircularBuffer.h>

int main(void){
  printf("main ran\n");
  return 0;
}

Additional info

The problem also seems to be specific to the toolchain version and/or OS being used, since the user says the problem occurs on Mac but not on Windows.

Adding

lib_archive = no

to forcibly prevent PlatformIO from linking the library is a workaround (but should be automatically detected).

@ivankravets ivankravets added the bug label Aug 6, 2021
@ivankravets ivankravets added this to the 5.2.0 milestone Aug 6, 2021
@ivankravets ivankravets self-assigned this Aug 6, 2021
@ivankravets ivankravets added the ldf Library Dependency Finder label Sep 13, 2021
ivankravets added a commit that referenced this issue Sep 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug build system ldf Library Dependency Finder
Projects
None yet
Development

No branches or pull requests

2 participants