在Postgresql上用C实现MD5 - 引用错误

时间:2014-04-11 11:13:29

标签: c linux postgresql md5

我遇到了一个非常常见的错误。但是,我在线查看了多个类似的问题,并通过在-lcrypto -lssl的末尾添加gcc来尝试链接过程。但是,每次我们跑步时,我仍然会得到:" Undefined reference to MD5"。我使用MD5作为哈希函数。我们使用库,我们将它包含在我称之为程序的标题中。任何见解都会非常棒! makefile的代码如下:

CPP=gcc
OPTS= -Wall
#OPTS=-g -Wall
#-lcrypto and -lssl being added below 
LIBS=-lresolv -ldl -lm -lcrypto -lssl 
# Modify PSQLPATH if necesssary
#PSQLPATH=/home/alice/postgresql-9.3.2
PSQLPATH=/home/a/ambangra/postgresql-9.3.2
INCLUDE=-I$(PSQLPATH)/src/include     

# compiles your modified version of postgresql code 
assign2c: copyassign2 compile

# installs your modified version of postgresql code 
assign2i: copyassign2 install

# restores original version of postgresql code
restore: copyoriginal install

copyassign2:
    cp guc.c $(PSQLPATH)/src/backend/utils/misc/guc.c
    cp globals.c $(PSQLPATH)/src/backend/utils/init/globals.c
    cp hashjoin.h $(PSQLPATH)/src/include/executor/hashjoin.h
    cp nodeHash.c $(PSQLPATH)/src/backend/executor/nodeHash.c
    cp nodeHashjoin.c $(PSQLPATH)/src/backend/executor/nodeHashjoin.c
    cp explain.c $(PSQLPATH)/src/backend/commands/explain.c

copyoriginal:
    cp Original-files/guc.c $(PSQLPATH)/src/backend/utils/misc/guc.c
    cp Original-files/globals.c $(PSQLPATH)/src/backend/utils/init/globals.c
    cp Original-files/hashjoin.h $(PSQLPATH)/src/include/executor/hashjoin.h
    cp Original-files/nodeHash.c $(PSQLPATH)/src/backend/executor/nodeHash.c
    cp Original-files/nodeHashjoin.c $(PSQLPATH)/src/backend/executor/nodeHashjoin.c
    cp Original-files/explain.c $(PSQLPATH)/src/backend/commands/explain.c

compile:
    cd $(PSQLPATH) && make 

install:
    cd $(PSQLPATH) && make && make install

clean:
    rm -f *.o

0 个答案:

没有答案