Skip to content

Buildache install fix: replace placeholder and origin install paths in rpath when relocating binaries #10287

Closed
gartung wants to merge 23 commits intospack:developfrom
gartung:buildcache-placeholder-fix
Closed

Buildache install fix: replace placeholder and origin install paths in rpath when relocating binaries #10287
gartung wants to merge 23 commits intospack:developfrom
gartung:buildcache-placeholder-fix

Conversation

@gartung
Copy link
Copy Markdown
Member

@gartung gartung commented Jan 9, 2019

This fixes a problem where the placeholder path was not in the first rpath entry. This was seen in c++ libraries and binaries because the compiler was outside the spack install base path and always appears first in the rpath.

Instead of checking the first rpath entry, all rpaths have the placeholder path and the old install path (if it exists) replaced with the new install path.

The second commit changes the check for old install path strings by using the install prefix instead of the install root.

@gartung gartung mentioned this pull request Jan 9, 2019
3 tasks
@gartung
Copy link
Copy Markdown
Member Author

gartung commented Jan 9, 2019

@tgamblin

@gartung gartung added WIP and removed WIP labels Jan 9, 2019
@gartung
Copy link
Copy Markdown
Member Author

gartung commented Jan 9, 2019

Pending merge of
#10073

@gartung gartung force-pushed the buildcache-placeholder-fix branch from 28cffb9 to 1f9456f Compare January 11, 2019 23:26
@gartung gartung requested review from scheibelp and tgamblin January 14, 2019 15:22
alalazo and others added 6 commits January 15, 2019 17:03
This is similar to `spack spec -I` but highlights which nodes in a DAG
are relocatable and which are not.

spec.tree has been generalized a little to accept a status function,
instead of always showing the install status

The current implementation works only for ELF, and needs to be
generalized to other platforms.
This test requires a few commands to be present in the environment.
Currently it will run only under python 3.7 (which uses Xenial instead
of Trusty).
@gartung
Copy link
Copy Markdown
Member Author

gartung commented Feb 5, 2019

@tgamblin

Copy link
Copy Markdown
Member

@tgamblin tgamblin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gartung: this looks good to me, but could you add some more tests for this stuff? The coverage on binary caching is currently kind of low, and I'd like to see some simple tests on mock packages that build dummy libraries and relocate them. Is that feasible? It could be in a separate PR if this needs to go in soon, but it would be really nice to have better regression coverage for the bincache parts of the code.

@gartung gartung removed the request for review from scheibelp February 8, 2019 15:13
@gartung
Copy link
Copy Markdown
Member Author

gartung commented Feb 8, 2019

@tgamblin the code coverage report link times out. How can I reproduce this on my machine?

@tgamblin
Copy link
Copy Markdown
Member

tgamblin commented Feb 8, 2019

@gartung: codecov seems to be having issues. I pushed a commit to see whether it'll work if we generate fewer reports (they seem to crash on merging lots of reports for PRs).

If you do want to run this locally, you can do this (from the spack root). You'll need the Python coverage tool installed.

coverage run spack test
coverage combine
coverage html

Might need some options on the above, but that is the gist of it. You should get a directory with a local HTML coverage view if you're successful. Also, if you want to zoom in on one part, you can run, e.g.: coverage run spack test packaging to focus on the biuldcache stuff.

@gartung
Copy link
Copy Markdown
Member Author

gartung commented Feb 15, 2019

I would like to cherry-pick the changes from #9199 #9440 #9600 #10274 that involve the buildcache command and put them in this PR. I will try to resolve merge conflicts.

@gartung
Copy link
Copy Markdown
Member Author

gartung commented Feb 15, 2019

Close for now so every commit os not tested.

@gartung gartung closed this Feb 15, 2019
@gartung
Copy link
Copy Markdown
Member Author

gartung commented Feb 15, 2019

Re-open for comments.

@gartung gartung reopened this Feb 15, 2019
@gartung
Copy link
Copy Markdown
Member Author

gartung commented Feb 28, 2019

This error was produced when trying to create a buildcache for [email protected] that was linked against system zlib which has an entry for a version 1.2.7 that does not exists in the zlib package.py. The real cause of the error is in spec.full_hash().

  zlib:
    paths:
      [email protected]+optimize+pic+shared arch=linux-rhel7-x86_64: /usr
==> [2019-02-27-20:52:54.622705] Warning: Missing a source id for [email protected]
Traceback (most recent call last):
  File "/build/work/spack-tools/spack/bin/spack", line 48, in <module>
    sys.exit(spack.main.main())
  File "/build/work/spack-tools/spack/lib/spack/spack/main.py", line 675, in main
    return _invoke_command(command, parser, args, unknown)
  File "/build/work/spack-tools/spack/lib/spack/spack/main.py", line 446, in _invoke_command
    return_val = command(parser, args)
  File "/build/work/spack-tools/spack/lib/spack/spack/cmd/buildcache.py", line 528, in buildcache
    args.func(args)
  File "/build/work/spack-tools/spack/lib/spack/spack/cmd/buildcache.py", line 326, in createtarball
    not args.no_rebuild_index)
  File "/build/work/spack-tools/spack/lib/spack/spack/binary_distribution.py", line 363, in build_tarball
    spec_dict['full_hash'] = spec.full_hash()
  File "/build/work/spack-tools/spack/lib/spack/spack/spec.py", line 1306, in full_hash
    package_hash = self.package.content_hash()
  File "/build/work/spack-tools/spack/lib/spack/spack/package.py", line 1092, in content_hash
    for p in self.spec.patches)
  File "/build/work/spack-tools/spack/lib/spack/llnl/util/lang.py", line 183, in __call__
    self.cache[args] = self.func(*args)
  File "/build/work/spack-tools/spack/lib/spack/spack/spec.py", line 2690, in patches
    for sha256 in self.variants['patches']._patches_in_order_of_appearance:
AttributeError: 'MultiValuedVariant' object has no attribute '_patches_in_order_of_appearance'

@gartung
Copy link
Copy Markdown
Member Author

gartung commented Feb 28, 2019

@tgamblin The patch coverage is at 62%. Is this OK to merge?

@gartung gartung requested a review from tgamblin February 28, 2019 03:20
@scheibelp
Copy link
Copy Markdown
Member

Either myself or @tgamblin can look at this by tomorrow

@gartung
Copy link
Copy Markdown
Member Author

gartung commented Feb 28, 2019

Note that I merged in pr #9199

@gartung
Copy link
Copy Markdown
Member Author

gartung commented Feb 28, 2019

With #9199 I am able to drop the whole replace rpaths with placeholders and check for install prefix strings in favor of @alalazo 's file_is_relocatable.

@gartung gartung closed this Feb 28, 2019
@gartung gartung deleted the buildcache-placeholder-fix branch February 28, 2019 15:55
@gartung gartung restored the buildcache-placeholder-fix branch February 28, 2019 15:56
@gartung
Copy link
Copy Markdown
Member Author

gartung commented Feb 28, 2019

I did 'git push origin :branch' instead of 'git push origin +branch'.
I will have to resubmit but first #9199 needs to be merged.

@gartung gartung removed the request for review from tgamblin February 28, 2019 15:59
@scheibelp
Copy link
Copy Markdown
Member

I will have to resubmit but first #9199 needs to be merged.

OK I will look at that, and check this out later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants