cmake利用toolchain.cmake生成makefile之后,make生成静态库失败问题
问题描述
利用toolchian.cmake设置好编译器后,利用make指令生成静态库,出现以下问题
Error running link command: No such file or directory
出错原因,toolchain.cmake文件内没有声明静态库生成器AR;解决方式,在toolchian.cmake文件内添加下面的声明
SET(CMAKE_AR $(TOOLCHAIN_DIR)/bin/arm-linux-gnueabihf-ar CACHE FILEPATH "Archiver")
我之前的设置是
SET(CMAKE_AR $(TOOLCHAIN_DIR)/bin/arm-linux-gnueabihf-ar)
仍然会报错,在查看了cmake 的文档后发现
Set Normal Variable
set(<variable> <value>... [PARENT_SCOPE])
Set the given <variable> in the current function or directory scope. If the PARENT_SCOPE option is given the variable will be set in the scope above the current scope. Each new directory or function creates a new scope. This command will
set the value of a variable into the parent directory or calling function (whichever is applicable to the case at hand). The previous state of the variable’s value stays
the same in the current scope (e.g., if it was undefined before, it is still undefined and if it had a value, it is still that value).
Cache 变量
Set Cache Entry
set(<variable> <value>... CACHE <type> <docstring> [FORCE])
Set the given cache <variable> (cache entry). Since cache entries are meant to provide user-settable values this does not overwrite existing cache entries by default.
Use the FORCE option to overwrite existing entries. The <type> must be specified as one of: BOOL
Boolean ON/OFF value. cmake-gui() offers a checkbox.
FILEPATH
Path to a file on disk. cmake-gui() offers a file dialog.
PATH
Path to a directory on disk. cmake-gui() offers a file dialog.
STRING
A line of text. cmake-gui() offers a text field or a drop-down selection if the STRINGS cache entry property is set.
INTERNAL
A line of text. cmake-gui() does not show internal entries. They may be used to store variables persistently across runs. Use of this type implies FORCE.
The <docstring> must be specified as a line of text providing a quick summary of the option for presentation to cmake-gui() users. If the cache entry does not exist prior to the call or the FORCE option is given then the cache entry will be set to the given value. Furthermore, any normal variable
binding in the current scope will be removed to expose the newly cached value to any immediately following evaluation. It is possible for the cache entry to exist prior to the call but have no type set if it was created on the cmake() command line by a user through the -D<var>=<value>
option without specifying a type. In this case the set command will add the type. Furthermore, if the <type> is PATH or FILEPATH and the <value> provided on the command
line is a relative path, then the set command will treat the path as relative to the current working directory and convert it to an absolute path.
之后删除build文件下的所有内容
rm -rf *
再次调用cmake生成makefile
cmake -DCMAKE_TOOLCHAIN_FILE=~/toolchain.cmake ../
编译即可
make VERBOSE= -j5
cmake利用toolchain.cmake生成makefile之后,make生成静态库失败问题的更多相关文章
- QT中静态库的生成与使用
一. 静态库的生成 1. 测试目录: lib 2. 源码文件名: mywindow.h, mywindow.cpp, 类MyWindow继承于QPushButton, 并将文字设置为&qu ...
- QT中静态库的生成与使用——创建共享库代码,附例子
一. 静态库的生成 1. 测试目录: lib 2. 源码文件名: mywindow.h, mywindow.cpp, 类MyWindow继承于QPushButton, 并将文字设置为&qu ...
- 利用 autoconf 和 automake 生成 Makefile 文件
一.相关概念的介绍 什么是 Makefile?怎么书写 Makefile?竟然有工具可以自动生成 Makefile?怎么生成啊?开始的时候,我有这么多疑问,所以,必须得先把基本的概念搞个清楚. 1.M ...
- 使用CMake编译跨平台静态库
在开始介绍如何使用CMake编译跨平台的静态库之前,先讲讲我在没有使用CMake之前所趟过的坑.因为很多开源的程序,比如png,都是自带编译脚本的.我们可以使用下列脚本来进行编译: . / con ...
- 手把手教你自动生成Makefile
概述:autoconf/automake工具用于自动创建功能完善的Makefile文件,接下来简单介绍一下,如何使用上述工具 自动生成Makefile 前提:安装autoconf工具(ubuntu:s ...
- Linux静态库生成指南
Linux静态库生成指南 Linux上的静态库,其实是目标文件的归档文件.在Linux上创建静态库的步骤如下: 写源文件,通过 gcc -c xxx.c 生成目标文件. 用 ar 归档目标文件,生 ...
- Linux下Gcc生成和使用静态库和动态库详解(转)
一.基本概念 1.1什么是库 在windows平台和linux平台下都大量存在着库. 本质上来说库是一种可执行代码的二进制形式,可以被操作系统载入内存执行. 由于windows和linux的平台不同( ...
- Linux下Gcc生成和使用静态库和动态库详解
参考文章:http://blog.chinaunix.net/uid-23592843-id-223539.html 一.基本概念 1.1什么是库 在windows平台和linux平台下都大量存在着库 ...
- [转]Linux下用gcc/g++生成静态库和动态库(Z)
Linux下用gcc/g++生成静态库和动态库(Z) 2012-07-24 16:45:10| 分类: linux | 标签:链接库 linux g++ gcc |举报|字号 订阅 ...
随机推荐
- 仿QQ撒花特效--第三方开源--FllowerAnimation
点此下载资源 xml: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" ...
- 31 python下实现并发编程
一 背景知识 顾名思义,进程即正在执行的一个过程.进程是对正在运行程序的一个抽象. 进程的概念起源于操作系统,是操作系统最核心的概念,也是操作系统提供的最古老也是最重要的抽象概念之一.操作系统的其他所 ...
- Nhibernate系列学习之(二) 简单增删改查
实例中解决方案简单的创建三层架构,符合开发过程中最简单的运用: 1:首先在数据库中创建一个表T_School,脚本如下: USE [TestDb] GO /****** 对象: Table [dbo] ...
- uva489(需要考虑周全)
这个题是简单题,但是我的思路本身不周全,忽略了一种比较“无理”的情况,而导致WA多次.我是把猜的串全扫一遍以后判断出结果,但是实际上可能是前面已经全猜对了,但是这个选手是个逗比,已经猜对了还要猜,而且 ...
- VC6常用插件
VC6常用插件 2009-10-09 17:27 1.Visual Assist(强烈推荐) http://www.wholetomato.com/ VA从5.0一直到现在的VAX,功能 ...
- UVA - 11768 Lattice Point or Not (扩展欧几里得)
求一条线段上有多少个整点. 是道扩欧基础题,列出两点式方程,然后分四种情况讨论即可.但细节处理较多很容易写挫(某zzWA了十几发才过掉的). 由于数据精度较小,浮点数比较没有用eps,直接==比较了. ...
- Number Sequence (KMP的应用)
个人心得:朴素代码绝对超时,所以要用到KMP算法,特意了解了,还是比较抽象,要多体会 Given two sequences of numbers : a11, a22, ...... , aNN, ...
- 【Unity】publishing setting keystore作用
http://blog.csdn.net/ldy597321444/article/details/53519753 android的默认调试签名,所有市场都不允许debug签名的应用发布的.所以,第 ...
- PHP判断键值数组是否存在,使用empty或isset或array_key_exists(转)
一个例子 猜猜看,下面的例子会输出什么? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 <?php $a = array('a'=>1, 'b'=>0, 'c'= ...
- jQuery中 :first、:first-child 和 :first-of-type 之间的不同
<!DOCTYPE html><html><head><meta charset="utf-8"><script src=&q ...