Star Hype News.

Premium celebrity moments with standout appeal.

news

collect2: error: ld returned 1 exit status

By Daniel Johnston

I want to install nexalign (can be downloaded from here) on ubuntu 13.10. I previously installed it on ubuntu 10 without any problem. The error I got is:

gcc -O9 -Wall -Dthread -lpthread main.o mapping.o interface.o input.o sarray.o mem.o output.o pattern_searching.o pattern_searching_solid.o string_matching.o time.o misc.o bt.o mapping_output.o hash.o r_output.o mapping_solid.o pattern_searching_short.o sort_mapping.o cluster_mapping.o -o nexalign
mapping.o: In function `mapping':
mapping.c:(.text+0x21e): undefined reference to `pthread_create'
mapping.c:(.text+0x276): undefined reference to `pthread_join'
mapping.c:(.text+0x410): undefined reference to `pthread_create'
mapping.c:(.text+0x65e): undefined reference to `pthread_create'
mapping_solid.o: In function `mapping_solid':
mapping_solid.c:(.text+0x1f4): undefined reference to `pthread_create'
mapping_solid.c:(.text+0x23b): undefined reference to `pthread_join'
mapping_solid.c:(.text+0x3dc): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
make: *** [all] Error 1

When I change the 5th line (LD = -lpthread as LD = -l) in make file the program was installed without any errors. I have basic knowledge in C/C++.

Do I miss anything by converting the 5th line to "LD = -l"? Or do you have any suggestions?

I searched "ask ubuntu portal" to find answer, but I did not get a helpful one.

thanks.

1 Answer

-lpthread is an option to specify linking against the posix thread library. If your compilation works without specifying that library, it is probably included by default already, so you don't "miss" anything.

According to this, your original makefile is probably incorrect, that is why you get the error message.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy