如何從非標準目錄運行自動工具?

如何從非標準目錄運行自動工具?

我正在嘗試在遠端 CI 伺服器上建立一個庫,但我沒有 root 權限。該程式庫需要安裝 autoconf、automake 和 libtool 軟體包。我無法使用 apt-get install 來做到這一點,所以我嘗試做一個解決方法:下載 .deb 套件並匯出 PATH,以便可以找到 autoconf、libtoolize 等。

問題是這些套件中的二進位檔案有一些硬編碼的附加腳本(作為套件的一部分安裝)的路徑。現在我得到這個錯誤:

libtoolize: $pkgltdldir is not a directory: `/usr/share/libtool'

有沒有辦法使用環境變數來變更此預設路徑(與此處的方式相同)https://superuser.com/a/1144948/62460)?

我嘗試過導出$pkgltdldir,但沒有成功。

答案1

在 shell 腳本 libtoolize(版本 2.4.2 和 2.4.6)中,四個變數被硬編碼:

   datadir=/usr/share
   pkgdatadir=/usr/share/libtool
   pkgltdldir=/usr/share/libtool
   aclocaldir=/usr/share/aclocal

不久後就有以下部分:

# Allow the user to override the master libtoolize repository:
if test -n "$_lt_pkgdatadir"; then
    pkgltdldir="$_lt_pkgdatadir"
    pkgdatadir="$_lt_pkgdatadir/libltdl"
    aclocaldir="$_lt_pkgdatadir/libltdl/m4"

因此,將 $_lt_pkgdatadir 設為 libtool 目錄將起作用(對我有效 - 但前提是 aclocal 目錄位於名為 m4 的 libltdl 子目錄中)。

有鑑於此,您的 sed 解決方案似乎非常明智。

答案2

我在這裡遇到了同樣的問題:

以非root使用者身分建置lighttpd-1.4.59

移動$ ./autogen.sh

main::scan_file() 呼叫得太早,無法檢查 /usr/bin/aclocal 第 622 行的原型。沒有權限aclocal:/usr/bin/autom4te 失敗,退出狀態:1 autoreconf:aclocal 失敗,退出狀態:1 建置需要 autoconf automake libtool m4 pcre pcre-devel pkg-config

以root使用者身分建置lighttpd-1.4.59

根#./autogen.sh

main::scan_file() 呼叫得太早,無法檢查 /usr/bin/aclocal 第 622 行的原型。$pkgltdldir 不是目錄:`/syslol/share/libtool'autoreconf:libtoolize 失敗,退出狀態:1 建置需要 autoconf automake libtool m4 pcre pcre-devel pkg-config

./autogen.sh試著找出`/syslol/共享/libtool' 給定路徑目錄中的 libtool 目錄。

因此,建立目錄樹`/syslol/共享/libtool' 如下

root# mkdir -p /syslol/share/libtool

讓我們找到libtool目錄

root# find / -type d -name libtool

/共享/libtool

新增符號連結以引用“/share/libtool”目錄

root# ln -s /share/libtool/* /syslol/share/libtool/

第二次運行構建

根#./autogen.sh

main::scan_file() 呼叫得太早,無法檢查 /usr/bin/aclocal 第 622 行的原型。 `/syslol/share/aclocal'autoreconf:libtoolize 失敗,退出狀態:1 建置需要 autoconf automake libtool m4 pcre pcre-devel pkg-config

這說明我們還需要將 aclocal 目錄連結到這個路徑`/syslol/share/aclocal'

在 /syslol/share 目錄中建立 aclocal

root# mkdir -p /syslol/share/aclocal

讓我們找到 aclocal 目錄的位置:

root# find / -type d -name aclocal

/共享/aclocal

/usr/local/共享/aclocal

/usr/share/aclocal

出色地選擇/share/aclocal/連結路徑

root# ln -s /share/aclocal/* /syslol/share/aclocal/

第三次試運行:

root# ./autogen.sh

main::scan_file() called too early to check prototype at /usr/bin/aclocal line 622.
`'libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
main::scan_file() called too early to check prototype at /usr/bin/aclocal line 622.
Unescaped left brace in regex is deprecated here (and will be fatal in Perl 5.30), passed through in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at /usr/bin/automake line 4153.
configure.ac:24: require Automake 1.13, but have 1.11.2
autoreconf: automake failed with exit status: 1
build requires autoconf automake libtool m4 pcre pcre-devel pkg-config

我們已經解決了路徑問題,雖然還有自動製造問題 必須 更新 汽車製造商為了成功構建

分散式 automake 版本檔案可以在以下位置找到版本目前我發現Automake版本1.13

讓我們用版本 1.13 取代版本 automake 版本 1.11.2

備份原始二進位文件

mobile$ 哪個汽車製造商

/usr/bin/automake

根 # mv /usr/bin/automake /usr/bin/automake1.11.2

使用版本 1.13 的內容建立新的 automake 設定檔

根 # cat > /usr/bin/automake

將網站內容貼到此處

^D

新增執行權限

根 # chmod +x /usr/bin/automake

第四次編譯

root # ./autogen.sh

main::scan_file() called too early to check prototype at /usr/bin/aclocal line 622.
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
main::scan_file() called too early to check prototype at /usr/bin/aclocal line 622.
Now type './configure ...' and 'make' to compile.

我們已經成功地建構了

相關內容