Error ld returned 1 exit status как исправить
Перейти к содержимому

Error ld returned 1 exit status как исправить

  • автор:

Ошибка при компиляции ld returned 1 exit status

Доброго времени суток! Вот тема: Ошибка при сборке тулчейна Этот компилятор(а именно g++) при компиляции выдаёт такое: /home/seiza/buildroot/build_mipsel/staging_dir/usr/bin/../lib/gcc/mipsel-linux-uclibc/4.2.1/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `_Unwind_Find_FDE’: /home/seiza/buildroot/toolchain_build_mipsel/gcc-4.2.1/gcc/unwind-dw2-fde-glibc.c:420: undefined reference to `dl_iterate_phdr’ collect2: ld returned 1 exit status

Что это такое и как это вылечить? Я знаю, что вы не экстросенсы, но я не знаю, что вам нужно, поэтому говорите, что предоставить и я это предоставлю. Спасибо.

dl_iterate_phdr — системный вызов

Если у тебя Ubuntu 9.10, то возможно ядро слишком старое и ещё не имеет такого API (соответственно линкер (ld) не может его найти).

Т.е. если можешь — обнови ядро. Или выключи компиляцию модуля, требующего этого API

dl_iterate_phdr — системный вызов. Т.е. если можешь — обнови ядро

Ну вы даёте. Какой-же это системный вызов. Вы не поверите, эта функция из ldso даже не вызывает ни один системный вызов!

"[Error] ld returned 1 exit status" постоянно, от разных реализаций функций, делающих скрин

Понадобилась функция, делающая скриншот в программе и сохраняющая его в файл. Я нашёл несколько таких функций, но каждая (!) из них при добавлении в программу заставляет её выдавать при компиляции вот такую ошибку:

C:\<папка_с_файлом.cpp>\collect2.exe [Error] ld returned 1 exit status

Причём других ошибок нет, или я их исправляю. Обычно такая ошибка происходит, когда у меня код уже скомпилирован и запущен .exe, и я пытаюсь ещё раз его скомпилировать и запустить. Но, разумеется, я всё перепробовал, даже запускал код на другом компе (но тоже в Dev) — такая же ошибка.

Если убрать эту функцию, то код снова нормально работает. Подскажите, что делать?

Вот текущий код с одним из вариантов функции, делающий скриншот:

ld returned 1 exit status обычно означает, что у Вас в коде есть недопустимые символы. Они могут там быть даже если их вроде и не видно, например, русская буква е от английской e на первый взгляд ничем не отличается. Обычно это результат копипасты. Так как функция небольшая, то самый простой вариант для Вас решить проблему — переписать ее (вернее, всю копипасту) руками.

Update Так же, проблемой может быть неподключенная библиотека. Нужно посмотреть по списку подключенных заголовочных файлов, к каким библиотекам они относятся и в натсройках проекта добавить все отсутствующие библиотеки.

Проблемой может быть и какой-то неподключенный заголовочный файл. Тут надо смотреть по названиям используемых функций и искать заголовки, где они объявлены.

PlatformIO :collect2.exe: error: ld returned 1 exit status

I am trying some library files for esp8266. I created hpp and .cpp files. But i try to compile program i got this error on VSCode. collect2.exe: error: ld returned 1 exit status *** [.pio\build\huzzah\firmware.elf] Error 1 I put files in src folder but still got this. What are points that i missed?

Sorry, i am new on stackexchange community so i can do basic mistakes about usage.

Now, i am adding my main.cpp,communication.cpp and communication.h files. As i said before, i didnt included neotimer and deleted. I used to add this library to my project, PIO library interface. I am thinking this problem coming from this. Great thanks for your patient and advises.

Dogan Cignakli's user avatar

1 Answer 1

The problem stems from the fact that the author of the Neotimer «library» defined the methods in the header file, see neotimer.h.

If you include this header in more than 1 source of your project, you will get these «multiple definition» errors.

To solve this issue you have (at least) these options:

  1. Make Neotimer a correct library with separated header and source files. Compile the source into a library file. Since I’m not experienced with Arduino I don’t know how other libraries do this.
    • Disadvantage: You’re messing with 3rd-party code. Commonly this is discouraged. You’ll have to maintain your copy of the library yourself, which renders some benefits of using libraries void.
  2. Don’t include neotimer.h in a header file of yours, include it only in one of your source files. If you need some declaration like the Neotimer type in other modules, add a forward declaration but don’t include its header file.
  3. Use another library that is better implemented.

You might say that you include neotimer.h in only one module. That’s wrong. You included it in your own header file communication.h , which you include in both source files. This way it sneaks into both modules. You can’t do anything about this with preprocessor «magic» because both modules are compiled independently from each other.

This is the class declaration of Neotimer as of 2020-01-12 18:40 UTC. Use as much as you need from it as forward declaration. You could even put this in decent header file.

How to install R version 3.2.1 – collect2: error: ld returned 1 exit status

followed by make command. But the following error is obtained.

Please help me to resolve this or let me know how to remove this specific version of R. Because when I run sudo apt-get —purge autoremove R ,

A.B.'s user avatar

2 Answers 2

For a full list of steps to install a version from source, skip the following lines and read on with Install from source

To install/remove the GNU R statistical computation and graphics system you need the package r-base .

To install/remove the GNU R collection of recommended packages you need r-recommended

Install from source

The version 3.2.1 is in the Wily Universe repositories.

To install the version 3.2.1 on older Ubuntu versions, you have to compile the packages for yourself

Download and extract

Create a Makefile with configure and enable shared libraries ( —enable-R-shlib ) and Tcl/TK-support ( —with-tcltk )

or simply with (without shared libraries )

And start the build process

After that, install. I prefer the installation with checkinstall , to create and install a deb package

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *