如何為 VirtualBox 來賓新增安裝指定編譯器?

如何為 VirtualBox 來賓新增安裝指定編譯器?

我希望能夠使用特定版本gcc在 Ubuntu 14.04 來賓中建立 VirtualBox 5.0.16 來賓新增項,以避免錯誤。VBoxLinuxAdditions.run --help不提供任何資訊也不建構說明

我從內建功能Insert Guest Additions CD image選單項目取得來賓新增二進位文件,該選單項目會在 Ubuntu 中自動安裝 ISO。

答案1

對原始程式碼的進一步檢查表明它們使用 automake,您可以使用 Makefile 將用來編譯原始程式碼的環境變數來設定編譯器。

位置源被混淆。要找到完整的原始程式碼,您需要找到附加到 VBoxLinuxAdditions.run shell 腳本末尾的 tar 檔案並將其解壓,它包含兩個包含原始程式碼的 tar 檔案。 (VBoxGuestAdditions-x86.tar.bz2 和 ./VBoxGuestAdditions-amd64.tar.bz2)這是將在客戶端編譯的程式碼。 shell 腳本需要稍微修改一下才能轉儲檔案。

一旦您獲得了來源 tar 解壓縮所需的檔案並使用,make CC=<path to required gcc>您應該能夠指定您希望建置使用的編譯器。

Some influential environment variables:
   CC          C compiler command
   CFLAGS      C compiler flags
   LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
               nonstandard directory <lib dir>
   LIBS        libraries to pass to the linker, e.g. -l<library>
   CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
   LT_SYS_LIBRARY_PATH
              User-defined run-time library search path.
   CPP         C preprocessor
   CXX         C++ compiler command
   CXXFLAGS    C++ compiler flags
   CXXCPP      C++ preprocessor

相關內容