我已经配置了Webports,ffmpeg;我为当前项目创建了以下 Makefile。但是,我在 ffmpeg 库链接方面遇到了一些问题。
$ TOOLCHAIN=pnacl make
LINK pnacl/Release/client_unstripped.bc
pnacl/Release/src/client.o: error: undefined reference to 'av_register_all'
make: *** [pnacl/Release/client_unstripped.bc] Error 1
你能告诉我我在这里做错了什么吗,我的 Makefile 如下所示:
VALID_TOOLCHAINS := pnacl glibc clang-newlib win
NACL_SDK_ROOT ?= $(abspath $(CURDIR)/../..)
目标 = 客户
其他目录=src
INC_DIR = 公司
FFMPEG_INC_DIR = ../../toolchain/mac_pnacl/le32-nacl/usr/include
包括 = -I$(INC_DIR) -I$(FFMPEG_INC_DIR)
包括 $(NACL_SDK_ROOT)/tools/common.mk
CHROME_ARGS += --allow-nacl-socket-api=localhost
LIBS = nacl_io ppapi_cpp ppapi
CFLAGS = -Wall -g -O2 $(包括) -L../../toolchain/mac_pnacl/le32-nacl/usr/lib -lavformat \ -lvpx -lvorbisenc -lvorbis -logg -ltheoraenc -ltheoradec -logg -lmp3lame -lm -pthread -lavcodec -lvpx -lvorbisenc -lvorbis -logg \ -ltheoraenc -ltheoradec -logg -lmp3lame -lm -pthread -lswresample -lm -lavutil -lm -lavdevice -lavfilter
来源 = $(OTHERDIR)/tcp_util.cc $(OTHERDIR)/tpool.cc $(OTHERDIR)/net.cc $(OTHERDIR)/rtsp_response.cc \ $(OTHERDIR)/rtsp.cc $(OTHERDIR)/rtsp_common。 cc \ $(OTHERDIR)/rtsp_client.cc $(OTHERDIR)/udp_util.cc \ $(OTHERDIR)/client.cc
# 构建由 common.mk 中的宏生成的规则:
$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS))))
# PNaCl 工作流使用未剥离和最终/剥离的二进制文件。# 在 NaCl 上,只为发布配置(不是调试)生成一个剥离的二进制文件。ifneq (,$(or $(findstring pnacl,$(TOOLCHAIN)),$(findstring Release,$(CONFIG)))) $(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$( LIBS),$(DEPS))) $(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped)) else $(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$( LIBS),$(DEPS))) endif
$(eval $(call NMF_RULE,$(TARGET),))
这就是在类上下文中如何使用库的方式。
class VideoDecodePack {
public:
VideoDecodePack() {
av_register_all();
}
};
class ClientInstance : public pp::Instance {
public:
explicit ClientInstance(PP_Instance instance) : pp::Instance(instance){
cses = InitRtspClientSession();
_videoDecoder = new VideoDecodePack();
}
...