question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

5.0.1 build no longer uses start-group/end-group linker flags (on native platform)

See original GitHub issue

Configuration

Operating system: Ubuntu 18.04

PlatformIO Version (platformio --version): 5.0.1

Description of problem

Builds with the native platform no longer pass start-group/end-group around libraries specified as linker arguments, which is causing my builds to fail. If I manually add these back then the final link step works. Builds on other platforms always use these arguments. This worked on 4.3.4.

Regression from #3282.

Steps to Reproduce

  1. git clone https://github.com/nomis/mcu-uuid-console
  2. cd mcu-uuid-console/test
  3. cd build/example-DigitalIO; pio lib install uuid-common uuid-log; cd -
  4. platformio run -d build/example-DigitalIO -e native -v

(at commit c9d04baf7143f0eef5826f4c79c55841bff9a7d0)

Actual Results

...
c++ -o .pio/build/native/program .pio/build/native/src/Arduino.o .pio/build/native/src/DigitalIO.o -L.pio/build/native .pio/build/native/lib8dc/libuuid-common.a .pio/build/native/libbdb/libuuid-log.a .pio/build/native/lib380/libuuid-console.a
.pio/build/native/libbdb/libuuid-log.a(log.o): In function `std::_Sp_counted_ptr_inplace<uuid::log::Message, std::allocator<uuid::log::Message>, (__gnu_cxx::_Lock_policy)2>::_M_get_deleter(std::type_info const&)':
log.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceIN4uuid3log7MessageESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info[_ZNSt23_Sp_counted_ptr_inplaceIN4uuid3log7MessageESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info]+0xb): undefined reference to `typeinfo name for std::_Sp_make_shared_tag'
.pio/build/native/libbdb/libuuid-log.a(log.o): In function `std::shared_ptr<uuid::log::Message> std::make_shared<uuid::log::Message, unsigned long, uuid::log::Level&, uuid::log::Facility&, __FlashStringHelper const* const&, char*>(unsigned long&&, uuid::log::Level&, uuid::log::Facility&, __FlashStringHelper const* const&, char*&&)':
log.cpp:(.text._ZSt11make_sharedIN4uuid3log7MessageEJmRNS1_5LevelERNS1_8FacilityERKPK19__FlashStringHelperPcEESt10shared_ptrIT_EDpOT0_[_ZSt11make_sharedIN4uuid3log7MessageEJmRNS1_5LevelERNS1_8FacilityERKPK19__FlashStringHelperPcEESt10shared_ptrIT_EDpOT0_]+0x152): undefined reference to `typeinfo for std::_Sp_make_shared_tag'
.pio/build/native/libbdb/libuuid-log.a(log.o):(.data.rel.ro._ZTISt23_Sp_counted_ptr_inplaceIN4uuid3log7MessageESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE[_ZTISt23_Sp_counted_ptr_inplaceIN4uuid3log7MessageESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE]+0x10): undefined reference to `typeinfo for std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>'
.pio/build/native/libbdb/libuuid-log.a(format_timestamp_ms.o): In function `uuid::log::format_timestamp_ms[abi:cxx11](unsigned long, unsigned int)':
format_timestamp_ms.cpp:(.text+0xb0): undefined reference to `snprintf_P(char*, unsigned long, char const*, ...)'

Expected Results

...
c++ -o .pio/build/native/program .pio/build/native/src/Arduino.o .pio/build/native/src/DigitalIO.o -L.pio/build/native -Wl,--start-group .pio/build/native/lib8dc/libuuid-common.a .pio/build/native/libbdb/libuuid-log.a .pio/build/native/lib380/libuuid-console.a -Wl,--end-group
============================================================================================================================ [SUCCESS] Took 2.55 seconds ============================================================================================================================

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
tsandmanncommented, Mar 23, 2021

As env.PioPlatform().is_embedded() returns true only if the packages list from platform.json contains a package of type uploader, the issue still exists on macOS for platforms that don’t specify an uploader tool.

base.py:

def is_embedded(self):
    for opts in self.packages.values():
        if opts.get("type") == "uploader":
            return True
    return False

Why does is_embedded() rely on the existence of an uploader tool for an embedded platform?

1reaction
ivankravetscommented, Mar 24, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Recommended compiler and linker flags for GCC
This article walks through a list of recommended build flags for when you compile your C or C++ programs with GCC. Do you...
Read more >
2011-January.txt - GCC, the GNU Compiler Collection
I know that makefiles can be used to compile a source tree with options at each source level. The problem is that *...
Read more >
WARNING: …/Android.mk: non-system libraries in linker flags
I interpret the "non-system libraries in linker flags" message as a warning that you're not using the default system libraries (in usr/lib ) ......
Read more >
Extra linker flags without -Wl, prefix - Platformio Docs
Sometimes you need to pass extra flags to GCC linker without Wl, . You could use build_flags option but it will not work....
Read more >
The Best and Worst GCC Compiler Flags For Embedded
As the linker resolves references between objects it will mark a section as used. A final optimization pass it can make is to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found