0

I'm trying to build a library on a remote CI server, but I don't have root privileges. The library requires autoconf, automake and libtool packages to be installed. I can't do that with apt-get install, so I tried to do a workaround: downloading the .deb packages and exporting PATHs so that autoconf, libtoolize, etc. can be found.

The problem is that the binaries in these packages have some paths to additional scripts (installed as part of the packages) hard-coded. Now I get this error:

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

Is there a way to change this default path with an environment variable (in the same way as here https://superuser.com/a/1144948/62460)?

I tried exporting $pkgltdldir but that didn't work.

Machta
  • 101

2 Answers2

1

In the shell script libtoolize (version 2.4.2 and 2.4.6), four variables are hardcoded:

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

Soon afterwards there is the following section:

# 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"

Setting $_lt_pkgdatadir to the libtool directory will thus work (works for me - but only if the aclocal directory is in a subdirectory of libltdl named m4).

Given this, your sed solution seems quite sensible.

fsbooks
  • 11
1

I ran into the same problem here:

Building lighttpd-1.4.59 as non-root user

mobile$ ./autogen.sh

main::scan_file() called too early to check prototype at /usr/bin/aclocal line 622. autom4te: cannot open autom4te.cache/requests: Permission denied aclocal: /usr/bin/autom4te failed with exit status: 1 autoreconf: aclocal failed with exit status: 1 build requires autoconf automake libtool m4 pcre pcre-devel pkg-config

Building lighttpd-1.4.59 as root user

root# ./autogen.sh

main::scan_file() called too early to check prototype at /usr/bin/aclocal line 622. libtoolize: $pkgltdldir is not a directory: `/syslol/share/libtool' autoreconf: libtoolize failed with exit status: 1 build requires autoconf automake libtool m4 pcre pcre-devel pkg-config

The ./autogen.sh tries to locate the `/syslol/share/libtool' libtool directory from the given path directory.

Therefore, create the directory tree `/syslol/share/libtool' as follows

root# mkdir -p /syslol/share/libtool

Let's find libtool directory

root# find / -type d -name libtool

/share/libtool

Add a symbolic link to reference the `/share/libtool' directory

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

Run the build a second time

root# ./autogen.sh

main::scan_file() called too early to check prototype at /usr/bin/aclocal line 622. libtoolize: $aclocaldir is not a directory: `/syslol/share/aclocal' autoreconf: libtoolize failed with exit status: 1 build requires autoconf automake libtool m4 pcre pcre-devel pkg-config

This shows that we also need to link aclocal directory to this path `/syslol/share/aclocal'

Create aclocal within the /syslol/share directory

root# mkdir -p /syslol/share/aclocal

Lets find the location of aclocal directory :

root# find / -type d -name aclocal

/share/aclocal

/usr/local/share/aclocal

/usr/share/aclocal

We'll choose the /share/aclocal/ path for linking

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

Third dry run:

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 filem4/ltoptions.m4' libtoolize: copying file m4/ltsugar.m4' libtoolize: copying filem4/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

We've fixed the path problem, though still have automake problem Have to update Automake for a succcesful build.

Distributed automake version files can be found at Versions and for current I found at Automake version 1.13

Lets replace version automake version 1.11.2 with version 1.13

Backup the original binary

mobile$ which automake

/usr/bin/automake

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

Creating a new automake config file with content of version 1.13

root # cat > /usr/bin/automake

paste content from site here

^D

Add execute permission

root # chmod +x /usr/bin/automake

Fourth compilation

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 filem4/libtool.m4' libtoolize: copying file m4/ltoptions.m4' libtoolize: copying filem4/ltsugar.m4' libtoolize: copying file m4/ltversion.m4' libtoolize: copying filem4/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.

We have a successful build