configure相关笔记整理
来源:互联网 发布:淘宝物流单号怎么填 编辑:程序博客网 时间:2024/06/06 00:53
上半年时做了一个将Linux移植到Windows的项目,由于对configure&make这个过程不太熟悉,所以还是出了很多问题的。
现在简单整理当时的笔记。
Q1:
#ifdef x...#else...#endif
这些东西是干什么的?
A1:一些程序在设计时,希望能对环境进行一些适应从而编译出不同的软件,比如在不同的操作系统下都能编译。我们可以通过变量设置,把所有可能用到的代码都写进去,在初始化时配置,但在不同的情况下可能只用到一部分代码,就没必要把所有的代码都写进去,就可以用条件编译,通过预编译指令设置编译条件,在不同的需要时编译不同的代码。比如
#ifdef OS_WINDOWS
os.name = "windows";
#else
os.name = "other"
#endif
Q2:这些条件编译使用的变量怎么来的?为什么在config.h(类似)里看到了这些值?
A2:既然是为适应环境而产生的条件编译,那这些变量当然不能是写死的,一般来说Linux下的configure过程会分析这些变量该取哪些值的过程,然后会将这值写进一个头文件里,并让其他文件包含(config.h),生成Makefile文件
某工程的config.h如下
/* config.h. Generated from config.h.in by configure. *//* config.h.in. Generated from configure.ac by autoheader. *//* Define to 1 if you have the <inttypes.h> header file. */#define HAVE_INTTYPES_H 1/* Define to 1 if you have the `dnet' library (-ldnet). */#define HAVE_LIBDNET 1/* Define to 1 if you have the `dumbnet' library (-ldumbnet). *//* #undef HAVE_LIBDUMBNET *//* Define to 1 if you have the `pcap' library (-lpcap). *//* #undef HAVE_LIBPCAP *//* Define to 1 if you have the `pthread' library (-lpthread). *//* #undef HAVE_LIBPTHREAD *//* Define to 1 if you have the `wpcap' library (-lwpcap). */#define HAVE_LIBWPCAP 1/* Define to 1 if you have the `ws2_32' library (-lws2_32). */#define HAVE_LIBWS2_32 1/* Define to 1 if you have the <memory.h> header file. */#define HAVE_MEMORY_H 1/* Define to 1 if you have the <stdint.h> header file. */#define HAVE_STDINT_H 1/* Define to 1 if you have the <stdlib.h> header file. */#define HAVE_STDLIB_H 1/* Define to 1 if you have the <strings.h> header file. */#define HAVE_STRINGS_H 1/* Define to 1 if you have the <string.h> header file. */#define HAVE_STRING_H 1/* Define to 1 if you have the <sys/stat.h> header file. */#define HAVE_SYS_STAT_H 1/* Define to 1 if you have the <sys/types.h> header file. */#define HAVE_SYS_TYPES_H 1/* Define to 1 if you have the <unistd.h> header file. */#define HAVE_UNISTD_H 1/* Defined when the system UNIX based *//* #undef OS_UNIX *//* Defined when the system is Windows based */#define OS_WINDOWS /* Name of package */
Q3::configure时提示 can not guess build type怎么办?
A3:这时就是configure脚本无法判断当前的一些信息,比如操作系统,这时需要我们去指定,比如
--target=GARGET
除此之外,这个问题的产生是由于config.guess脚本无法guess产生的,一般都是因为config.guess比较老导致的,我们更新脚本即可。
地址:http://git.savannah.gnu.org/gitweb/?p=config.git
替换config.guess
重新configure
OK
- configure相关笔记整理
- svm 相关整理笔记
- 知识管理&笔记整理相关
- Fragment相关的笔记整理
- Java框架相关笔记整理
- configure笔记
- Android菜鸟笔记-EditText相关知识整理
- window和PhoneWindow相关笔记整理
- Bootstrap笔记和相关知识点整理
- Hibernate学习笔记之相关知识点整理
- 学习笔记整理——磁盘分区相关
- configure makefile相关工具关系
- 光谱基础知识__多光谱相关笔记_未整理
- 第十九天 servlet相关类的整理笔记
- 关于LCD1602以及IIC总线的相关学习笔记整理
- linux configure make make install 相关了解
- Configruation对象的configure()方法----Hibernate相关
- ./configure
- LeetCode:Longest Substring Without Repeating Characters
- spring中AOP——注解实现
- (二) JavaScript内置对象及常用方法
- 无线通信开题报告
- 排序之桶排序
- configure相关笔记整理
- OpenCV:1.Ubuntu下安装
- (三) 浏览器内置对象及常用方法
- HDU 1020
- js事件处理函数/监听函数
- mysql安装教程
- TOEFL writing——academic vocabulary
- 图片展示JQ
- Easy-题目50:38. Count and Say