busybox ync.c:(.text.sync_main+0x78): undefined reference to `syncfs' 出错
arm-linux-gcc4.4.3编译busybox-1.25.0
系统环境:
1、操作系统:Ubuntu16.04
2、交叉编译工具链:arm-linux-gcc4.4.3
3、busybox源码包:busybox-1.25.0
一、修改Makefile配置
首先解压源码包:
tar -jxvf busybox-1.25.0.tar.bz2
进入busybox-1.25.0目录,修改Makefile文件如下:
ARCH ?= arm
CROSS_COMPILE ?= arm-linux-
二、修改配置文件
make menuconfig
选择Busybox Settings--->Build Options--->,选择[*] Build Busybox as a static binary(no shared libs)
三、编译
make
出现如下错误:
miscutils/nandwrite.c: In function 'nandwrite_main':
miscutils/nandwrite.c:151: error: 'MTD_FILE_MODE_RAW' undeclared (first use in this function)
miscutils/nandwrite.c:151: error: (Each undeclared identifier is reported only once
miscutils/nandwrite.c:151: error: for each function it appears in.)
scripts/Makefile.build:197: recipe for target 'miscutils/nandwrite.o' failed
make[1]: *** [miscutils/nandwrite.o] Error 1
Makefile:742: recipe for target 'miscutils' failed
make: *** [miscutils] Error 2
解决办法:
MTD_FILE_MODE_RAW在/usr/include/mtd/mtd-abi.h中定义,直接在nandwrite.c中包含<mtd/mtd-abi.h>编译仍无法通过。将/usr/include/mtd/mtd-abi.h拷贝到busybox的include文件中,然后包含该头文件:
#include "libbb.h"
#include "mtd-abi.h"
#include <mtd/mtd-user.h>
编译可以通过。
继续make,出现如下错误:
util-linux/blkdiscard.c: In function 'blkdiscard_main':
util-linux/blkdiscard.c:72: error: 'BLKSECDISCARD' undeclared (first use in this function)
util-linux/blkdiscard.c:72: error: (Each undeclared identifier is reported only once
util-linux/blkdiscard.c:72: error: for each function it appears in.)
scripts/Makefile.build:197: recipe for target 'util-linux/blkdiscard.o' failed
make[1]: *** [util-linux/blkdiscard.o] Error 1
Makefile:742: recipe for target 'util-linux' failed
make: *** [util-linux] Error 2
解决办法:
BLKSECDISCARD在/usr/include/linux/fs.h中定义,方法如上所述,将/usr/include/linux/fs.h拷贝到busybox的include文件中,然后修改blkdiscard.c中头文件包含:
修改:#include <linux/fs.h>为
#include "fs.h"
继续make,编译通过,但是在链接的时候出现问题:
networking/lib.a(nslookup.o): In function `print_host':
nslookup.c:(.text.print_host+0x44): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
debianutils/lib.a(mktemp.o): In function `mktemp_main':
mktemp.c:(.text.mktemp_main+0x98): warning: the use of `mktemp' is dangerous, better use `mkstemp'
networking/lib.a(ipcalc.o): In function `ipcalc_main':
ipcalc.c:(.text.ipcalc_main+0x25c): warning: Using 'gethostbyaddr' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
libbb/lib.a(inet_common.o): In function `INET_resolve':
inet_common.c:(.text.INET_resolve+0x60): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
networking/lib.a(inetd.o): In function `reread_config_file':
inetd.c:(.text.reread_config_file+0x230): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
networking/lib.a(netstat.o): In function `ip_port_str':
netstat.c:(.text.ip_port_str+0x50): warning: Using 'getservbyport' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
util-linux/lib.a(nsenter.o): In function `nsenter_main':
nsenter.c:(.text.nsenter_main+0x1b0): undefined reference to `setns'
collect2: ld returned 1 exit status
Note: if build needs additional libraries, put them in CONFIG_EXTRA_LDLIBS.
Example: CONFIG_EXTRA_LDLIBS="pthread dl tirpc audit pam"
Makefile:717: recipe for target 'busybox_unstripped' failed
make: *** [busybox_unstripped] Error 1
解决办法:
make menuconfig
Linux System Utilities--->nsenter,去掉该选项,重新编译make,又出现如下错误:
networking/lib.a(nslookup.o): In function `print_host':
nslookup.c:(.text.print_host+0x44): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
debianutils/lib.a(mktemp.o): In function `mktemp_main':
mktemp.c:(.text.mktemp_main+0x98): warning: the use of `mktemp' is dangerous, better use `mkstemp'
networking/lib.a(ipcalc.o): In function `ipcalc_main':
ipcalc.c:(.text.ipcalc_main+0x25c): warning: Using 'gethostbyaddr' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
libbb/lib.a(inet_common.o): In function `INET_resolve':
inet_common.c:(.text.INET_resolve+0x60): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
networking/lib.a(inetd.o): In function `reread_config_file':
inetd.c:(.text.reread_config_file+0x230): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
networking/lib.a(netstat.o): In function `ip_port_str':
netstat.c:(.text.ip_port_str+0x50): warning: Using 'getservbyport' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
coreutils/lib.a(sync.o): In function `sync_main':
sync.c:(.text.sync_main+0x7c): undefined reference to `syncfs'
collect2: ld returned 1 exit status
Note: if build needs additional libraries, put them in CONFIG_EXTRA_LDLIBS.
Example: CONFIG_EXTRA_LDLIBS="pthread dl tirpc audit pam"
Makefile:717: recipe for target 'busybox_unstripped' failed
make: *** [busybox_unstripped] Error 1
解决办法:
make menuconfig
Coreutils--->sync选项去掉,重新make编译通过,生成了busybox可执行文件。
具体选项是什么意思还不太清楚,需要进一步理解。
原文: http://www.cnblogs.com/softhal/p/5769121.html
busybox ync.c:(.text.sync_main+0x78): undefined reference to `syncfs' 出错相关推荐
- sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'
eclipse下编译stm32工程出错: arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -O0 -fmessage-length=0 -fsigned-char ...
- 编译错误:In function `_sbrk_r‘:sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk‘
问题描述: GCC编译过程中报错: In function `_sbrk_r': sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk' ...
- linux中sqlite3编译时出错,Sqlite3 交叉编译 undefined reference to `fdatasync' 错误解决
交叉编译sqlite到Android平台, Android.mk 文件内容如下: LOCAL_PATH:= $(call my-dir) INCDIR:=/home/android-ndk-r6b/s ...
- VScode报错:undefined reference to ‘WinMain’ collect2.exe: error: ld returned 1 exit status
X:/MinGw/mingw64/bin/-/lib/gcc/x86_64-w64-mingw32/8.1.0/-/-/-/-/x86_64-w64-mingw32/lib/-/lib/libming ...
- 编译ffmpeg例程时,报错:undefined reference
编译ffmpeg例程,报了未定义错误: main.cpp:(.text+0x3a): undefined reference to avcodec_send_frame(AVCodecContext* ...
- 关于移植jSON编译时报错sbrkr.c:(.text+0xc): undefined reference to `_sbrk'处理
最近有个项目需要用到jSON函数,在移植了jSON后编译报错如下:sbrkr.c:(.text+0xc): undefined reference to `_sbrk'. 通过百度查询知道原来是GCC ...
- /tmp/ccAceHhY.o: In function `main': main.c:(.text+0xc7): undefined reference to `dlopen' main.c:
写一些调用dlopen函数的程序,编译的时候总是报: /tmp/ccAceHhY.o: In function `main': main.c:(.text+0xc7): undefined refer ...
- In function `sk_X509_EXTENSION_num': openssl.c:(.text+0xdf): undefined reference to `OPENSSL_sk_num'
问题描述: 在更新cmake时,遇到如下问题 lib/libcmcurl.a(openssl.c.o): In function `sk_X509_EXTENSION_num': openssl.c: ...
- gcc报(.text+0x24): undefined reference to `main‘collect2: error: ld returned 1 exit status解决方法
我已经记不清自己为什么这样解决了,重新搜索了一下也没发现类似的答案. 由于实验需要,我需要编译这个例子: https://github.com/grimm-co/GEARSHIFT/blob/trun ...
最新文章
- Internet Explorer 8 Beta2 常见问题解答
- CTF入门--http请求头
- 重写、重构、重载区别
- 统计学中【矩】的概念
- C语言购物篮解题思路,大型超购物篮问题分析数学建模.doc
- boost::factory实现对象工厂设计模式
- 关于html的一切(updating...)
- 中国 App 出海“变形记”
- Hadoop运行原理总结
- iOS两个强制旋转屏幕的方法
- Typora使用简介与插入数学公式
- Vue项目玩转Ueditor(百度富文本编辑器),解决图片需要上传服务器的问题,将图片转存base64字符串。
- AD9854PCB的绘制以及调试中存在的问题以及解决方法
- 等额本金和等额本息的区别
- OA系统管理项目工作内容
- 就这样吧,从此山水不相逢
- Activiti7工作流引擎-环境搭建及创建数据库
- 论文阅读:SuMa++
- 数据结构严蔚敏清华大学pdf_2019年清华大学自动化系控制工程专业大数据方向考研经验分享...
- Not FoundThe requested URL was not found on the server. If you entered the URL manually please chec