网址:http://www.gpstk.org/bin/view/Documentation/BuildingGPSTkUnderUnix

这里使用Cmake来安装源码,网站上的原文摘抄如下,有少部分作了修改的地方,使用红色字体和下划线来标识。

The following procedure will build and install the GPSTk.

  1. Ensure that prerequisites such as CMake have been installed.
  2. Download the GPSTk source distribution.
  3. Extract the GPSTk tarball. For example, using GNU tar
    tar xvzf gpstk.tar.gz
  4. Create a directory for your build. For example, change into the gpstk/directory and type
    mkdir build
  5. Change into the gpstk/build directory, this will be where all of the build files will reside.
  6. If GPSTk Core will be installed as a system library in /usr/local, execute the following commands:
    cmake ../dev
    make

    To install to a different directory, the install directory must be set-up when CMake configures the makefiles, add the following command:

    -DCMAKE_INSTALL_PREFIX:PATH=/path/to/install

    To build GPSTk with Ext, in addition to Core, add the following command:

    -DBUILD_EXT=ON
     

    To turn on processing of python extension package, add the following command:

    -DBUILD_PYTHON=ON

    To turn on test mode, add the following command:

    -DTEST_SWITCH=ON

    Example - Command for building GPSTk with core, ext, python, and test code and installing to sytem library in /usr/local:

    [She@she-centos7 gpstk-2.5.src]$ sudo mkdir /opt/gpstk-2.5.linux.x86_64
    [She@she-centos7 gpstk-2.5.src]$ cd build
    [She@she-centos7 build]$ cmake -DBUILD_EXT=ON -DBUILD_PYTHON=ON -DTEST_SWITCH=ON ../dev
    -- The C compiler identification is GNU 4.8.5
    -- The CXX compiler identification is GNU 4.8.5
    -- Check for working C compiler: /usr/bin/cc
    -- Check for working C compiler: /usr/bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working CXX compiler: /usr/bin/c++
    -- Check for working CXX compiler: /usr/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    system = Linux-3.10.0-514.16.1.el7.x86_64
    system_name = Linux
    Notice: Will install GPSTk to the path /opt/gpstk-2.5.linux.x86_64
    -- Configuring done
    -- Generating done
    CMake Warning:
    Manually-specified variables were not used by the project: BUILD_EXT
    BUILD_PYTHON -- Build files have been written to: /home/She/Downloads/GPSTK/gpstk-2.5.src/build
     
  7. To install GPSTk, execute
    sudo make install
  8. To test GPSTk (if Test_Switch=ON), execute
    sudo make test
  9. To build the source documentation using doxygen: Change into the gpstk/dev directory (if using Developer repo) or the gpstk/directory (if using the tarball), and type
    doxygen

接下来,选择 GPSTK 网站提供的例一作为测试对象,看程序的功能是否可用。

编译文件 Makefile 内容如下:

PROGRAM    = example
RM = rm -f
CC = g++ SOURCES = example1.cpp
OBJECTS = ${SOURCES:%.cpp=%.o} LIBPATH += -L/usr/local/lib LIBS = -lgpstk all: ${PROGRAM} ${PROGRAM}: ${SOURCES} ${OBJECTS}
${CC} -o ${PROGRAM} ${LIBPATH} ${OBJECTS} ${LIBS} clean:
${RM} ${OBJECTS} ${PROGRAM}

编译可以正常通过,但是运行时总是报错,提示

$ make -o example -L/usr/local/lib -lgpstk example1.cpp
$ ./example error while loading shared libraries: libgpstk.so: cannot open shared object file: No such file or directory

经查,这个文件/usr/local/lib/libgpstk.so,确实存在,那么,就是默认搜索时找不到这个路径。

为了解决这个bug,我们将这个文件映射到默认搜索路径/usr/lib下:

$ sudo ln -s /usr/local/lib/libgpstk.so /usr/lib/libgpstk.so

再重新编译和运行程序,就一切正常了:

$ make clean
$ make
$ ./example
Hello world!
The current civil time is 06/07/2017 07:16:53 UTC
The current year is 2017
The current day of year is 158
The current second of day is 26213.5
The current full GPS week is 1952
The current short GPS week is 928
The current day of GPS week is 3
The current second of GPS week is 285414
The current Modified Julian Date is 57911.303397479 UTC

如果添加软链接之后仍不奏效,则添加环境变量,使它在运行时能搜索到相应的库文件: $ sudo vi /etc/profile.d/GPSTKsetvar.sh ,添加以下内容:

# setting environment variables for GPSTK, edit by She
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib:/usr/lib

并更新环境变量: source /etc/profile.d/GPSTKsetvar.sh 。

再次编译并运行,即可得到正确的运行结果。

CentOS7系统上的GPSTK源码安装的更多相关文章

  1. CentOS7系统上的LAPACK源码安装

    参考链接:linux下安装blas和lapack BLAS 和 LAPACK 这两个数学库是很多 Linux 科学计算软件需要调用的,所以经常会用到. LAPACK,其名为Linear Algebra ...

  2. CentOS7系统上的GPSTK示例代码调试 & 运行结果 & 心得

    下载的源码程序包中,共有16个例子,这里记录它们的调试及运行结果,尤其是哪些可用,哪些不可用,今后使用时用作参考. 总结: (1)在 18 个示例程序中,example16 和 example17 编 ...

  3. Centos7服务器中通过编译源码安装MySQL

    基于在Centos7服务器上使用 yum 安装MySQL5.7到默认路径 在修改文件存储位置的时候,折腾了一番没有将成功将datadir修改为我想要的位置 我决定再尝试一下通过编译源码来自定义安装: ...

  4. 在ConoHa上Centos7环境下源码安装部署LNMP

    本文记录了从源码,在Centos 7上手动部署LNMP环境的过程,为了方便以后对nginx和mariadb进行升级,这里采用yum的方式进行安装. 1.建立运行网站和数据库的用户和组 groupadd ...

  5. [原创]在Centos7.2上源码安装PHP、Nginx、Zentao禅道

    版本 操作系统:CentOS Linux release 7.2.1511 (Core) PHP:5.6.33 Nginx:1.12.2 MySQL:5.6.38(192.168.1.103的Wind ...

  6. centos 6x系统下源码安装mysql操作记录

    在运维工作中经常部署各种运维环境,涉及mysql数据库的安装也是时常需要的.mysql数据库安装可以选择yum在线安装,但是这种安装的mysql一般是系统自带的,版本方面可能跟需求不太匹配.可以通过源 ...

  7. CentOS7下源码安装mysql5.6

    目录 准备工作 运行环境 确认你的安装版本 下载mysql 安装mysql 准备安装环境 编译和安装 配置mysql 单实例配置      单实例配置方法          添加防火墙         ...

  8. centos7 中源码安装nginx

    使用nginx有一段时间了,还是有很多东西不懂的,在这里做一下自己学习过程中的一些整理,能使自己得到提升. 1.环境:centos7 1511  最小化安装 2.下载nginx,可以在系统中下载,也可 ...

  9. CentOS7(Linux)源码安装MySQL5.7.X

    介绍 软件应用最重要的就是数据库了,可是还有小伙伴不会在Linux上安装MySQL数据库,今天就来讲讲如何在CentOS7环境使用源码进行安装MySQL5.7.X. MySQL官网下载链接:https ...

随机推荐

  1. GO语言从入门到放弃目录

    GO语言基础 第一个GO程序 GO语言常量和变量 GO语言数据类型 GO语言流程控制 GO语言数组 GO语言切片 GO语言 map GO语言函数 GO语言指针 Go语言接口 GO语言常用包 GO语言的 ...

  2. 目标URL存在跨站漏洞和目标URL存在http host头攻击漏洞处理方案

    若需要学习技术文档共享(请关注群公告的内容)/讨论问题 请入QQ群:668345923 :若无法入群,请在您浏览文章下方留言,至于答复,这个看情况了 目录 HTTP协议详解 引言 一.HTTP协议详解 ...

  3. maven的两种打包插件 ,防止 将无用文件打入META_INF,找不到主类的问题

    第三种 打依赖包 将依赖其他jar的包都打进去 <plugin> <artifactId>maven-assembly-plugin</artifactId> &l ...

  4. 《CSS世界》读书笔记(十六)

    <!-- <CSS世界>张鑫旭著 --> line-height与“垂直居中” line-height 可以让单行或多行元素近似垂直居中,原因在于 CSS 中“行距的上下等分机 ...

  5. window 10 删除带有管理员权限的Oracle文件夹

    因为文件已经被删除就不附图解释了 因为文件安装的方式错误,所以本是按照正常步骤卸载Oracle,前面的禁用Orace服务与删除Oracle注册表都没有出错,但到最后一步---------Oracle文 ...

  6. laravel中ajax,post传值问题

    //laravel中有CSRF保护 不加的话会出现419错误$.ajax({ url: '/admin/user/'+id, type: "POST", data: {'_toke ...

  7. context使用

    1. 概述 go语言中goroutine之间的关联关系,缺乏维护,在erlang中有专门的机制来保障新开协程的生命周期,在go语言中,只能通过channel + select来实现,但不够直观,很绕. ...

  8. 分布式事务、多数据源、分库分表中间件之spring boot基于Atomikos+XADataSource分布式事务配置(100%纯动态)

    本文描述spring boot基于Atomikos+DruidXADataSource分布式事务配置(100%纯动态),也就是增加.减少数据源只需要修改application.properties文件 ...

  9. Pandas截取列部分字符,并据此修改另一列的数据

    #截取'股票代码'第一个字符 df['首字符'] = df['股票代码'].str[0:1] ' # 根据'首字符'列的值,修改'市场'的值. 1表示上海 截取字符串的部分字符: date=today ...

  10. [C++ Primer Plus] 第8章、函数探幽(二)课后习题

    1.编写通常接受一个参数(字符串的地址),并打印该字符串的函数.不过,如果提供了第二个参数(int类型),且该参数不为0,则该函数打印字符串的次数将为该函数被调用的次数(注意,字符串的打印次数不等于第 ...