4887
- 收藏
- 点赞
- 分享
- 举报
移植glog库到海思3519
[i=s] 本帖最后由 liusir 于 2017-3-8 15:57 编辑 [/i]
[size=5][b]1.移植环境:[/b][/size]
- Ubuntu15.10 + arm-hisiv500-linux-
- glog-0.3.3 下载地址【或者附件】:https://code.google.com/archive/p/google-glog/downloads
[b][size=5]2.移植glog:[/size][/b] [b]1)解压 [/b]
shunzhi@ubuntu:~/software$ tar -xvzf glog-0.3.3.tar.gz
[b]2)新建一个安装目录[/b]
shunzhi@ubuntu:~/software$ cd glog-0.3.3/
shunzhi@ubuntu:~/software/glog-0.3.3$ mkdir _install
[b]3)配置编译环境变量 [/b]
shunzhi@ubuntu:~/software/glog-0.3.3$ ./configure --host=arm-hisiv500-linux --prefix=/home/shunzhi/software/glog-0.3.3/_install/
[b]4)编译glog库 [/b]
shunzhi@ubuntu:~/software/glog-0.3.3$ make
[b]5)安装glog库 [/b]
shunzhi@ubuntu:~/software/glog-0.3.3$ make install
shunzhi@ubuntu:~/software/glog-0.3.3$ cd _install/
shunzhi@ubuntu:~/software/glog-0.3.3/_install$ ls
include lib share
然后将lib目录中的libglog.so.0文件拷贝到3519开发板的/usr/lib目录下。
[b][size=5]3.测试:[/size][/b]
[b]1)测试程序[/b] glog_hisi.c
[code] #include
include
#include <sys/stat.h>
#include <sys/types.h>
#include <glog/logging.h>
#include <glog/log_severity.h>
int main(void)
{
char defpath[100] = "./log";
//创建log文件夹
mkdir("./log",0777);
//log初始化
google::InitGoogleLogging("New");
FLAGS_colorlogtostderr = true;//设置输出到屏幕的日志显示相应颜色
//FLAGS_servitysinglelog = true;// 用来按照等级区分log文件
FLAGS_logbufsecs = 0;//缓冲日志输出,默认为30秒,此处改为立即输出
FLAGS_max_log_size = 1; //最大日志大小为 100MB
FLAGS_stop_logging_if_full_disk = true;//当磁盘被写满时,停止日志输出
google::SetStderrLogging(google::GLOG_INFO); //设置级别 高于 google::INFO 的日志同时输出到屏幕
//日志名称和输出地址
char Info[50] = {0};
char Warn[50] = {0};
char Error[50] = {0};
char Fatal[50] = {0};
strcpy(Info, defpath);
strcpy(Warn, defpath);
strcpy(Error, defpath);
strcpy(Fatal, defpath);
strcat(Info, "/Info_");
strcat(Warn, "/Warning_");
strcat(Error, "/Error_");
strcat(Fatal, "/Fatal_");
google::SetLogDestination(google::GLOG_INFO,Info);
google::SetLogDestination(google::GLOG_WARNING,Warn);
google::SetLogDestination(google::GLOG_ERROR,Error);
google::SetLogDestination(google::GLOG_FATAL,Fatal);
LOG(INFO) <<"------------------------------"<<std::endl;
LOG(INFO) <<"---------Creat Log!!!---------\n ";
LOG(INFO) <<"------------------------------"<<std::endl;
return 1;
}
[/code]
Makefile
[code] CC = arm-hisiv500-linux-g++
CC = g++
DEMOTAR = glog_hisi
DEMOOBJ = glog_hisi.o
CFLAGS += -mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4 -mno-unaligned-access -fno-aggressive-loop-optimizations
CFLAGS += -g -Wall -I/home/shunzhi/software/glog-0.3.3/_install/include
LDFLAGS += -L/home/shunzhi/software/glog-0.3.3/_install/lib -Wl,-Bdynamic -lglog -lpthread -lrt
%.o: %.c
@echo "[Compiling] $< ..."
@$(CC) $(CFLAGS) -c $<
all: $(DEMOTAR)
$(DEMOTAR):$(DEMOOBJ)
@$(CC) -o $@ $^ $(LDFLAGS)
.PHONY : clean
clean:
rm -rf $(DEMOOBJ) $(DEMOTAR) [/code]
[b]2)编译测试程序[/b]
shunzhi@ubuntu:~/workspace/glog$ ls
glog_hisi.c Makefile
shunzhi@ubuntu:~/workspace/glog$ make
[Compiling] glog_hisi.c ...
shunzhi@ubuntu:~/workspace/glog$ ls
glog_hisi glog_hisi.c glog_hisi.o Makefile
[b]3)测试结果[/b]
~/glog # ls
glog_hisi
~/glog # ./glog_hisi
I0101 15:44:54.473941 273 glog_hisi.c:46] ------------------------------
I0101 15:44:54.475924 273 glog_hisi.c:47] ---------Creat Log!!!---------
I0101 15:44:54.476441 273 glog_hisi.c:48] ------------------------------
~/glog # ls
glog_hisi log
注:log目录下的文件就是生成的日志文件
[size=5][b]4.移植库可能遇到的问题[/b][/size]
[b]1)执行congfigure配置通过,而且执行make编译也正常,在执行sudo make install是出现了下面的错误:[/b]
[b]错误log[/b]
make[1]: Entering directory '/home/shunzhi/software/glog-0.3.3'
test -z "/home/shunzhi/software/glog-0.3.3/lib" || /bin/mkdir -p "/home/shunzhi/software/glog-0.3.3/lib"
/bin/sh ./libtool --mode=install /usr/bin/install -c libglog.la '/home/shunzhi/software/glog-0.3.3/lib'
libtool: install: /usr/bin/install -c .libs/libglog.so.0.0.0 /home/shunzhi/software/glog-0.3.3/lib/libglog.so.0.0.0
libtool: install: (cd /home/shunzhi/software/glog-0.3.3/lib && { ln -s -f libglog.so.0.0.0 libglog.so.0 || { rm -f libglog.so.0 && ln -s libglog.so.0.0.0 libglog.so.0; }; })
libtool: install: (cd /home/shunzhi/software/glog-0.3.3/lib && { ln -s -f libglog.so.0.0.0 libglog.so || { rm -f libglog.so && ln -s libglog.so.0.0.0 libglog.so; }; })
libtool: install: /usr/bin/install -c .libs/libglog.lai /home/shunzhi/software/glog-0.3.3/lib/libglog.la
libtool: install: /usr/bin/install -c .libs/libglog.a /home/shunzhi/software/glog-0.3.3/lib/libglog.a
libtool: install: chmod 644 /home/shunzhi/software/glog-0.3.3/lib/libglog.a
libtool: install: arm-hisiv500-linux-ranlib /home/shunzhi/software/glog-0.3.3/lib/libglog.a
./libtool: line 1099: arm-hisiv500-linux-ranlib: command not found
Makefile:697: recipe for target 'install-libLTLIBRARIES' failed
make[1]: *** [install-libLTLIBRARIES] Error 127
make[1]: Leaving directory '/home/shunzhi/software/glog-0.3.3'
Makefile:1428: recipe for target 'install-am' failed
make: *** [install-am] Error 2
[b]错误原因: [/b] 交叉工具链安装的问题,交叉工具链root用户下找不到。
[b]解决方案: [/b] 按照上述我的配置步骤,新建一个安装目录(shunzhi@ubuntu:~/software/glog-0.3.3$ mkdir _install),然后配置选项中指明安装目录(--prefix=/home/shunzhi/software/glog-0.3.3/_install/),执行make install即可。
[postbg]bg4.png[/postbg]
文件: glog-0.3.3.tar.gz
下载
我来回答
回答6个
时间排序
认可量排序
认可0
认可0
认可0
认可0
认可0
认可0
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2018-12-17 09:23:05
-
2015-01-20 22:07:13
-
2020-06-29 11:45:28
-
2018-12-15 10:57:01
-
2017-10-23 09:32:55
-
2016-03-24 16:52:16
-
2016-09-22 15:45:54
-
2015-04-20 23:22:36
-
2016-07-22 12:00:58
-
2018-06-28 14:52:58
-
2017-04-12 14:44:07
-
2017-08-16 17:10:52
-
2016-05-09 22:38:20
-
2017-04-27 14:22:50
-
2017-02-22 14:32:22
-
2016-11-23 11:59:46
-
2015-05-12 14:05:12
-
2019-12-20 09:45:14
-
2020-11-04 15:59:17
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
5Hi3516CV610 如何使用SD卡升级固件
-
5cat /dev/logmpp 报错 <3>[ vi] [func]:vi_send_frame_node [line]:99 [info]:vi pic queue is full!
-
50如何获取vpss chn的图像修改后发送至vo
-
5FPGA通过Bt1120传YUV422数据过来,vi接收不到数据——3516dv500
-
50SS928 运行PQtools 拼接 推到设备里有一半画面会异常
-
53536AV100的sample_vdec输出到CVBS显示
-
10海思板子mpp怎么在vi阶段改变视频数据尺寸
-
10HI3559AV100 多摄像头同步模式
-
9海思ss928单路摄像头vio中加入opencv处理并显示
-
10EB-RV1126-BC-191板子运行自己编码的程序
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认