Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By jcmvbkbc
#40670
MartianMartin wrote:@jcmvbkbc I am using platformio for building and uploading. I have located the "espressif.py" build script which contains in it the lines:

Code: Select allLIBS=["c", "gcc", "phy", "pp", "net80211", "lwip", "wpa", "main",
              "json", "upgrade", "smartconfig", "pwm", "at", "ssl"],

which seems to be where I need to add a reference to the c++ standard library to get linked to. I have tried adding each of the following:
"lstdc++", "lsupc++" and "stdc++" to no avail. Am I editing the wrong file or using the wrong flags?

The place looks good and the flags for this place should read as "stdc++" and "supc++" respectively.
Do you observe any change of build output at all with these flags?
User avatar
By MartianMartin
#40750
jcmvbkbc wrote:
MartianMartin wrote:@jcmvbkbc I am using platformio for building and uploading. I have located the "espressif.py" build script which contains in it the lines:

Code: Select allLIBS=["c", "gcc", "phy", "pp", "net80211", "lwip", "wpa", "main",
              "json", "upgrade", "smartconfig", "pwm", "at", "ssl"],

which seems to be where I need to add a reference to the c++ standard library to get linked to. I have tried adding each of the following:
"lstdc++", "lsupc++" and "stdc++" to no avail. Am I editing the wrong file or using the wrong flags?

The place looks good and the flags for this place should read as "stdc++" and "supc++" respectively.
Do you observe any change of build output at all with these flags?


No change in the compiler output when I include "stdc++" and supc++" as follows:
Code: Select allLIBS=["c", "gcc", "phy", "pp", "net80211", "lwip", "wpa", "main",
              "json", "upgrade", "smartconfig", "pwm", "at", "ssl", "stdc++", "supc++"],

Searching through the compiler output, I cannot find any reference to stdc++ which makes me thing that the scripts that I modified is not being sourced, or a cached version is being used perhaps? I tried deleting the .pyc version of it so that it would recompile but it made no difference. In fact, it did not seem to recompile as there is simply no espressif.pyc in the Builder directory now, and the compiler error is same as before:
Code: Select all.pioenvs\esp12e\src\tmp_ino_to.o:(.text._ZNSt8_Rb_treeIiSt4pairIKiiESt10_Select1stIS2_ESt4lessIiESaIS2_EE24_M_get_insert_unique_posERS1_[_ZNSt8_Rb_treeIiSt4pairIKiiESt10_Select1stIS2_ESt4lessIiESaIS2_EE24_M_get_insert_unique_posERS1_]+0x0): undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
.pioenvs\esp12e\src\tmp_ino_to.o: In function `std::_Rb_tree<int, std::pair<int const, int>, std::_Select1st<std::pair<int const, int> >, std::less<int>, std::allocator<std::pair<int const, int> > >::_M_get_insert_unique_pos(int const&)':
tmp_ino_to.cpp:(.text._ZNSt8_Rb_treeIiSt4pairIKiiESt10_Select1stIS2_ESt4lessIiESaIS2_EE24_M_get_insert_unique_posERS1_[_ZNSt8_Rb_treeIiSt4pairIKiiESt10_Select1stIS2_ESt4lessIiESaIS2_EE24_M_get_insert_unique_posERS1_]+0x44): undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
.pioenvs\esp12e\src\tmp_ino_to.o:(.text._ZNSt8_Rb_treeIiSt4pairIKiiESt10_Select1stIS2_ESt4lessIiESaIS2_EE29_M_get_insert_hint_unique_posESt23_Rb_tree_const_iteratorIS2_ERS1_[_ZNSt8_Rb_treeIiSt4pairIKiiESt10_Select1stIS2_ESt4lessIiESaIS2_EE29_M_get_insert_hint_unique_posESt23_Rb_tree_const_iteratorIS2_ERS1_]+0x0): undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
.pioenvs\esp12e\src\tmp_ino_to.o: In function `std::_Rb_tree<int, std::pair<int const, int>, std::_Select1st<std::pair<int const, int> >, std::less<int>, std::allocator<std::pair<int const, int> > >::_M_get_insert_hint_unique_pos(std::_Rb_tree_const_iterator<std::pair<int const, int> >, int const&)':
tmp_ino_to.cpp:(.text._ZNSt8_Rb_treeIiSt4pairIKiiESt10_Select1stIS2_ESt4lessIiESaIS2_EE29_M_get_insert_hint_unique_posESt23_Rb_tree_const_iteratorIS2_ERS1_[_ZNSt8_Rb_treeIiSt4pairIKiiESt10_Select1stIS2_ESt4lessIiESaIS2_EE29_M_get_insert_hint_unique_posESt23_Rb_tree_const_iteratorIS2_ERS1_]+0x3e): undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
tmp_ino_to.cpp:(.text._ZNSt8_Rb_treeIiSt4pairIKiiESt10_Select1stIS2_ESt4lessIiESaIS2_EE29_M_get_insert_hint_unique_posESt23_Rb_tree_const_iteratorIS2_ERS1_[_ZNSt8_Rb_treeIiSt4pairIKiiESt10_Select1stIS2_ESt4lessIiESaIS2_EE29_M_get_insert_hint_unique_posESt23_Rb_tree_const_iteratorIS2_ERS1_]+0x66): undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
.pioenvs\esp12e\src\tmp_ino_to.o:(.text._Z21loadDefaultCommandMapv+0x0): undefined reference to `std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
.pioenvs\esp12e\src\tmp_ino_to.o: In function `loadDefaultCommandMap()':
tmp_ino_to.cpp:(.text._Z21loadDefaultCommandMapv+0x6c): undefined reference to `std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
collect2.exe: error: ld returned 1 exit status
scons: *** [.pioenvs\esp12e\firmware.elf] Error 1


I have tried manipulating the linking options in the platfomio.ini file as directed http://docs.platformio.org/en/latest/projectconf.html?highlight=linking#building-options, without success.
User avatar
By MartianMartin
#40751 I have confirmed that linking "stdc++" is indeed the issue by moving my sketch to the arduino IDE instead of platformIO, and added the linker flag as described here http://stackoverflow.com/questions/33450946/esp8266-for-arduino-ide-xtensa-lx106-elf-gcc-and-stdmap-linking-error, and it compiled successfully! I now need only to figure out how to do this using platformIO!
User avatar
By MartianMartin
#40836 The problem was an error in PlatformIO due to library linking order. One of the team members wrote a fix that will prsesumably be merged into the main distro soon. Details and link to working build are https://github.com/platformio/platformio/issues/503.