Skip to content

std::remainder: undefined reference to `__ieee754_remainder' #7845

@mcspr

Description

@mcspr

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: ESP8285
  • Core Version: c2393d0
  • Development Env: PlatformIO
  • Operating System: Windows

Settings in IDE

Defaults:

[env]
platform = espressif8266
board = d1_mini
framework = arduino

[env:git]
platform_packages =
    platformio/framework-arduinoespressif8266 @ https://github.com/esp8266/Arduino.git
    mcspr/toolchain-xtensa @ 5.100200.201223

Problem Description

std::remainder breaks the linker

ref. https://gitter.im/esp8266/Arduino?at=6011fd5f063b6c68d520a704
@earlephilhower

MCVE Sketch

#include <Arduino.h>
#include <cmath>

double does_this_work(double, double) __attribute((noinline));
double does_this_work(double a, double b) {
    return std::remainder(a, b);
}

void setup() {
    Serial.println(does_this_work(1.2345, 5.4321));
}

void loop() {
}

Debug Messages

Compiling .pio\build\git\src\main.cpp.o
Linking .pio\build\git\firmware.elf
c:/users/maxim/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.2.0/../../../../xtensa-lx106-elf/bin/ld.exe: c:/users/maxim/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.2.0/../../../../xtensa-lx106-elf/lib\libm.a(lib_a-w_remainder.o):(.literal+0x0): undefined reference to `__ieee754_remainder'
c:/users/maxim/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.2.0/../../../../xtensa-lx106-elf/bin/ld.exe: c:/users/maxim/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.2.0/../../../../xtensa-lx106-elf/lib\libm.a(lib_a-w_remainder.o): in function `remainder':
/workdir/repo/newlib/newlib/libm/math/w_remainder.c:60: undefined reference to `__ieee754_remainder'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\git\firmware.elf] Error 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions