Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Strange linker errors for NodeMCU 1.0(ESP 12E) (Read 9626 times)
Bas
Junior Member
**
Offline


Posts: 50
Joined: Feb 20th, 2017
Strange linker errors for NodeMCU 1.0(ESP 12E)
May 15th, 2017 at 7:51pm
Print Post  
We were successfully developing our sketch using a Arduino Mega until we ran into memory problems.
To solve this structurally we are experimenting with a second board and split the functionality across the two boards, using SPI to have the master board request sensor information from the Slave board.

First tests with a ESP8266 NodeMCU board looked promissing, but now we're running into problems with getting the code that run flawlesly on the Mega to compile on the NodeMCU.

I've installed the board with VisualMicro, cerated a new solution and project using this board and started adding code from  the Mega. Now we're getting many errors like:

- section .text will not fit in region iram1_0_seg
- undefined reference to setlocale
- etc... (see below for a copy of part of the build result)

I've tried updating the board software from the github repo bu that didnt change the result
I'm reading that there is something with the .ld file but I have no clue what they are talking about and wether or not this can also be the cause when using VisualMicro to build the solution.

Can anybody help me getting this NodeMCU sketch to compile?

Quote:
Compiling debug version of 'CSenseMaster' for 'NodeMCU 1.0 (ESP-12E Module)'
Build Folder: Debug
ld.exe: 
enseMaster.ino.elf section .text will not fit in region iram1_0_seg

libstdc++.a(locale-inst.o)*: (.literal._ZSt16__convert_from_vRKPiPciPKcz[_ZSt16__convert_from_vRKPiPciPKcz]+0x4): undefined reference to setlocale
libstdc++.a(locale-inst.o)*: (.literal._ZSt16__convert_from_vRKPiPciPKcz[_ZSt16__convert_from_vRKPiPciPKcz]+0xc): undefined reference to vsprintf
libstdc++.a(locale-inst.o)*: (.literal._ZSt9use_facetISt5ctypeIcEERKT_RKSt6locale[_ZSt9use_facetISt5ctypeIcEERKT_RKSt6locale]+0x4): undefined reference to std::__throw_bad_cast()
libstdc++.a(locale-inst.o)*: rt_floatIdEES3_S3_RSt8ios_baseccT_[_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES3_S3_RSt8ios_baseccT_]+0x0): undefined reference to memchr
 
libstdc++.a(locale-inst.o)*: In function std::__convert_from_v(int* const&, char*, int, char const*, ...)
locale_classes.tcc*:114: undefined reference to setlocale
locale_classes.tcc*:114: undefined reference to setlocale
locale_classes.tcc*:114: undefined reference to vsprintf
locale_classes.tcc*:114: undefined reference to setlocale
 
libstdc++.a(locale-inst.o)*: In function std::ctype<char> const& std::use_facet<std::ctype<char> >(std::locale const&)
locale_classes.tcc*:114: __throw_bad_cast()
 
libstdc++.a(locale-inst.o)*: In function std::numpunct<char> const& std::use_facet<std::numpunct<char> >(std::locale const&)
locale_classes.tcc*:114: __throw_bad_cast()
 
libstdc++.a(locale-inst.o)*: In function std::num_put<char, std:Shockedstreambuf_iterator<char, std::char_traits<char> > > const& std::use_facet<std::num_put<char, std:Shockedstreambuf_iterator<char, std::char_traits<char> > > >(std::locale const&)
locale_classes.tcc*:114: __throw_bad_cast()
 
libstdc++.a(locale-inst.o)*: In function std::num_get<char, std::istreambuf_iterator<char, std::char_traits<char> > > const& std::use_facet<std::num_get<char, std::istreambuf_iterator<char, std::char_traits<char> > > >(std::locale const&)
locale_classes.tcc*:114: __throw_bad_cast()
 
libstdc++.a(locale-inst.o)*: In function std::moneypunct<char, true> const& std::use_facet<std::moneypunct<char, true> >(std::locale const&)
locale_classes.tcc*:114: __throw_bad_cast()
libstdc++.a(locale-inst.o)*: -gcc-final\xtensa-lx106-elf\libstdc++-v3\include\bits\locale_classes.tcc:114: more undefined references to std::__throw_bad_cast() follow
 
libstdc++.a(locale-inst.o)*: In function std:Shockedstreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std:Shockedstreambuf_iterator<char, std::char_traits<char> > >::_M_insert_float<double>(std:Shockedstreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, char, double) const
locale_classes.tcc*:114: undefined reference to memchr

........ (clipped)

« Last Edit: May 15th, 2017 at 7:52pm by Bas »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Strange linker errors for NodeMCU 1.0(ESP 12E)
Reply #1 - May 15th, 2017 at 7:56pm
Print Post  
Hi,

You can attach output as .txt instead of splitting in posts. Also switching on vmicro>compiler>verbose and "show build properties" will show in the output what you have installed.

You should be installing the esp core via the Board Manager, either in the arduino ide or in visual micro.

I think the latest board manager core is 2.3.0 or 2.0.3 I can't recall.

Don;t forget to remove anything you have installed for esp so we don't have multiple defs.
  
Back to top
WWW  
IP Logged
 
Bas
Junior Member
**
Offline


Posts: 50
Joined: Feb 20th, 2017
Re: Strange linker errors for NodeMCU 1.0(ESP 12E)
Reply #2 - May 15th, 2017 at 8:03pm
Print Post  
Here the requested full build log, with debug verbose and "Build options" on.

The github site https://github.com/esp8266/Arduino has 2.3.0 as the latest version
« Last Edit: May 15th, 2017 at 8:04pm by Bas »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Strange linker errors for NodeMCU 1.0(ESP 12E)
Reply #3 - May 15th, 2017 at 8:13pm
Print Post  
Does it build in the arduino ide?
  
Back to top
WWW  
IP Logged
 
Bas
Junior Member
**
Offline


Posts: 50
Joined: Feb 20th, 2017
Re: Strange linker errors for NodeMCU 1.0(ESP 12E)
Reply #4 - May 15th, 2017 at 8:17pm
Print Post  
I havent got the Arduino IDE installed, because having it alongside VisualStudio really confused me in terms of where libraries were found etc
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Strange linker errors for NodeMCU 1.0(ESP 12E)
Reply #5 - May 15th, 2017 at 8:20pm
Print Post  
I still think you need to use board manager to install and not github.

I can see the error is reported on git, something to do with older linker being used by the git version.

You will find the esp package at the top of the visual micro board manager "auto discovery list". I suggest removing the current package, restarting the ide and then installing via board manager. At least we should then be in a known test scenario.
  
Back to top
WWW  
IP Logged
 
Bas
Junior Member
**
Offline


Posts: 50
Joined: Feb 20th, 2017
Re: Strange linker errors for NodeMCU 1.0(ESP 12E)
Reply #6 - May 15th, 2017 at 8:33pm
Print Post  
Removed and reinstalled the ESP boards (see attached screenshot)

Compiling now halts on something it cannot find:

  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Bas
Junior Member
**
Offline


Posts: 50
Joined: Feb 20th, 2017
Re: Strange linker errors for NodeMCU 1.0(ESP 12E)
Reply #7 - May 15th, 2017 at 8:33pm
Print Post  
The build log
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Strange linker errors for NodeMCU 1.0(ESP 12E)
Reply #8 - May 15th, 2017 at 8:36pm
Print Post  
We use the SharpZip lib from git to expand board manager packages. Sometimes the esp8266 can be a problem.

You can have an arduino ide installed but you don't have to tell visual micro about it. If you use the board manager in the arduino ide to remove and then install the esp8266 it will be better.

Info

In the arduino ide you have to add the .json file to the esp8266 index via "file>preferences>contributions/package urls". if you don't know the url you will find it in the visual micro "IDE locations" window. Clicking the auto discovery list and adding board support simply adds the .json url to the list.
  
Back to top
WWW  
IP Logged
 
Bas
Junior Member
**
Offline


Posts: 50
Joined: Feb 20th, 2017
Re: Strange linker errors for NodeMCU 1.0(ESP 12E)
Reply #9 - May 15th, 2017 at 9:06pm
Print Post  
- Removed ESP from within VisualStudio
- Removed remaining folder structure in %Appdata%\Local\packages\arduino15
- Installed Arduino IDE
- Added ESP boards from within IDE using http://arduino.esp8266.com/stable/package_esp8266com_index.json
- Open visual studio, checked folder used for all external dependencies 
- Build in visual studio.... same result Sad (See log file attached)

- I dread building in the Arduino IDE because I'm using several self made libraries in various folder and remember having a terrible fight with the Arduino IDE to have it use the correct libs 




  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Strange linker errors for NodeMCU 1.0(ESP 12E)
Reply #10 - May 15th, 2017 at 9:28pm
Print Post  
The output shows this:-

  D:\Development\CSense\C-Sense2.0\source\libraries\SenseFramework\src
  D:\Development\CSense\C-Sense2.0\source\libraries\Nextion

If you have added shared libraries to the project then you must ensure they have a libraries.properties file in their roots. Otherwise they will be treated as project code with unpredictable results.

If they have library.properties then ignore this post

« Last Edit: May 15th, 2017 at 9:29pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Bas
Junior Member
**
Offline


Posts: 50
Joined: Feb 20th, 2017
Re: Strange linker errors for NodeMCU 1.0(ESP 12E)
Reply #11 - May 16th, 2017 at 6:43am
Print Post  
Ok, managed to get it compiling in the iDE. Had to move lots of code and libraries that are not used in the is project aside.

The result is the same:
- section `.text' will not fit in region `iram1_0_seg'
- undefined reference to `setlocale'

etc


So its not so much VisualMicro obviously.

Will you still be able to help me solving this?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Strange linker errors for NodeMCU 1.0(ESP 12E)
Reply #12 - May 16th, 2017 at 12:22pm
Print Post  
I would if I could. I think you will need to use google.

I did find this with similar error. Does the solution relate to your code?

http://stackoverflow.com/questions/41378849/linking-error-using-arduino-library-...
  
Back to top
WWW  
IP Logged
 
Bas
Junior Member
**
Offline


Posts: 50
Joined: Feb 20th, 2017
Re: Strange linker errors for NodeMCU 1.0(ESP 12E)
Reply #13 - May 16th, 2017 at 7:57pm
Print Post  
I finally solved it ...!!

Turns out I used #include <iostream> somewhere (which wasnt even needed) and this caused the errors
Your link to stackoverflow got me looking in the right direction, thanks!

Removing the include made it compile and link again
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Strange linker errors for NodeMCU 1.0(ESP 12E)
Reply #14 - May 16th, 2017 at 7:58pm
Print Post  
Great, well done. Linker errors can be tricky, thanks for the update.
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint