Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

collect2.exe: error: ld returned 5 exit status

Tags:

c++

dll

msys2

qt5

I've recently updated all msys2 packages and now I can't build my project. The error occurs at the moment of linking one of .dlls - target_library.dll.

The error message isn't clear to me. What does status 5 mean?

collect2.exe: error: ld returned 5 exit status

Full message:

g++ -Wl,-s,--relax,--gc-sections -shared -Wl,-subsystem,windows -mthreads -Wl,--out-implib,C:/msys64/workspace/Project_Root_Directory/project/src/../build/release/plugins/libtarget_library.dll.a -o ../../../../build/release/plugins/target_library.dll object_script.target_library.Release  -lglu32 -lopengl32 -luser32 -LC:/msys64/workspace/Project_Root_Directory/project/build/release -LC:/msys64/workspace/Project_Root_Directory/project/third-party/out/lib -LC:/msys64/workspace/Project_Root_Directory/project/deps/lib -lexif -ldecimal -lsqlite3 -lutils -LC:/Python35/libs -lpython35 -lkmlbase -lkmlengine -lkmldom -lkmlxsd -lminizip -luriparser -lkmlconvenience -lcore -lrender -lraster -lgui -LC:/msys64/workspace/Project_Root_Directory/project/deps/lib/target_library/win64 -LC:/msys64/mingw64/lib  C:/msys64/mingw64/lib/libQt5Widgets.dll.a C:/msys64/mingw64/lib/libQt5WinExtras.dll.a C:/msys64/mingw64/lib/libQt5Gui.dll.a C:/msys64/mingw64/lib/libQt5Network.dll.a C:/msys64/mingw64/lib/libQt5Concurrent.dll.a C:/msys64/mingw64/lib/libQt5Xml.dll.a C:/msys64/mingw64/lib/libQt5Core.dll.a

collect2.exe: error: ld returned 5 exit status
make[4]: *** [Makefile.Release:159: ../../../../build/release/plugins/target_library.dll] Error 1
make[4]: Leaving directory '/workspace/Project_Root_Directory/project/src/modules/plugins/target_library'
make[3]: Leaving directory '/workspace/Project_Root_Directory/project/src/modules/plugins/target_library'
make[2]: *** [Makefile:384: sub-target_library-make_first] Error 2
make[2]: Leaving directory '/workspace/Project_Root_Directory/project/src/modules/plugins'
make[1]: *** [Makefile:297: sub-plugins-make_first] Error 2
make[1]: Leaving directory '/workspace/Project_Root_Directory/project/src/modules'
make: *** [Makefile:44: sub-modules-make_first] Error 2

gcc 7.1.0, Qt5 5.9.1, qmake, Win7 x64

like image 929
Andrew Smeltzov Avatar asked Jul 13 '17 10:07

Andrew Smeltzov


People also ask

What is collect2 exe error ld returned 1 exit status?

The ld returned 1 exit status error is the consequence of your previous errors as in your example there is an earlier error - undefined reference to 'clrscr' - and this is the real one. The exit status error just signals that the linking step in the build process encountered some errors.

What is collect2 exe error?

In most cases, collect2.exe runtime errors occurring while the program is running will result in the program terminating abnormally. Most of these collect2.exe error messages mean that C-Free was either unable to locate this file on startup, or the file is corrupt, resulting in a prematurely-aborted startup process.

How fix ld returned 1 exit status in Dev C++?

The collect2: error: ld returned 1 exit status error message is easily fixed by removing an existing executable file inside your document. It is possible to remove the existing file that is running in the background by accessing the thread tools inside your system.

What is error ID returned 1 exit status?

The C++ [Error]: Id returned 1 exit status is not a common error. It usually means that the program crashed, and it will be challenging to determine why without looking at the stack trace. The C++ compiler will display this message when an error occurs in your code.


1 Answers

Just in case someone finds this due the same problem, please, add the following flag to your compiler -Wl,--verbose (or --verbose to the linker). This will show which library was not found or give you more information about the problem.

like image 141
Rafael S. T. Vieira Avatar answered Sep 21 '22 11:09

Rafael S. T. Vieira