habitat-sh / core-plans

Core Habitat Plan definitions
130 stars 252 forks source link

[libtool]: libtool runtime depends on buildtime packages #3395

Open gavindidrichsen opened 4 years ago

gavindidrichsen commented 4 years ago

The core/libtool runtime seems to require some of the packages used at build time. This issue only seems to be apparent when using the libtool --config; files are directories that appear in this output seem to be set at build time so in another runtime environment, these same files/directories may not actually exist.

Context

Notice that libtool --config returns a number of (1) binary paths including GREP, SED, and NM and (2) directories:

[17][default:/src:0]# /hab/pkgs/core/libtool/2.4.6/20200612110137/bin/libtool --config
...
...

# A sed program that does not truncate output.
SED="/hab/pkgs/core/sed/4.5/20200305230928/bin/sed"
...
...
# A grep program that handles long lines.
GREP="/hab/pkgs/core/grep/3.3/20200305232635/bin/grep"

# An ERE matcher.
EGREP="/hab/pkgs/core/grep/3.3/20200305232635/bin/grep -E"

# A literal string matcher.
FGREP="/hab/pkgs/core/grep/3.3/20200305232635/bin/grep -F"

# A BSD- or MS-compatible name lister.
NM="/hab/pkgs/core/binutils/2.32/20200305174809/bin/nm -B"
...
...

# LTCC compiler flags.
LTCFLAGS="-I/hab/pkgs/core/make/4.2.1/20200306002515/include -I/hab/pkgs/core/gcc/9.1.0/20200305180723/include -I/hab/pkgs/core/glibc/2.29/20200305172459/include -I/hab/pkgs/core/binutils/2.32/20200305174809/include"

...
...
# Command to truncate a binary pipe.
lt_truncate_bin="/hab/pkgs/core/coreutils/8.30/20200305231640/bin/dd bs=4096 count=1"
...
...

# The linker used to build libraries.
LD="/hab/pkgs/core/binutils/2.32/20200305174809/bin/ld"
...
...
# The library search path used internally by the compiler when linking
# a shared library.
compiler_lib_search_path=""

[18][default:/src:0]# 

However, some binaries and directories do not actually exist on the installation environment, like:

     ×  File /hab/pkgs/core/coreutils/8.30/20200305231640/bin/dd  is expected to exist
     expected File /hab/pkgs/core/coreutils/8.30/20200305231640/bin/dd  to exist

and at least 2 of the include directories:

     ×  File /hab/pkgs/core/make/4.2.1/20200306002515/include is expected to exist
     expected File /hab/pkgs/core/make/4.2.1/20200306002515/include to exist
     ×  File /hab/pkgs/core/gcc/9.1.0/20200305180723/include is expected to exist
     expected File /hab/pkgs/core/gcc/9.1.0/20200305180723/include to exist
gavindidrichsen commented 4 years ago

Update. The above issue seems to happen when doing a 'cold-boot' of core/libtool in a new environment. In other words, open a new hab studio, hab pkg install the core/libtool and then check the existence of all files and directories contained in the libtool --config. For example:

hab studio enter
hab pkg install core/libtool --binlink
libtool --config

after testing for file/directory existence something like the following was observed:

     ×  File /hab/pkgs/core/make/4.2.1/20200306002515/include is expected to exist
     expected File /hab/pkgs/core/make/4.2.1/20200306002515/include to exist
     ×  File /hab/pkgs/core/gcc/9.1.0/20200305180723/include is expected to exist
     expected File /hab/pkgs/core/gcc/9.1.0/20200305180723/include to exist

However, after re-building core/libtool in the same hab studio environment, the above failures disappear:

     ✔  File /hab/pkgs/core/make/4.2.1/20200306002515/include is expected to exist
     ✔  File /hab/pkgs/core/gcc/9.1.0/20200305180723/include is expected to exist
     ✔  File /hab/pkgs/core/glibc/2.29/20200305172459/include is expected to exist
     ✔  File /hab/pkgs/core/binutils/2.32/20200305174809/include is expected to exist

Interpretation? It seems that core/libtool configures itself according to the dependencies that are in its build environment. The same dependencies, however, may not appear in the downstream environment