Linux下编程实用方法-编译源代码出错解决
2015-11-25 23:58
681 查看
方法一:得到Linux下命令源码的方法:Sam常需要在嵌入式Linux上实现一些busybox没有提供的,与Linux命令类似的功能。可以很方便的找到源码:例如,需要找到df的源码。#rpm -qf `which df`得到安装包为:coreutils-6.9-9.fc8于是下载coreutils源码。通常都可以在www.gun.org下找到。方法二:编译glibc.因为新版本Fedora下不带libc.a.所以想自己编译一个。原来问题挺多的。ftp://ftp.gnu.org/gnu/glibc/下载了对应版本。#cd glibc-2.14#./configureconfigure: error: you must configure in a separate build directory不明白怎么回事。google之后才知道要创建一个build目录。#mkdir ../glibc_build/#cd ../glibc_build#../glibc-2.14/configure --exec-prefix=/home/sam/temp --prefix=/home/sam/temp --with-tls --with-arch=i686在编译glibc的过程中可能出现错误:“../sysdeps/i386/fpu/s_frexp.S:66: Error: invalid identifier for ".ifdef"”,解决方法是:1)、在glibc源码目录下找到文件:nptl/sysdeps/pthread/pt-initfini.c,找到第46行附近:asm ("\n#include \"defs.h\"");在其后添加代码:asm ("\n#if defined __i686 && defined __ASSEMBLER__");asm ("\n#undef __i686");asm ("\n#define __i686 __i686");asm ("\n#endif");2)、在glibc源码目录下找到文件:sysdeps/unix/sysv/linux/i386/sysdep.h,找到第30行附近:#include <tls.h>,在其后添加代码:#if defined __i686 && defined __ASSEMBLER__#undef __i686#define __i686 __i686#endif重新make
相关文章推荐
- CVE-2015-0235:Linux glibc高危漏洞修复方法
- 关于gcc、glibc和binutils模块之间的关系
- 程序入口函数和glibc及C++全局构造和析构
- 用brk实现sbrk,关于brk的返回值
- strcmp/strncmp源码分析
- glibc库的交叉编译及使用
- libc死机问题一(invalid pointer、数组或者指针越界)
- glibc源代码的阅读
- cross_compile glibc for arm
- 交叉编译库移植
- CentOS 64bit 安装 32bit 的glibc
- gcc连接文件error: /usr/lib64/libstdc++.so.6: version 'GLIBCXX_3.X.XX‘ not found
- linux 安装 mysql 的 glibc 包
- GLIBC中NPTL线程实现代码阅读
- Linux下GLIBCXX和GLIBC版本低造成的编译错误的解决方案
- Linux/CentOS 升级C基本运行库CLIBC的注意事项(当想解决GLIBC_2.x找不到的编译问题)
- libc2.14安装
- libc.so.6误删除,补救措施
- /lib/libncurses.so: undefined reference to `__fdelt_chk@GLIBC_2.15' collect2: ld
- Centos 升级 glibc 时失败, 解决方案