美文网首页
superd 在 CentOS 6.9 编译小计

superd 在 CentOS 6.9 编译小计

作者: michael_jia | 来源:发表于2018-06-08 20:54 被阅读21次

    今天是2018年6月8日,值得纪念。因为在今天,嵌入式设备程序在 CentOS 6.9 上编译成功了。自2017年10月份提出想法并初步实现后,5月初昏鸦再提议纳入议题,今天昏鸦和本人先后编译成功。

    今后,研发线的业务代码和测试代码并重,在实验室测试开发小组的协同下,从代码提交开始:自动化测试、系统测试、端到端测试、负载测试,要逐步展开,不断提升设备开发效率,为零成本运维铺路,实现 DevOps 业务目标。

    以下是在编译过程中发现的问题,修正后编译成功。

    源文件的可执行属性

    chmod a+x public/json-c-0.12.1/autogen.sh
    chmod a+x public/json-c-0.12.1/ltmain.sh
    chmod a+x audit/libpcap-1.5.3/configure
    chmod a+x audit/libpcap-1.5.3/runlex.sh
    chmod a+x audit/zlib-1.2.8/configure
    

    修改后提交代码到git库解决。

    编译环境

    1. yum instll Development tools
    2. yum -y install libtool 当下最新2.2.6
      只能通过源码安装 libtool 2.4.6 (项目需要2.4.2 以上)
    

    libtool 2.4.6 是最新稳定版,发布于 2015年2月15日。
    GNU libtool is a generic library support script. Libtool hides the complexity of using shared libraries behind a consistent, portable interface.
    To use libtool, add the new generic library building commands to your Makefile, Makefile.in, or Makefile.am.

    开源库

    • json-c
      使用 0.12.1,当前已有 0.13.1。

    交叉兼容性

    1. configure.ac 删除 AM_PROG_AR
    configure.ac:5: warning: macro `AM_PROG_AR' not found in library
    

    只是一个 warning,也可以不删除。

    1. 在 cross-compile.sh 的 make clean 前新增语句:cp /usr/bin/libtool .
    make[2]: Entering directory `/home/devops/v2.0.608/supervcloud/src/public/json-c-0.12.1'
    /bin/sh ./libtool --tag=CC   --mode=compile x86_64-redhat-linux-gcc -DHAVE_CONFIG_H -I.    -Wall -Wextra -Wwrite-strings -Wno-unused-parameter -std=gnu99 -D_GNU_SOURCE -D_REENTRANT -g -O2 -MT arraylist.lo -MD -MP -MF .deps/arraylist.Tpo -c -o arraylist.lo arraylist.c
    libtool: Version mismatch error.  This is libtool 2.4.6, but the
    libtool: definition of this LT_INIT comes from libtool 2.2.6b.
    libtool: You should recreate aclocal.m4 with macros from libtool 2.4.6
    libtool: and run autoconf again.
    
    

    编译

    git checkout <branch>
    gcc -v
    ./cross-compile.sh -h x86_64-redhat-linux -v <superd_version> [-g]
    

    -v superd_version 指定 superd 的版本;
    -h 指定编译后运行的机器
    -g 表明编译成 debug 版(不优化)

    原则

    • 结构良好
    • 代码整洁
    • 风格一致

    编码规范

    相关文章

      网友评论

          本文标题:superd 在 CentOS 6.9 编译小计

          本文链接:https://www.haomeiwen.com/subject/xlgasftx.html