You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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: ESP-12
Core Version: 3.0.1
Development Env: Platformio
Operating System: Windows
Settings in IDE
Module: Wemos D1 mini
Flash Mode: dio
Flash Size: 4MB
lwip Variant: v2 Lower Memory
Reset Method: [ck|nodemcu]
Flash Frequency: [40Mhz]
CPU Frequency: 80Mhz
Upload Using: SERIAL
Upload Speed: 115200
Problem Description
A sketch making use of certain math functions, like ceill() and some C++ constructs fails to compile in PlatformIO, but compiles fine in the Arduino IDE.
#include<Arduino.h>
#include<buggy_lib.h>voidsetup() {
longdouble res = (longdouble) Serial.parseFloat();
res = ceill(res);
Serial.print("Result: ");
Serial.println((double) res);
//make use of the global variable, otherwise we don't get that error.for(auto& x : RANGE_VOLTAGE) {
Serial.println(x.first);
}
}
voidloop() {
}
with
lib\buggy_lib\buggy_lib.h:
#ifndef _BUGGY_LIB_H
#define_BUGGY_LIB_H
#include<cstdlib>// Needed for uint8_t
#include<string>
#include<unordered_map>using std::unordered_map;
using std::string;
structRange_Dict
{
float value_multiplier;
int dp_digit_position;
string display_unit;
};
typedef unordered_map<uint8_t, Range_Dict> range_dict_map_t;
externrange_dict_map_t RANGE_VOLTAGE;
#endif/* _BUGGY_LIB_H */
c:/users/max/.platformio/packages/[email protected]/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\Max\.platformio\packages\framework-arduinoespressif8266\tools\sdk\lib\libstdc++.a(math_stubs_long_double.o): in function `ceill':
/workdir/repo/gcc-gnu/libstdc++-v3/src/c++98/math_stubs_long_double.cc:76: multiple definition of `ceill'; c:/users/max/.platformio/packages/[email protected]/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/lib\libm.a(lib_a-ceill.o):/workdir/repo/newlib/newlib/libm/common/ceill.c:38: first defined here
collect2.exe: error: ld returned 1 exit status
Result in the Arduino IDE when the same library is also added in a new library folder:
Linking everything together...
"C:\\Users\\Max\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\3.0.3-gcc10.3-9bcba0b/bin/xtensa-lx106-elf-gcc" -fno-exceptions -Wl,-Map "-Wl,C:\\Users\\Max\\AppData\\Local\\Temp\\arduino_build_985255/ceill_test.ino.map" -g -w -Werror=return-type -Os -nostdlib -Wl,--no-check-sections -u app_entry -u _printf_float -u _scanf_float -Wl,-static "-LC:\\Users\\Max\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.1/tools/sdk/lib" "-LC:\\Users\\Max\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.1/tools/sdk/lib/NONOSDK22x_190703" "-LC:\\Users\\Max\\AppData\\Local\\Temp\\arduino_build_985255" "-LC:\\Users\\Max\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.1/tools/sdk/libc/xtensa-lx106-elf/lib" -Tlocal.eagle.flash.ld -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read -o "C:\\Users\\Max\\AppData\\Local\\Temp\\arduino_build_985255/ceill_test.ino.elf" -Wl,--start-group "C:\\Users\\Max\\AppData\\Local\\Temp\\arduino_build_985255\\sketch\\ceill_test.ino.cpp.o" "C:\\Users\\Max\\AppData\\Local\\Temp\\arduino_build_985255\\libraries\\buggy_lib\\buggy_lib.cpp.o" "C:\\Users\\Max\\AppData\\Local\\Temp\\arduino_cache_987583\\core\\core_826f2e61193dda5f059720593f4d9b02.a" -lhal -lphy -lpp -lnet80211 -llwip2-536-feat -lwpa -lcrypto -lmain -lwps -lbearssl -lespnow -lsmartconfig -lairkiss -lwpa2 -lstdc++ -lm -lc -lgcc -Wl,--end-group "-LC:\\Users\\Max\\AppData\\Local\\Temp\\arduino_build_985255"
..
Der Sketch verwendet 268841 Bytes (25%) des Programmspeicherplatzes. Das Maximum sind 1044464 Bytes.
Globale Variablen verwenden 29144 Bytes (35%) des dynamischen Speichers, 52776 Bytes für lokale Variablen verbleiben. Das Maximum sind 81920 Bytes.
The cause of this lies within the linking order of the libraries libstdc++ and libm (libmath). The Arduino does
While PlatformIO, due to the platformio-build.py doing a simple Append() to the end in regards to the libraries and not respecting the original position dicated by the platform.txt, does
Basic Infos
Platform
Settings in IDE
Problem Description
A sketch making use of certain math functions, like
ceill()
and some C++ constructs fails to compile in PlatformIO, but compiles fine in the Arduino IDE.MCVE Sketch
Per https://community.platformio.org/t/multiple-definition-of-ceill/22823.
src\main.cpp:
with
lib\buggy_lib\buggy_lib.h:
lib\buggy_lib\buggy_lib.cpp:
Result in PlatformIO:
Result in the Arduino IDE when the same library is also added in a new library folder:
The cause of this lies within the linking order of the libraries
libstdc++
andlibm
(libmath). The Arduino doesWhile PlatformIO, due to the
platformio-build.py
doing a simpleAppend()
to the end in regards to the libraries and not respecting the original position dicated by theplatform.txt
, doesA PR with a fix will follow soon.
Debug Messages
None relevant
The text was updated successfully, but these errors were encountered: