四时宝库

程序员的知识宝库

实践:交叉编译Google 开源模板库CTemplate

文/Justa

项目中架构使用的Lighttpd + fastcfg + 自己写的一套servlets,View、Model部分需要C++层来处理,网页前端使用纯dom操作,简直了!老古董呀!
没办法,重构先不想,先来完善我的ONVIF功能。

ONVIF Service,可以用GSOAP生成,因为设备上有Web Server了,不想用臃肿的GSOAP生成的代码,lighttpd + onvif 后天服务的方式来实现。

在ONVIF Service的很多实现都只是Model部分,绝大多数都是Get,而不是Post,所以,很方便的提取出所需要的html 模板,这也是为什么要用到Google 开源模板库的原因。

交叉编译

./autogen.sh
. ./configure --prefix=`pwd` --host=arm-unknown-linux-uclibcgnueabi CXXFLAGS=-std=c++0x

编译好的库

strip后的库,有800多K,还是有点体量

strip后库大小

依赖请点击此处输入图片描述

错误问题

CXX src/base/libctemplate_la-arena.lo

In file included from /toolchain/toolchain_gnueabi-4.4.0_ARMv5TE/usr/bin/../lib/gcc/arm-unknown-linux-uclibcgnueabi/4.4.0/../../../../arm-unknown-linux-uclibcgnueabi/include/c++/4.4.0/cstdint:35,

from ./src/base/arena.h:276,

from src/base/arena.cc:43:

/toolchain/toolchain_gnueabi-4.4.0_ARMv5TE/usr/bin/../lib/gcc/arm-unknown-linux-uclibcgnueabi/4.4.0/../../../../arm-unknown-linux-uclibcgnueabi/include/c++/4.4.0/c++0x_warning.h:31:2: error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.

解决 CXXFLAGS+=-std=c++0x

发表评论:

控制面板
您好,欢迎到访网站!
  查看权限
网站分类
最新留言
    友情链接