collect2: 错误:ld 返回 1 退出状态

我想在Ubuntu 13.10上安装nexalign(可以从这里下载)。之前我在Ubuntu 10上安装它时没有遇到任何问题。我收到的错误信息是:
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

当我在make文件中将第5行(LD = -lpthread)更改为LD = -l时,程序安装时没有出现任何错误。我对C/C++有基本的了解。
通过将第5行转换为“LD = -l”,我是否错过了什么?或者你有什么建议吗?
我搜索了“ask ubuntu portal”以寻找答案,但没有得到有用的回答。
谢谢。
1个回答

-lpthread是一个选项,用于指定链接到posix线程库。如果您的编译在没有指定该库的情况下工作正常,那么它可能已经默认包含了,所以您不会“错过”任何东西。
根据this的说法,您的原始makefile可能是错误的,这就是为什么您会收到错误消息的原因。