打印

求帮助

求帮助

[root@localhost saac]# make
gcc -O3 -w -I. -I./include   -c -o main.o main.c
gcc -O3 -w -I. -I./include   -c -o recv.o recv.c
gcc -O3 -w -I. -I./include   -c -o util.o util.c
gcc -O3 -w -I. -I./include   -c -o char.o char.c
gcc -O3 -w -I. -I./include   -c -o db.o db.c
gcc -O3 -w -I. -I./include   -c -o mail.o mail.c
gcc -O3 -w -I. -I./include   -c -o acfamily.o acfamily.c
gcc -O3 -w -I. -I./include   -c -o lock.o lock.c
gcc -O3 -w -I. -I./include   -c -o sasql.o sasql.c
gcc -O3 -w -I. -I./include   -c -o saacproto_serv.o saacproto_serv.c
gcc -O3 -w -I. -I./include   -c -o saacproto_util.o saacproto_util.c
gcc -O3 -w -I. -I./include -o saac main.o recv.o util.o char.o db.o mail.o acfamily.o lock.o sasql.o saacproto_serv.o saacproto_util.o -L /usr/lib/mysql/ -lmysqlclient -lz
/usr/bin/ld: cannot find -lz
collect2: ld 返回 1
make: *** [saac] 错误 1
[root@localhost saac]#

什么原因?

TOP

一下为makefile  你的意思是#加入mysql资料库功能
MYSQL=-L /usr/lib/mysql -lmysqlclient -lz -lm -I./
修改成
MYSQL=-L /usr/lib/mysql -lmysqlclient -lm -I./
也不行

export CC=gcc
export RM=rm -f
export AR=ar cr
export MV=mv
export RANLIB=ranlib
export SED=sed

export SHELL=/bin/sh

#
# Edit by ringo 19980606
# 19990723
#
#
#

INCFLAGS=-I. -I./include

CFLAGS=-O3 -w $(INCFLAGS)
#Pentium 4 (Intel)
#CFLAGS=-march=pentium4 -O3 -pipe -fomit-frame-pointer $(INCFLAGS)
#Athlon XP (AMD)
#CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" $(INCFLAGS)
#Athlon64:
#CFLAGS="-O2 -march=athlon64 -ftracer -fprefetch-loop-arrays -pipe" $(INCFLAGS)

#加入mysql资料库功能
MYSQL=-L /usr/lib/mysql -lmysqlclient -lz -lm -I./

TOP=../..
PROG = ./saacjt
SHELL = /bin/sh
PERL=/usr/bin/perl

RPCGEN=${TOP}/bin/lsgen.perl

RPCHTML = ${TOP}/doc/saacproto.html
#RPCSRC = saacproto_serv.c saacproto_util.csaacproto_sup.c
RPCSRC = saacproto_serv.c saacproto_util.c
RPCINCLUDE = saacproto_serv.h saacproto_util.h mac.h
RPCNOUSE = saacproto_cli.c saacproto_cli.h

#加入mysql资料库功能
SRC = main.c recv.c util.c char.c db.c mail.c acfamily.c lock.c sasql.c $(RPCSRC)
#SRC = main.c recv.c util.c char.c db.c mail.c acfamily.c lock.c $(RPCSRC)

OBJ=$(SRC:.c=.o)

${PROG} : $(RPCSRC) $(OBJ)
        $(CC) $(CFLAGS) -o $(PROG) $(OBJ) $(MYSQL)

dos2unix:
        dos2unix $(SRC) ./include/*.h makefile

chmod:
        chmod 777 $(SRC) ./include/*.h makefile

depend: $(RPCSRC) $(ANIMDATAFILE)
        $(MV) makefile makefile.bak
        $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile
        $(CC) $(INCFLAGS) -M $(SRC) >> makefile
       
clean:
        $(RM) $(PROG)
        $(RM) $(OBJ)
        $(RM) *~

distclean:
        $(RM) $(CLIRPCSRC)
        $(RM) $(CLIRPCINCLUDE)
        $(RM) $(SERVRPCSRC)
        $(RM) $(SERVRPCINCLUDE)
        $(RM) $(ANIMDATAFILE)
        $(RM) include/*~

        $(RM) $(PROG)
        $(RM) $(OBJ)
        $(RM) *~

        $(MV) Makefile Makefile.bak
        $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak>Makefile
        $(RM) Makefile.bak

rpc : ${RPCHTML} ${RPCGEN}
        $(PERL) ${RPCGEN} ${RPCHTML} -h . -o .
        rm -f ${RPCNOUSE}

[ 本帖最後由 囡囡 於 2012-11-1 11:45 編輯 ]

TOP

[root@localhost saac]# make
gcc -O3 -w -I. -I./include   -c -o main.o main.c
gcc -O3 -w -I. -I./include   -c -o recv.o recv.c
gcc -O3 -w -I. -I./include   -c -o util.o util.c
gcc -O3 -w -I. -I./include   -c -o char.o char.c
gcc -O3 -w -I. -I./include   -c -o db.o db.c
gcc -O3 -w -I. -I./include   -c -o mail.o mail.c
gcc -O3 -w -I. -I./include   -c -o acfamily.o acfamily.c
gcc -O3 -w -I. -I./include   -c -o lock.o lock.c
gcc -O3 -w -I. -I./include   -c -o sasql.o sasql.c
gcc -O3 -w -I. -I./include   -c -o saacproto_serv.o saacproto_serv.c
gcc -O3 -w -I. -I./include   -c -o saacproto_util.o saacproto_util.c
gcc -O3 -w -I. -I./include -o ./saacjt main.o recv.o util.o char.o db.o mail.o acfamily.o lock.o sasql.o saacproto_serv.o saacproto_util.o -L /usr/lib/mysql -lmysqlclient -lm -I./ <
/bin/sh: -c: line 0: syntax error near unexpected token `newline'
/bin/sh: -c: line 0: `gcc -O3 -w -I. -I./include -o ./saacjt main.o recv.o util.o char.o db.o mail.o acfamily.o lock.o sasql.o saacproto_serv.o saacproto_util.o -L /usr/lib/mysql -lmysqlclient -lm -I./ <'
make: *** [saacjt] 错误 2
[root@localhost saac]#

TOP

long 的 你有QQ吗?

TOP

可以了。是gcc版本问题 用的是os5.5  gcc 4.1   用redhat9 就可以了

TOP