busybox編譯出現問題

2021-07-31 21:45:14 字數 1666 閱讀 2462

一、修改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

出現如下錯誤:

解決辦法:

mtd_file_mode_raw在/usr/include/mtd/mtd-abi.h中定義,直接在nandwrite.c中包含編譯仍無法通過。將/usr/include/mtd/mtd-abi.h拷貝到busybox的include檔案中,然後包含該標頭檔案:

#include "libbb.h"

#include "mtd-abi.h"

#include

編譯可以通過。

繼續make,出現如下錯誤:

解決辦法:

blksecdiscard在/usr/include/linux/fs.h中定義,方法如上所述,將/usr/include/linux/fs.h拷貝到busybox的include檔案中,然後修改blkdiscard.c中標頭檔案包含:

修改:#include 為

#include "fs.h"

繼續make,編譯通過,但是在鏈結的時候出現問題:

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,又出現如下錯誤:

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可執行檔案。

具體選項是什麼意思還不太清楚,需要進一步理解。

編譯出現File name too long問題

今天編譯1個libffi時,出現了file name too long問題,make 7 stat ffitarget.h file name too long make 7 no rule to make target ffitarget.h needed by all am stop.剛開始以為...

使用json庫 編譯出現的問題

在使用json的lib庫時候出現的錯誤 msvcprtd.lib msvcp100d.dll error lnk2005 public void thiscall std container base12 orphan all void orphan all container base12 std...

編譯出現的問題解決

知識點的補充 異常處理 1.讓乙個函式發現了自己無法處理的錯誤時throw丟擲異常。乙個庫的作者可以檢測出發生怎樣的錯誤,卻不知道如何處理 庫的使用者處理錯誤,卻無法檢測何時發生。這就需要最基本的異常檢測 2.c 中的錯誤 3.c語言使用的方法 exception logic error bad a...