make中未定义的引用

时间:2018-07-04 16:53:10

标签: c gnu-make

我在编译名为RNASalsa(源代码here)的程序时遇到了一些麻烦。 根据手册,我要做的就是下载tar.gz文件并执行

tar zxvf RNAsalsa_xxx.tar.gz
cd RNAsalsa_xxx
make

make的输出产生以下错误:

    gcc -O1 -DUNUSED='' -g -lm -o RNAsalsa  main.o  alifold.o  align.o  constraint.o  energy_par.o  fold.o  fold_vars.o  makeMx6.o  params.o  read_input.o  sequences.o  structaln.o  scoring10.o  multiple8.o  makeMx7.o  PS_dot.o  utilities.o  utils.o  naview.o  final_consensus.o
alifold.o: In function `alifold':
RNAsalsa_0.8.1/alifold.c:186: undefined reference to `HairpinE'
RNAsalsa_0.8.1/alifold.c:203: undefined reference to `LoopEnergy'
RNAsalsa_0.8.1/alifold.c:465: undefined reference to `HairpinE'
RNAsalsa_0.8.1/alifold.c:479: undefined reference to `LoopEnergy'
fold.o: In function `ML_Energy':
RNAsalsa_0.8.1/fold.c:1242: undefined reference to `log'
fold.o: In function `HairpinE':
RNAsalsa_0.8.1/fold.c:789: undefined reference to `log'
fold.o: In function `LoopEnergy':
RNAsalsa_0.8.1/fold.c:869: undefined reference to `log'
RNAsalsa_0.8.1/fold.c:893: undefined reference to `log'
fold.o: In function `HairpinE':
RNAsalsa_0.8.1/fold.c:789: undefined reference to `log'
PS_dot.o: In function `PS_color_dot_plot':
RNAsalsa_0.8.1/PS_dot.c:764: undefined reference to `sqrt'
PS_dot.o: In function `simple_xy_coordinates':
RNAsalsa_0.8.1/PS_dot.c:805: undefined reference to `sincos'
PS_dot.o: In function `PS_dot_plot_list':
RNAsalsa_0.8.1/PS_dot.c:908: undefined reference to `sqrt'
PS_dot.o: In function `PS_color_dot_plot_turn':
RNAsalsa_0.8.1/PS_dot.c:997: undefined reference to `sqrt'
PS_dot.o: In function `PS_dot_plot_turn':
RNAsalsa_0.8.1/PS_dot.c:1027: undefined reference to `sqrt'
naview.o: In function `construct_circle_segment':
RNAsalsa_0.8.1/naview.c:981: undefined reference to `sqrt'
naview.o: In function `find_center_for_arc':
RNAsalsa_0.8.1/naview.c:1123: undefined reference to `sqrt'
RNAsalsa_0.8.1/naview.c:1130: undefined reference to `acos'
RNAsalsa_0.8.1/naview.c:1132: undefined reference to `acos'
naview.o: In function `construct_circle_segment':
RNAsalsa_0.8.1/naview.c:1006: undefined reference to `sqrt'
RNAsalsa_0.8.1/naview.c:1007: undefined reference to `atan2'
RNAsalsa_0.8.1/naview.c:1011: undefined reference to `sincos'
naview.o: In function `traverse_loop':
RNAsalsa_0.8.1/naview.c:467: undefined reference to `sincos'
RNAsalsa_0.8.1/naview.c:467: undefined reference to `sincos'
RNAsalsa_0.8.1/naview.c:463: undefined reference to `sqrt'
RNAsalsa_0.8.1/naview.c:466: undefined reference to `atan2'
RNAsalsa_0.8.1/naview.c:586: undefined reference to `asin'
RNAsalsa_0.8.1/naview.c:586: undefined reference to `sincos'
RNAsalsa_0.8.1/naview.c:587: undefined reference to `asin'
RNAsalsa_0.8.1/naview.c:587: undefined reference to `sincos'
RNAsalsa_0.8.1/naview.c:601: undefined reference to `sincos'
RNAsalsa_0.8.1/naview.c:628: undefined reference to `sincos'
RNAsalsa_0.8.1/naview.c:685: undefined reference to `sqrt'
RNAsalsa_0.8.1/naview.c:690: undefined reference to `sqrt'
RNAsalsa_0.8.1/naview.c:696: undefined reference to `sqrt'
RNAsalsa_0.8.1/naview.c:704: undefined reference to `atan2'
RNAsalsa_0.8.1/naview.c:708: undefined reference to `atan2'
RNAsalsa_0.8.1/naview.c:742: undefined reference to `sqrt'
RNAsalsa_0.8.1/naview.c:743: undefined reference to `atan2'
RNAsalsa_0.8.1/naview.c:747: undefined reference to `sqrt'
RNAsalsa_0.8.1/naview.c:748: undefined reference to `atan2'
naview.o: In function `construct_extruded_segment':
RNAsalsa_0.8.1/naview.c:1046: undefined reference to `sqrt'
RNAsalsa_0.8.1/naview.c:1068: undefined reference to `atan2'
RNAsalsa_0.8.1/naview.c:1077: undefined reference to `atan2'
RNAsalsa_0.8.1/naview.c:1083: undefined reference to `sincos'
RNAsalsa_0.8.1/naview.c:1087: undefined reference to `sincos'
naview.o: In function `traverse_loop':
RNAsalsa_0.8.1/naview.c:774: undefined reference to `sincos'
collect2: error: ld returned 1 exit status

因此,似乎在调用某些函数的顺序上有问题。例如,函数“ alifold”在定义此函数之前对“ HairpinE”具有未定义的引用。 另外,对“ log”和“ sqrt”的未定义引用暗示它未能包含“ math.h”(是,.c文件中包含“ include”)。

有什么想法可能会发生这种情况吗? 开发人员给出的makefile如下:

EXE     = RNAsalsa
CC      = gcc
LL      = gcc
VERSION = 0.8.1
DISTNAME= RNAsalsa_0.8.1
CCFLAGS = -O1 -DUNUSED='' -g
LIBS    = -lm
INCS    = alifold.h energy_const.h \
          energy_par.h fold.h fold_vars.h intloops.h \
          pair_mat.h params.h scoretable.h \
          utils.h circfold.inc PS_dot.h structs.h
SRCS    = main.c alifold.c align.c constraint.c energy_par.c fold.c \
          fold_vars.c makeMx6.c params.c read_input.c sequences.c \
          structaln.c scoring10.c multiple8.c makeMx7.c PS_dot.c\
          utilities.c utils.c naview.c final_consensus.c
OBJS    = $(foreach file, $(SRCS:.c=.o), $(file))
all: $(EXE)
$(EXE): $(OBJS)
        $(LL) $(CCFLAGS) $(LIBS) -o $(EXE) $(OBJS)
$(OBJS): %.o: %.c
        $(CC) -c $(CCFLAGS) $< -o $@
veryclean:
        rm -f $(OBJS) $(EXE)
clean:
        rm -f $(OBJS) core

我正在使用gcc 5.4.0,在ubuntu 16.04.1中,已安装build-essential

预先感谢

0 个答案:

没有答案