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
Normal Topic collect2.exe*: error: ld returned 1 exit status (Read 1695 times)
QtagRuler
Newbies
*
Offline


Posts: 4
Joined: May 31st, 2024
collect2.exe*: error: ld returned 1 exit status
May 31st, 2024 at 3:19pm
Print Post  
Hello, I am getting collect2.exe*: error: ld returned 1 exit status.

I have VStudio 2022, and using uPesy ESP32 Wroom DevKit. and serval libraries. 

This program used to work, I'm not sure if it was related to company using long name onedrive folders, or if it is library files messed up.  I've done a lot of things to this, since I first got this problem.  I have created all sorts of other problems along the way but now I made my way back to the beginning with just my first error. 

I attached my output, I have no idea how to sift through this hopefully someone can decipher this and help me get running again.
  

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


Posts: 2704
Joined: Feb 13th, 2019
Re: collect2.exe*: error: ld returned 1 exit status
Reply #1 - May 31st, 2024 at 4:00pm
Print Post  
Thanks for the report.

You have an SD Library in the below folder which is adding the -lsc element to the linker command:
C:\Users\jquinlan\Documents\Arduino\libraries\SD

In the library.properties folder of the above folder, there will be a line with ldflags=-lsc which is where the flag is being introduced from.

Can you confirm which SD Library and version this is so we can check whether this is correct?
  
Back to top
IP Logged
 
QtagRuler
Newbies
*
Offline


Posts: 4
Joined: May 31st, 2024
Re: collect2.exe*: error: ld returned 1 exit status
Reply #2 - May 31st, 2024 at 4:05pm
Print Post  
Thanks, I don't see the =-lsc in there but there is a =-lsd.  I attached the file.  Inside it says version 2.0.0
  

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


Posts: 2704
Joined: Feb 13th, 2019
Re: collect2.exe*: error: ld returned 1 exit status
Reply #3 - May 31st, 2024 at 4:20pm
Print Post  
Apologies, I meant -lsd as in the error message.

Can you confirm where you obtained the library from?

The library appears to be a modified version of the SD Library which is included in the Board Package, but not sure of the purpose of the modifications.

The flag is trying to reference the SD library (-l for library, then sd for the name), so in the C:\Users\jquinlan\Documents\Arduino\libraries\SD\src\esp32 folder there should be an libsd.a or libsd.so file, which is what the linker flag is referencing.

If you want to use the ESP32 Board Package Library, then you can just move the Sketchbook\libraries\SD folder out of the libraries folder, and after reloading the project it should use the board package library.
« Last Edit: May 31st, 2024 at 4:39pm by Simon@Visual Micro »  
Back to top
IP Logged
 
QtagRuler
Newbies
*
Offline


Posts: 4
Joined: May 31st, 2024
Re: collect2.exe*: error: ld returned 1 exit status
Reply #4 - May 31st, 2024 at 4:39pm
Print Post  
Thanks,

There is no folder " C:\Users\jquinlan\Documents\Arduino\libraries\SD\src\esp32"

There is  "C:\Users\jquinlan\Documents\Arduino\libraries\SD\src\esp32s3"

and it does contain a libSD.a file.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2704
Joined: Feb 13th, 2019
Re: collect2.exe*: error: ld returned 1 exit status
Reply #5 - May 31st, 2024 at 4:48pm
Print Post  
That means the SD library has been precompiled for the ESP32S3 MCU. but not the esp32 one (which 

If you definitely need to use the version in Sketchbook\libraries\SD. then comment out the precompiled and ldflags options in the library.properties file it should allow it to compile.

Alternatively moving/deleting the Sketchbook\libraries\SD folder and reloading the project should ensure it changes back to the library included and updated by the Board Package.

  
Back to top
IP Logged
 
QtagRuler
Newbies
*
Offline


Posts: 4
Joined: May 31st, 2024
Re: collect2.exe*: error: ld returned 1 exit status
Reply #6 - May 31st, 2024 at 4:57pm
Print Post  
You are Awesome!!! and Thank you.  This problem is solved. Cheesy
I removed the SD folder from C:\Users\jquinlan\Documents\Arduino\libraries\, rebuilt and it fully compiled!!

Can you tell me a search term or reference document I can read to learn more about what ever these types of errors are called?
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2704
Joined: Feb 13th, 2019
Re: collect2.exe*: error: ld returned 1 exit status
Reply #7 - May 31st, 2024 at 5:15pm
Print Post  
Glad you're up and running.

There is a lot of documentation about the speecific elements, however there is the added layer of the Arduino specification.....


The linker flag -lsd can be understood from generic gcc documentation (if you search the page for "-llibrary"), however the ESP32 uses a modified compiler for each MCU:
https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc/Link-Options.html

The library.properties file can be seen in the Arduino specification:
https://arduino.github.io/arduino-cli/0.34/library-specification/
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint