Skip to content

binary relocation: libtool control files: hardcoded paths to libstdc++.la are ploblematic #18694

@eugeneswalker

Description

@eugeneswalker

Libtool control files can contain hardcoded paths to libstdc++.la. This can break builds when packages that contain these hardcoded paths get cached in a build cache, and are then subsequently installed into a target environment where libstdc++.la is not in the same location.

For instance, if I build the dependencies of hpctoolkit in an environment where libstdc++.la is at

/spack-build/opt/spack/linux-centos7-x86_64/gcc-4.8.5/gcc-8.1.0-glpr3bujg7j5hxvesdbis4cjqzwlncth/lib/../lib64/libstdc++.la

Then the following files end up with this path hardcoded:

/spack-build/opt/spack/linux-centos7-x86_64/gcc-8.1.0/berkeley-db-18.1.40-uasyknrjfdzy2xfoswjqn36w7yzovyts/lib/libdb_cxx-18.1.la
/spack-build/opt/spack/linux-centos7-x86_64/gcc-8.1.0/berkeley-db-18.1.40-uasyknrjfdzy2xfoswjqn36w7yzovyts/lib/libdb_stl-18.1.la
/spack-build/opt/spack/linux-centos7-x86_64/gcc-8.1.0/gettext-0.21-md2v74tvbcqvsu56jmlre3p6mnms5tzm/lib/libasprintf.la
/spack-build/opt/spack/linux-centos7-x86_64/gcc-8.1.0/mpich-3.2.1-y2wrnnftiawtynzg4qzugcfqktatnh64/lib/libmpicxx.la
/spack-build/opt/spack/linux-centos7-x86_64/gcc-8.1.0/xerces-c-3.2.2-ba55khya5d3b6526s2lpzxadl24figaq/lib/libxerces-c.la

If I then cache all the dependencies of hpctoolkit, and subsequently install those dependencies into an environment where [email protected] is installed to /packages/gcc/8.1, this is what happens when you try to build hpctoolkit:

==> Installing hpctoolkit
==> hpctoolkit: Executing phase: 'autoreconf'
==> hpctoolkit: Executing phase: 'configure'
==> hpctoolkit: Executing phase: 'build'
==> Error: ProcessError: Command exited with status 2:
    'make' '-j16'

5 errors found in build log:
...
     1250    /bin/sh ../../../libtool  --tag=CXX   --mode=link /spack-test/lib/spack/env/gcc/g++ -g -O3 -Wall  -faligned-new -I/tmp/eugeneswalker/sp
             ack-stage/spack-stage-hpctoolkit-2020.08.03-h7pd5znfeg25vx5d7pijtvkrmqqnljrr/spack-src/src -I/tmp/eugeneswalker/spack-stage/spack-stage-hpctoolki
             t-2020.08.03-h7pd5znfeg25vx5d7pijtvkrmqqnljrr/spack-src/src -I/spack-test/opt/spack/linux-centos7-x86_64/gcc-8.1.0/binutils-2.33.1
             -qmxhsmfvocs5u4qfad3prpixgjtjocgo/include -I/spack-test/opt/spack/linux-centos7-x86_64/gcc-8.1.0/xerces-c-3.2.2-ba55khya5d3b6526s2
             lpzxadl24figaq/include  -g -O3 -Wall  -faligned-new -L/spack-test/opt/spack/linux-centos7-x86_64/gcc-8.1.0/xerces-c-3.2.2-ba55khya
             5d3b6526s2lpzxadl24figaq/lib -L/spack-test/opt/spack/linux-centos7-x86_64/gcc-8.1.0/xz-5.2.5-fqzrczlylvl333jhjlasdsc5n2ydugxo/lib
             -llzma  -o hpcprof-bin hpcprof_bin-main.o hpcprof_bin-Args.o ../../../src/lib/analysis/libHPCanalysis.la ../../../src/lib/banal/libHPCbanal_
             simple.la ../../../src/lib/profxml/libHPCprofxml.la ../../../src/lib/prof/libHPCprof.la ../../../src/lib/binutils/libHPCbinutils.la ../../..
             /src/lib/prof-lean/libHPCprof-lean.la ../../../src/lib/isa/libHPCisa.la -L/spack-test/opt/spack/linux-centos7-x86_64/gcc-8.1.0/int
             el-xed-2019.03.01-ivkiqjbbhifszwlm3ncetcnztjqr5gjy/lib -lxed ../../../src/lib/xml/libHPCxml.la ../../../src/lib/support/libHPCsupport.la ../
             ../../src/lib/support-lean/libHPCsupport-lean.la -L/spack-test/opt/spack/linux-centos7-x86_64/gcc-8.1.0/elfutils-0.180-s4ib3ctvhay
             jk7l3r2diozomettjzdwj/lib -ldw -lelf /spack-test/opt/spack/linux-centos7-x86_64/gcc-8.1.0/xz-5.2.5-fqzrczlylvl333jhjlasdsc5n2ydugx
             o/lib/liblzma.a -lxerces-c -lxerces-c /spack-test/opt/spack/linux-centos7-x86_64/gcc-8.1.0/binutils-2.33.1-qmxhsmfvocs5u4qfad3prpi
             xgjtjocgo/lib/libbfd.a /spack-test/opt/spack/linux-centos7-x86_64/gcc-8.1.0/binutils-2.33.1-qmxhsmfvocs5u4qfad3prpixgjtjocgo/lib64
             /libiberty.a -ldl /spack-test/opt/spack/linux-centos7-x86_64/gcc-8.1.0/zlib-1.2.11-sh7mgsynw6uq2lkaqsv4ty5zerjfu7ww/lib/libz.a -lm
  >> 1251    libtool:   error: cannot find the library '/spack-test/opt/spack/linux-centos7-x86_64/gcc-4.8.5/gcc-8.1.0-glpr3bujg7j5hxvesdbis4cj
             qzwlncth/lib/../lib64/libstdc++.la' or unhandled argument '/spack-test/opt/spack/linux-centos7-x86_64/gcc-4.8.5/gcc-8.1.0-glpr3buj
             g7j5hxvesdbis4cjqzwlncth/lib/../lib64/libstdc++.la'
  >> 1252    make[3]: *** [hpcprof-bin] Error 1
     1253    make[3]: Leaving directory `/tmp/eugeneswalker/spack-stage/spack-stage-hpctoolkit-2020.08.03-h7pd5znfeg25vx5d7pijtvkrmqqnljrr/spack-src/src/tool/
             hpcprof'
  >> 1254    make[2]: *** [all-recursive] Error 1
     1255    make[2]: Leaving directory `/tmp/eugeneswalker/spack-stage/spack-stage-hpctoolkit-2020.08.03-h7pd5znfeg25vx5d7pijtvkrmqqnljrr/spack-src/src/tool'
  >> 1256    make[1]: *** [all-recursive] Error 1
     1257    make[1]: Leaving directory `/tmp/eugeneswalker/spack-stage/spack-stage-hpctoolkit-2020.08.03-h7pd5znfeg25vx5d7pijtvkrmqqnljrr/spack-src/src'
  >> 1258    make: *** [all-recursive] Error 1
...

Notice in the error output that although the Spack install_tree was re-written, where the original install tree of /spack-build/opt/spack was replaced with /spack-test/opt/spack, you still have these paths:

  >> 1251    libtool:   error: cannot find the library '/spack-test/opt/spack/linux-centos7-x86_64/gcc-4.8.5/gcc-8.1.0-glpr3bujg7j5hxvesdbis4cj
             qzwlncth/lib/../lib64/libstdc++.la' or unhandled argument '/spack-test/opt/spack/linux-centos7-x86_64/gcc-4.8.5/gcc-8.1.0-glpr3buj
             g7j5hxvesdbis4cjqzwlncth/lib/../lib64/libstdc++.la'

@gartung @alalazo @tgamblin @becker33 @scottwittenburg

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions