
在上一個問題中,我詢問如何建立一個模擬我的嵌入式裝置環境的 chroot。有人建議我先在 chroot 中從原始碼 GCC 和 binutils 建置。為了嘗試此操作,我將主機上的 libc 和 gcc 二進位檔案的版本複製到了 chroot。然後我將一個簡單的 hello world 程式寫入檔案 test.c 並嘗試在我的 chroot 中建立如下
phil@phil-desktop:/usr$ sudo chroot /usr/embedded_chroot1/
bash-4.2# gcc test.c
gcc: error trying to exec 'cc1': execvp: No such file or directory
我不太確定這個錯誤是怎麼回事。我已將 gcc 二進位和 libc 複製到我的 chroot,為什麼我無法編譯?我還必須將所有系統原始檔和頭檔複製到我的 chroot 中嗎?我認為我對使用 chroot 的整個過程存在概念上的誤解。