Skip to content

std::string doesn't compile #199

@facchinm

Description

@facchinm

Any sketch using std::string will either fail compiling or, if

  void __throw_bad_alloc() {}
  void __throw_bad_function_call() {}
  void __throw_length_error(const char*) {}
};

gets removed from abi.cpp, fails to run in dynamic mode.

Compiler output:

/ssd/Arduino15/packages/dev/tools/arm-zephyr-eabi/0.16.8/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: /ssd/Arduino15/packages/dev/tools/arm-zephyr-eabi/0.16.8/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/thumb/v8-m.main+fp/hard/libstdc++.a(functexcept.o): in function `std::__throw_bad_alloc()':
functexcept.cc:(.text.unlikely._ZSt17__throw_bad_allocv+0x0): multiple definition of `std::__throw_bad_alloc()'; 

Shell output on dynamic mode with overrides commented out

[00:00:00.204,000] <err> elf: sym 'memcpy': relocation out of range (0x2000cc76 -> 0x801b047)

Minimal reproducible example:

void setup() {
  std::string c = "notworking";
  Serial.println(c.c_str());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions