[原创]交叉编译时,如何链接指定路径下的库文件
来源:互联网 发布:苹果手机虚拟专用网络 编辑:程序博客网 时间:2024/05/18 03:15
Autoconf book(4) AM_CONDITIONAL
ARG1: the name of a conditional ,
ARG2: a shell statement that is used to determine whether the conditional should be true or false.
If the shell code returns a successful status, then the conditional will be true. Any conditional in your `configure.in' is automatically available for use in any `Makefile.am' in that project.
http://ps-buaa.spaces.live.com/blog/cns!ACFF11BFA33D6971!180.entry
本人移植mount,在powerpc交叉编译时,用到的blkid库,需要到/home/user-name/ltib/rootfs/lib路径下查找。为了不改动源代码,这个问题如何解决呢?我找到了方法如下:
在整个工程的configure.in文件中加入如下代码,即在所有Makefile中引入条件变量MY_CROSS_COMPILE:
#configure.in
if test x$CC = xgcc; then
AC_MSG_WARN($BLKID --------------------------------------) #message only for test
AM_CONDITIONAL(MY_CROSS_COMPILE,false)
else
AC_MSG_WARN($BLKID +++++++++++++++++++++) #message only for test
AM_CONDITIONAL(MY_CROSS_COMPILE,true)
fi
在需要blkid库的Makefile.am文件中
if MY_CROSS_COMPILE #(目标机交叉编译)
AM_CPPFLAGS = -include $(top_builddir)/config.h -I ../include /
-DLOCALEDIR=/"$(localedir)/" -I /home/user-name/ltib/rootfs/usr/include
AM_CFLAGS = -fsigned-char -I /home/user-name/ltib/rootfs/usr/include
else #(PC机编译)
AM_CPPFLAGS = -include $(top_builddir)/config.h -I ../include /
-DLOCALEDIR=/"$(localedir)/"
AM_CFLAGS = -fsigned-char
endif
lib_mount_la_LIBADD = $(LDADD_common)
LDADD_common =
if MY_CROSS_COMPILE #(目标机交叉编译)
LDADD_common += -L$(LTIB_PATH)/rootfs/usr/lib -lblkid -luuid
else #(PC机编译)
LDADD_common += -lblkid -luuid
endif
- [原创]交叉编译时,如何链接指定路径下的库文件
- linux下C/C++编译时系统搜索 include 和 链接库 文件路径的指定
- linux下C/C++编译时系统搜索 include 和 链接库 文件路径的指定
- linux下C/C++编译时系统搜索 include 和 链接库 文件路径的指定
- linux下C/C++编译时系统搜索 include 和 链接库 文件路径的指定
- Linux下GCC 编译时如何指定链接库
- 嵌入式 Linux下GCC编译时如何指定链接库
- Linux下GCC 编译时为什么要指定链接库?如何指定链接库 ?
- gcc编译链接时指定头文件和库文件搜索路径
- 交叉编译时候如何设置连接库的搜索路径
- 交叉编译时候如何设置连接库的搜索路径
- 交叉编译时候如何配置连接库的搜索路径
- 交叉编译时候如何设置连接库的搜索路径
- 交叉编译时候如何配置连接库的搜索路径
- 交叉编译时候如何配置连接库的搜索路径
- 交叉编译时候如何设置连接库的搜索路径
- c/c++编译时,指定程序运行时查找的动态链接库路径
- c/c++编译时,指定程序运行时查找的动态链接库路径
- 通过获得加密串新设密码
- Ubuntu 9.10 删除旧内核
- jsp学习
- 呕吐。。。
- 每日更新的电驴 eMule/eDonkey 服务器列表
- [原创]交叉编译时,如何链接指定路径下的库文件
- c#泛型和反射的设计应用(一)
- 面向对象设计的11原则
- reactos操作系统实现(194)
- Smart Thread Pool By Ami Bar A smart Thread Pool implementation in .NET.
- 使用NUnit在.Net编程中进行单元测试
- 【转贴】浅谈软件测试自动化解决方案
- [原创]linux系统,ltib工具开发powerpc
- 【转】动态规划总结