diff mbox

[v3] support/dependencies: ensure we have 'file' on the host

Message ID 1482775110-24421-1-git-send-email-yann.morin.1998@free.fr
State Accepted
Headers show

Commit Message

Yann E. MORIN Dec. 26, 2016, 5:58 p.m. UTC
Recently, the autoconf macros for libtool started using '/usr/bin/file'
to determine the type of library that is generated by the toolchain.
Packages that use this recent version of the libtool autoconf macros
will fail in a rather dramatic way when /usr/bin/file is not present
on the host: the package will still build but no shared library is
generated, which in turn may cause build failures in other packages
that link with it.

For example, libpng's configure determines that it is not possible to
build a shared library on MIPS64 because the expected output from 'file'
is not present. Therefore, only a static libpng.a is built. Later,
bandwithd links with -lpng but it doesn't use the pkg-config's
Private-Libs (because it's not linking statically) and it doesn't have
access to the NEEDED reference from the shared library. Therefore, it
doesn't link with zlib and fails with

    pngrutil.c:(.text+0x55c): undefined reference to `inflate'

We cant use host-file because it is itself an autotools package and is
itself using libtool, so this would be a chicken-n-egg problem. Besides,
the libtool script really wants to call /usr/bin/file, so it would not
even find our host-file anyway.

So, just require that '/usr/bin/file' is present on the host.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Arnout Vandecappelle <arnout@mind.be>
Cc: Baruch Siach <baruch@tkos.co.il>

---
Changes v2 -> v3:
  - explicitly check for /usr/bin/file  (arnout)
  - reword commit log  (Arnout)

Changes v1 -> v2:
  - use better commit log by Arnout  (Arnout)
  - update manual  (Baruch)
---
 docs/manual/prerequisite.txt         | 1 +
 support/dependencies/dependencies.sh | 4 ++++
 2 files changed, 5 insertions(+)

Comments

Arnout Vandecappelle Dec. 27, 2016, 9:35 a.m. UTC | #1
On 26-12-16 18:58, Yann E. MORIN wrote:
> Recently, the autoconf macros for libtool started using '/usr/bin/file'
> to determine the type of library that is generated by the toolchain.
> Packages that use this recent version of the libtool autoconf macros
> will fail in a rather dramatic way when /usr/bin/file is not present
> on the host: the package will still build but no shared library is
> generated, which in turn may cause build failures in other packages
> that link with it.
> 
> For example, libpng's configure determines that it is not possible to
> build a shared library on MIPS64 because the expected output from 'file'
> is not present. Therefore, only a static libpng.a is built. Later,
> bandwithd links with -lpng but it doesn't use the pkg-config's
> Private-Libs (because it's not linking statically) and it doesn't have
> access to the NEEDED reference from the shared library. Therefore, it
> doesn't link with zlib and fails with
> 
>     pngrutil.c:(.text+0x55c): undefined reference to `inflate'
> 
> We cant use host-file because it is itself an autotools package and is
> itself using libtool, so this would be a chicken-n-egg problem. Besides,
> the libtool script really wants to call /usr/bin/file, so it would not
> even find our host-file anyway.
> 
> So, just require that '/usr/bin/file' is present on the host.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Arnout Vandecappelle <arnout@mind.be>
> Cc: Baruch Siach <baruch@tkos.co.il>
> 

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>


 Regards,
 Arnout

> ---
> Changes v2 -> v3:
>   - explicitly check for /usr/bin/file  (arnout)
>   - reword commit log  (Arnout)
> 
> Changes v1 -> v2:
>   - use better commit log by Arnout  (Arnout)
>   - update manual  (Baruch)
> ---
>  docs/manual/prerequisite.txt         | 1 +
>  support/dependencies/dependencies.sh | 4 ++++
>  2 files changed, 5 insertions(+)
> 
> diff --git a/docs/manual/prerequisite.txt b/docs/manual/prerequisite.txt
> index 7edad1f..ac0ab62 100644
> --- a/docs/manual/prerequisite.txt
> +++ b/docs/manual/prerequisite.txt
> @@ -35,6 +35,7 @@ between distributions).
>  ** +python+ (version 2.6 or any later)
>  ** +unzip+
>  ** +rsync+
> +** +file+ (must be in +/usr/bin/file+)
>  
>  * Source fetching tools:
>  ** +wget+
> diff --git a/support/dependencies/dependencies.sh b/support/dependencies/dependencies.sh
> index bfd6596..168d196 100755
> --- a/support/dependencies/dependencies.sh
> +++ b/support/dependencies/dependencies.sh
> @@ -69,6 +69,10 @@ check_prog_host "which"
>  # Verify that sed is installed
>  check_prog_host "sed"
>  
> +# 'file' must be present and must be exactly /usr/bin/file,
> +# otherwise libtool fails in incomprehensible ways.
> +check_prog_host "/usr/bin/file"
> +
>  # Check make
>  MAKE=$(which make 2> /dev/null)
>  if [ -z "$MAKE" ] ; then
>
Thomas Petazzoni Dec. 27, 2016, 5:07 p.m. UTC | #2
Hello,

On Mon, 26 Dec 2016 18:58:30 +0100, Yann E. MORIN wrote:
> Recently, the autoconf macros for libtool started using '/usr/bin/file'
> to determine the type of library that is generated by the toolchain.
> Packages that use this recent version of the libtool autoconf macros
> will fail in a rather dramatic way when /usr/bin/file is not present
> on the host: the package will still build but no shared library is
> generated, which in turn may cause build failures in other packages
> that link with it.
> 
> For example, libpng's configure determines that it is not possible to
> build a shared library on MIPS64 because the expected output from 'file'
> is not present. Therefore, only a static libpng.a is built. Later,
> bandwithd links with -lpng but it doesn't use the pkg-config's
> Private-Libs (because it's not linking statically) and it doesn't have
> access to the NEEDED reference from the shared library. Therefore, it
> doesn't link with zlib and fails with
> 
>     pngrutil.c:(.text+0x55c): undefined reference to `inflate'
> 
> We cant use host-file because it is itself an autotools package and is
> itself using libtool, so this would be a chicken-n-egg problem. Besides,
> the libtool script really wants to call /usr/bin/file, so it would not
> even find our host-file anyway.
> 
> So, just require that '/usr/bin/file' is present on the host.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Arnout Vandecappelle <arnout@mind.be>
> Cc: Baruch Siach <baruch@tkos.co.il>
> 
> ---
> Changes v2 -> v3:
>   - explicitly check for /usr/bin/file  (arnout)
>   - reword commit log  (Arnout)

Applied to master, thanks.

Thomas
diff mbox

Patch

diff --git a/docs/manual/prerequisite.txt b/docs/manual/prerequisite.txt
index 7edad1f..ac0ab62 100644
--- a/docs/manual/prerequisite.txt
+++ b/docs/manual/prerequisite.txt
@@ -35,6 +35,7 @@  between distributions).
 ** +python+ (version 2.6 or any later)
 ** +unzip+
 ** +rsync+
+** +file+ (must be in +/usr/bin/file+)
 
 * Source fetching tools:
 ** +wget+
diff --git a/support/dependencies/dependencies.sh b/support/dependencies/dependencies.sh
index bfd6596..168d196 100755
--- a/support/dependencies/dependencies.sh
+++ b/support/dependencies/dependencies.sh
@@ -69,6 +69,10 @@  check_prog_host "which"
 # Verify that sed is installed
 check_prog_host "sed"
 
+# 'file' must be present and must be exactly /usr/bin/file,
+# otherwise libtool fails in incomprehensible ways.
+check_prog_host "/usr/bin/file"
+
 # Check make
 MAKE=$(which make 2> /dev/null)
 if [ -z "$MAKE" ] ; then