如何使用Chrome Native Client构建自己的C库

时间:2015-10-28 11:57:09

标签: c++ c opencv google-nativeclient

我是Chrome应用开发和Native Client / PNaCL管道的新手。 我正在研究OS X Yosemite。 我已经安装了naclports来使用opencv。我尝试过使用opencv的C ++代码,一切正常。

现在,我想在这个C ++代码中调用我自己的C库。首先,我必须为nacl构建它,这是我的问题(我的库也使用opencv)。

编译时出现以下错误:

    cc    -c -o mylib.o mylib.c
    In file included from mylib.c:3:
    In file included from /System/Library/Frameworks/opencv2.framework/Headers/opencv.hpp:52:
    In file included from /System/Library/Frameworks/opencv2.framework/Headers/video/video.hpp:47:
    /System/Library/Frameworks/opencv2.framework/Headers/video/background_segm.hpp:47:10: fatal error: 
  'list' file not found
    #include <list>
     ^
    1 error generated.
    make: *** [mylib.o] Error 1

这是我的Makefile:

    WARNING_FLAGS := -Wall -Wno-long-long -pedantic -Werror 
    CXXFLAGS := -lpthread $(WARNINGS) -I/opt/local/include/ -I/opt/local/include/opencv/ 
    LDFLAGS := -L/opt/local/lib/ -lopencv_objdetect -lopencv_imgproc -lopencv_core -lopencv_highgui -lopencv_contrib -lopencv_ml -lopencv_video -lz -lm -L/usr/X11R6/lib -lGLU -lGL -lXext -lX11

    GETOS := python $(NACL_SDK_ROOT)/tools/getos.py
    OSHELPERS = python $(NACL_SDK_ROOT)/tools/oshelpers.py
    OSNAME := $(shell $(GETOS))

    PNACL_TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_pnacl)
    PNACL_CXX:=$(PNACL_TC_PATH)/bin/pnacl-clang++
    PNACL_CC:=$(PNACL_TC_PATH)/bin/pnacl-clang
    PNACL_AR:=$(PNACL_TC_PATH)/bin/pnacl-ar

    PNACL_CXXFLAGS := -I$(NACL_SDK_ROOT)/include $(CXXFLAGS) 
    PNACL_LDFLAGS := -L$(NACL_SDK_ROOT)/lib/pnacl/Release -lppapi_cpp -lppapi -lpthread $(LDFLAGS)

    SUFFIXES = .o .c .h .a .sl #.so 

    SRCS := mylib.c
    OBJS = $(SRCS:%.c=%.o)

    all:  mylib.a

    mylib.a:    $(OBJS) $(PNACL_CXX) -o $@ $< $(OBJS) -O2
    $(PNACL_CXXFLAGS) $(PNACL_LDFLAGS)
    @($(PNACL_AR) mylib.a $(OBJS))

    clean:
        $(RM) $(OBJS) mylib.a

我不明白这个opencv错误。

0 个答案:

没有答案