linux下运行make,出现错误cannot find -lcurl

qq_17299675 2015-08-10 06:15:14
错误如下

/usr/bin/ld: cannot find -lcurl
collect2: ld returned 1 exit status
make: *** [bin/mod_billing.so] Error 1

这是一个服务器的源代码
我把Makefile文件如下
源代码我传云盘上
链接:http://pan.baidu.com/s/1bnkAyNt 密码:c7cu

.PHONY: all clean cleanall res thirdlib
#-Wpointer-arith -Winline
CFLAGS=-g -Wall -Wno-deprecated -Werror
SHARED=-fPIC -shared

bin_dir=bin
mod_dir=mod
#mod_src=$(wildcard $(mod_dir)/*.c)
#mod_so=$(patsubst %.c,%.so,$(notdir $(mod_src)))

LDFLAGS=-Wl,-rpath,. -Lbin

base_src=\
base/freeid.h \
base/hashid.h \
base/stringtable.h \
base/args.c \
base/args.h \
base/gen_uuid.c \
base/pack.c \
base/unpack.c \
base/uuid.h \
base/util.c \
base/util.h

mod_so=\
$(bin_dir)/mod_echo.so \
$(bin_dir)/mod_gate.so \
$(bin_dir)/mod_cmds.so \
$(bin_dir)/mod_cmdctl.so \
$(bin_dir)/mod_keepalivec.so \
$(bin_dir)/mod_keepalived.so

all_t=\
$(bin_dir)/libbase.so \
$(bin_dir)/libtinyxml.so \
$(mod_so) \
$(bin_dir)/mod_robotcli.so \
$(bin_dir)/mod_billing.so \
$(bin_dir)/mod_db.so \
$(bin_dir)/mod_game.so

all: $(all_t)

release: CFLAGS += -O2 -fno-strict-aliasing
release: all

$(bin_dir)/libbase.so: $(base_src)
@rm -f $@
gcc $(CFLAGS) $(SHARED) -o $@ $^ -DHAVE_STDLIB_H -DHAVE_UNISTD_H -DHAVE_GETRLIMIT

$(mod_so): $(bin_dir)/%.so: $(mod_dir)/%.c
@rm -f $@
gcc $(CFLAGS) $(SHARED) -o $@ $< -Iinclude/libshaco -Inet -Ibase -Imsg

$(bin_dir)/mod_test.so: $(mod_dir)/mod_test.cpp
@rm -f $@
gcc $(CFLAGS) $(SHARED) -o $@ $^ -Iinclude/libshaco -Inet -Ibase -Imsg -Iworld

$(bin_dir)/mod_billing.so: $(mod_dir)/mod_billing.cpp
@rm -f $@
g++ $(CFLAGS) $(SHARED) -o $@ $^ -Iinclude/libshaco -Inet -Ibase -Imod -Imsg -Imsg/Message -I3rd/curl $(LDFLAGS) -lcurl

$(bin_dir)/mod_db.so: $(mod_dir)/mod_db.cpp \
mod_db/db.h \
mod_db/db_game.cpp \
mod_db/db_log.cpp \
mod_db/db_server_note.cpp \
mod_db/CMysql.cpp \
mod_db/CMysql.h \
mod_db/GlobalUtilityFunction.cpp \
mod_db/GlobalUtilityFunction.h
@rm -f $@
g++ $(CFLAGS) $(SHARED) -o $@ $^ -Iinclude/libshaco -Inet -Ibase -Imod -Imsg -Imsg/Message -Imod_db -I3rd/mysql -I3rd/mysql/mysql++ -I3rd $(LDFLAGS) -lmysqlpp

GAME_INC_PATH :=\
-Iinclude/libshaco -Inet -Ibase -Itplt -Imod -Imsg -Imsg/Message -Imod_game -I3rd -I3rd/tinyXml -Imsg/iconv -Idatadefine -Ipersist

OBJS = $(patsubst mod_game/%.cpp,mod_game/%.o,$(wildcard mod_game/*.cpp))
$(OBJS): mod_game/%.o: mod_game/%.cpp
g++ -o $@ -c $(CFLAGS) -fPIC $(GAME_INC_PATH) $<

$(mod_dir)/mod_game.o: $(mod_dir)/mod_game.cpp
g++ -o $@ -c $(CFLAGS) -fPIC $(GAME_INC_PATH) $<

persist/mysqlc.o: persist/mysqlc.c persist/mysqlc.h
g++ -o $@ -c $(CFLAGS) -fPIC $(GAME_INC_PATH) $<

$(bin_dir)/mod_game.so: $(OBJS) $(mod_dir)/mod_game.o persist/mysqlc.o
@rm -rf $@
g++ $(CFLAGS) $(SHARED) -o $@ $^ $(GAME_INC_PATH) $(LDFLAGS) -liconv -ltplt -ltinyxml -lbase -lmysqlclient

#$(bin_dir)/mod_game.so :$(mod_dir)/mod_game.cpp \
#mod_game/game_tplt.cpp \
#mod_game/game_tplt.h \
#mod_game/game_cmdctl.cpp \
#mod_game/game_cmdctl.h \
#mod_game/UserMgr.cpp \
#mod_game/handle_db.cpp \
#mod_game/handle_gate.cpp \
#mod_game/UserMgr.h \
#mod_game/GameLineMgr.cpp \
#mod_game/TowerMgr.cpp \
#mod_game/TeamMgr.cpp \
#mod_game/SweepMgr.cpp \
#mod_game/RankMgr.cpp \
#mod_game/User.cpp \
#mod_game/SkillMgr.cpp \
#mod_game/Role_MsgSender.cpp \
#mod_game/Role_GCAskHandler.cpp \
#mod_game/Scene.h \
#mod_game/Scene.cpp \
#mod_game/FuncOpenMgr.cpp \
#mod_game/WorldBossActivitySingleton.cpp \
#mod_game/Role.cpp \
#mod_game/Team.cpp \
#mod_game/WorldBossActivity.cpp \
#mod_game/ActivityBase.cpp \
#mod_game/GMCmd.cpp \
#mod_game/Role.h \
#mod_game/User.h \
#mod_game/GuildNetMsg.cpp \
#mod_game/game_api.h \
#mod_game/game_api.cpp \
#mod_game/game.h \
#mod_game/handle_billing.cpp \
#mod_game/TeamMgr.h \
#mod_game/ActivityMgr.cpp \
#mod_game/role_cache.h \
#mod_game/RankMgr.h \
#mod_game/role_cache.cpp \
#mod_game/handle_db.h \
#mod_game/GuildMgr.h \
#mod_game/FriendListMgr.cpp \
#mod_game/ArenaMgr.cpp \
#mod_game/GlobalUtilityFunction.h \
#mod_game/GlobalUtilityFunction.cpp \
#mod_game/GuildMemberMgr.cpp \
#mod_game/XuanShang.cpp \
#mod_game/WorldBoss.cpp \
#mod_game/WingMgr.cpp \
#mod_game/VIPMgr.cpp \
#mod_game/TemplateMgr.cpp \
#mod_game/TeamMember.cpp \
#mod_game/TaskMgr.cpp \
#mod_game/StateMachine.cpp \
#mod_game/State.cpp \
#mod_game/SceneMgr.cpp \
#mod_game/PetManager.cpp \
#mod_game/NPC.cpp \
#mod_game/MonsterStateMachine.cpp \
#mod_game/MonsterState.cpp \
#mod_game/MonsterMgr.cpp \
#mod_game/Monster.cpp \
#mod_game/MedalMgr.cpp \
#mod_game/ItemMgr.cpp \
#mod_game/GuildMgr.cpp \
#mod_game/GemMgr.cpp \
#mod_game/FightReferee.cpp \
#mod_game/FightMgr.cpp \
#mod_game/EquipMgr.cpp \
#mod_game/handle_billing.h \
#mod_game/handle_gate.h \
#mod_game/ActivityMgr.h \
#mod_game/ActivityBase.h \
#mod_game/FightMgr.h \
#mod_game/MedalMgr.h \
#mod_game/MonsterState.h \
#mod_game/TowerMgr.h \
#mod_game/ArenaMgr.h \
#mod_game/EquipMgr.h \
#mod_game/FightReferee.h \
#mod_game/GMCmd.h \
#mod_game/ItemMgr.h \
#mod_game/Monster.h \
#mod_game/MonsterMgr.h \
#mod_game/StateMachine.h \
#mod_game/SweepMgr.h \
#mod_game/TaskMgr.h \
#mod_game/TeamMember.h \
#mod_game/TemplateMgr.h \
#mod_game/WingMgr.h \
#mod_game/WorldBossActivity.h \
#mod_game/WorldBossActivitySingleton.h \
#mod_game/WorldBoss.h \
#mod_game/FriendListMgr.h \
#mod_game/GameLineMgr.h \
#mod_game/GemMgr.h \
#mod_game/MonsterStateMachine.h \
#mod_game/PetManager.h \
#mod_game/SceneMgr.h \
#mod_game/SkillMgr.h \
#mod_game/Team.h \
#mod_game/VIPMgr.h \
#mod_game/XuanShang.h \
#mod_game/FuncOpenMgr.h \
#mod_game/NPC.h \
#mod_game/State.h \
#mod_game/CharsetConverter.cpp \
#mod_game/CharsetConverter.h
#@rm -f $@
#g++ $(CFLAGS) $(SHARED) -o $@ $^ -Iinclude/libshaco -Inet -Ibase -Itplt -Imod -Imsg -Imsg/Message -Imod_game -I3rd -I3rd/tinyXml -Imsg/iconv $(LDFLAGS) -liconv -ltplt -ltinyxml

$(bin_dir)/mod_robotcli.so: $(mod_dir)/mod_robotcli.cpp
g++ $(CFLAGS) $(SHARED) -o $@ $^ -Iinclude/libshaco -Inet -Ibase -Imod -Imsg -Imsg/Message

$(bin_dir)/libtinyxml.so: \
3rd/tinyXml/tinystr.h \
3rd/tinyXml/tinyxml.h \
3rd/tinyXml/tinystr.cpp \
3rd/tinyXml/tinyxml.cpp \
3rd/tinyXml/tinyxmlerror.cpp \
3rd/tinyXml/tinyxmlparser.cpp
@rm -f $@
g++ $(CFLAGS) $(SHARED) -o $@ $^ -Imsg

t: main/test.c persist/mysqlc.c persist/mysqlc.h
gcc $(CFLAGS) -o $@ $^ -Iinclude/libshaco -Imsg -Inet -Ibase -Ielog -Ipersist -I3rd $(LDFLAGS) -lrt -lbase -lshaco -lnet -llua -lmysqlclient

#robot: main/robot.c cnet/cnet.c cnet/cnet.h net.so
#gcc $(CFLAGS) -o $@ $^ -Icnet -Inet -Ibase -Imsg -Wl,-rpath,. net.so

# res
res:
@rm -rf $(HOME)/.shaco/excel
@mkdir -pv $(HOME)/.shaco/excel
@mkdir -pv ./res
@rm -rf ./res/tbl
@mkdir -pv ./res/tbl
@rm -rf ./res/tplt
@mkdir -pv ./res/tplt
@mkdir -pv ./datadefine
@rm -rf ./datadefine/tplt_struct.h
@rm -rf $(HOME)/.shaco/excel/*
@svn export $(SHACO_SVN_RES)/02.项目数值 $(HOME)/.shaco/excel/02.项目数值 --force
@svn export $(SHACO_SVN_RES)/工具 $(HOME)/.shaco/excel/tool --force
@PWD_PATH=`pwd`
@cd $(HOME)/.shaco/excel/tool && python CreateXmlFromExcel.py
@du -ah $(HOME)/.shaco/excel/02.项目数值 |grep xlsx$$ | awk '{print "cp -f " $$2 " $(HOME)/.shaco/excel"}'|bash
# @rm -rf $(HOME)/.shaco/excel/tmp
# @svn export $(SHACO_SVN_RES)/工具/ServerExcelFiles $(HOME)/.shaco/excel --force
# @svn export $(SHACO_SVN_RES)/工具/Database.xml $(HOME)/.shaco/excel/excelmake_server.xml --force
@cp $(HOME)/.shaco/excel/tool/Database.xml $(HOME)/.shaco/excel/excelmake_server.xml
@cd $(PWD_PATH)
@cd tool && \
python convert_excel.py \
$(HOME)/.shaco/excel/excelmake_server.xml \
$(HOME)/.shaco/excel tbl=../res/tbl:c=../res/tplt && \
python concat.py ../res/tplt ../datadefine/tplt_struct.h && \
rm -rf ../res/tplt

# thirdlib
thirdlib:
@__=`pwd` && cd third && $(MAKE) dist DIST_PATH=$$__/thirdlib

# for client
client: cnet.dll tplt.dll

client_bin=\
cnet.dll \
cnet.lib \
tplt.dll \
tplt.lib \
tplt.def

cnet_src=\
cnet/cnet.c \
cnet/cnet.h

cnet.dll: $(net_src) $(cnet_src)
gcc $(CFLAGS) -shared -o $@ $^ -Inet -Imsg -lws2_32 \
-Wl,--output-def,cnet.def,--out-implib,cnet.lib
LIB /MACHINE:IX86 /DEF:cnet.def

tplt.dll: $(tplt_src)
gcc $(CFLAGS) -shared -o $@ $^ -Itplt \
-Wl,--output-def,tplt.def,--out-implib,tplt.lib
LIB /MACHINE:IX86 /DEF:tplt.def

testclient: main/testclient.c $(tplt_src) datadefine/tplt_struct.h
gcc $(CFLAGS) -o $@ $^ -Itplt -Idatadefine

client_dir=D:/wa-client/trunk
install_dir=$(client_dir)/driller/proj.win32/Debug.win32
install_dir_rel=$(client_dir)/driller/proj.win32/Release.win32
source_dir=$(client_dir)/driller/Classes
tool_dir=$(client_dir)/tool
install:
cp $(client_bin) $(install_dir)
cp $(client_bin) $(install_dir_rel)
cp -r net $(source_dir)
cp -r cnet $(source_dir)
cp -r main/robot.c $(source_dir)/cnet
mkdir -pv .mod_room
for file in `ls mod_room`; do iconv -f utf-8 -t gbk mod_room/$$file > .mod_room/$$file; done
cp -r .mod_room/* $(source_dir)/map
rm -rf .mod_room
#cp -r msg $(source_dir)
mkdir -pv .msg
for file in `ls msg`; do iconv -f utf-8 -t gbk msg/$$file > .msg/$$file; done
cp -r .msg/* $(source_dir)/message
rm -rf .msg
cp -r tplt $(source_dir)
cp -r tool/concat.py tool/convert_excel.py tool/excelto $(tool_dir)

# clean
clean:
rm -f $(all_t) mod_game/*.o

cleanall: clean
rm -rf cscope.* tags
rm -rf res
rm -rf datadefine
find . -name "*.pyc" | xargs -i rm -f {}

...全文
2619 8 点赞 打赏 收藏 举报
写回复
8 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
puckchen 2016-02-15
sudo apt-get install libcurl-devel
  • 打赏
  • 举报
回复
s_evener 2015-12-09
哈哈 不要挣扎了 这个是降临的源码吧~之所以缺这个是因为curl没装或者/usr/lib目录下的软连接不对,你放心 编译到后面还有不少这样的都是这个问题~但这些都不是最重要的~你最后还是没办法启动服务器~因为放源码的那个人把核心库件抽掉了~跑不起来的~你好好读代码学习一下就是了~顺便告诉你~这份代码写得太渣~没多大参考意义~
  • 打赏
  • 举报
回复
lc7cl 2015-08-14
yum install curl yum install libcurl-devel
  • 打赏
  • 举报
回复
引用 3 楼 qq_17299675 的回复:
[quote=引用 1 楼 micropentium6 的回复:] make sure you have libcurl installed, it might be safer if you have both libcurl and libcurl-devel installed
如何安装,我怎么安装不成功[/quote] 那要看你是什么系统
  • 打赏
  • 举报
回复
图灵转世 2015-08-12
curl是关于浏览器的库吧。
  • 打赏
  • 举报
回复
qq_17299675 2015-08-12
引用 1 楼 micropentium6 的回复:
make sure you have libcurl installed, it might be safer if you have both libcurl and libcurl-devel installed
如何安装,我怎么安装不成功
  • 打赏
  • 举报
回复
baidu_29810721 2015-08-12
curl的库没装吧
  • 打赏
  • 举报
回复
make sure you have libcurl installed, it might be safer if you have both libcurl and libcurl-devel installed
  • 打赏
  • 举报
回复
相关推荐
发帖
Linux_Kernel
创建于2007-08-27

4156

社区成员

Linux/Unix社区 内核源代码研究区
申请成为版主
帖子事件
创建了帖子
2015-08-10 06:15
社区公告
暂无公告