{"action":"created","issue":{"url":"https://api.github.com/repos/conda/conda-build/issues/3310","repository_url":"https://api.github.com/repos/conda/conda-build","labels_url":"https://api.github.com/repos/conda/conda-build/issues/3310/labels{/name}","comments_url":"https://api.github.com/repos/conda/conda-build/issues/3310/comments","events_url":"https://api.github.com/repos/conda/conda-build/issues/3310/events","html_url":"https://github.com/conda/conda-build/issues/3310","id":390321833,"node_id":"MDU6SXNzdWUzOTAzMjE4MzM=","number":3310,"title":"existing packages are removed from build prefix for multiple outputs","user":{"login":"bergtholdt","id":204942,"node_id":"MDQ6VXNlcjIwNDk0Mg==","avatar_url":"https://avatars1.githubusercontent.com/u/204942?v=4","gravatar_id":"","url":"https://api.github.com/users/bergtholdt","html_url":"https://github.com/bergtholdt","followers_url":"https://api.github.com/users/bergtholdt/followers","following_url":"https://api.github.com/users/bergtholdt/following{/other_user}","gists_url":"https://api.github.com/users/bergtholdt/gists{/gist_id}","starred_url":"https://api.github.com/users/bergtholdt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bergtholdt/subscriptions","organizations_url":"https://api.github.com/users/bergtholdt/orgs","repos_url":"https://api.github.com/users/bergtholdt/repos","events_url":"https://api.github.com/users/bergtholdt/events{/privacy}","received_events_url":"https://api.github.com/users/bergtholdt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-12-12T17:05:41Z","updated_at":"2018-12-12T20:52:18Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"### Actual Behavior\r\n\r\nI have a simple recipe with multiple outputs and different build env packages.\r\n\r\n```yaml\r\npackage:\r\n  name: test_lib_and_wrap\r\n  version: 1.0\r\n\r\nbuild:\r\n  number: 0\r\n\r\noutputs:\r\n  - name: libtest\r\n    build:\r\n      run_exports:\r\n        - {{ pin_subpackage('libtest', exact=True) }}\r\n    requirements:\r\n      build:\r\n        - {{ compiler('c') }}\r\n        - cmake\r\n      host:\r\n\r\n  - name: pytest\r\n    requirements:\r\n      build:\r\n        - {{ compiler('c') }}\r\n        - cmake\r\n        - swig\r\n      host:\r\n        - python {{ python }}\r\n        - {{ pin_subpackage('libtest', exact=True) }}\r\n      run:\r\n        - {{ pin_compatible('python') }}\r\n        - {{ pin_subpackage('libtest', exact=True) }}\r\n```\r\n\r\nAfter building libtest the build_prefix (and host_prefix) are removed and are prepared for the second output pytest. However all packages from compiler('c'), cmake and their dependencies are missing in the build_prefix, just the new package swig + dependencies (pcre) are installed, thus failing to build pytest with cmake.\r\n\r\n### Expected Behavior\r\n\r\nFull build environment available for each output.\r\n\r\n### Steps to Reproduce\r\n\r\nJust run conda build on the recipe and interrupt after each output and inspect the build_env.\r\n\r\n### Workaround\r\n\r\nI digged into this a little deeper and found that in the inner loop in build.py over the outputs, all m.config.build_prefix are the same as the m.config.host_prefix. This hints that the recipe is actually not parsed correctly. The correct behavior can be achieved by introducing build and host sections in the parent's requirements section of the recipe (even if they are empty) like this:\r\n\r\n```yaml\r\npackage:\r\n  name: test_lib_and_wrap\r\n  version: 1.0\r\n\r\nbuild:\r\n  number: 0\r\n\r\nrequirements:\r\n  build:\r\n  host:\r\n  \r\noutputs:\r\n  - name: libtest\r\n    build:\r\n      run_exports:\r\n        - {{ pin_subpackage('libtest', exact=True) }}\r\n    requirements:\r\n      build:\r\n        - {{ compiler('c') }}\r\n        - cmake\r\n      host:\r\n\r\n  - name: pytest\r\n    requirements:\r\n      build:\r\n        - {{ compiler('c') }}\r\n        - cmake\r\n        - swig\r\n      host:\r\n        - python {{ python }}\r\n        - {{ pin_subpackage('libtest', exact=True) }}\r\n      run:\r\n        - {{ pin_compatible('python') }}\r\n        - {{ pin_subpackage('libtest', exact=True) }}\r\n````\r\n\r\nThis should at least be documented as it cost me another half a day to find the issue and track it down. However I find it more intuitive if the first recipe actually worked as expected.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/conda/conda-build/issues/comments/446739400","html_url":"https://github.com/conda/conda-build/issues/3310#issuecomment-446739400","issue_url":"https://api.github.com/repos/conda/conda-build/issues/3310","id":446739400,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NjczOTQwMA==","user":{"login":"msarahan","id":38393,"node_id":"MDQ6VXNlcjM4Mzkz","avatar_url":"https://avatars3.githubusercontent.com/u/38393?v=4","gravatar_id":"","url":"https://api.github.com/users/msarahan","html_url":"https://github.com/msarahan","followers_url":"https://api.github.com/users/msarahan/followers","following_url":"https://api.github.com/users/msarahan/following{/other_user}","gists_url":"https://api.github.com/users/msarahan/gists{/gist_id}","starred_url":"https://api.github.com/users/msarahan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msarahan/subscriptions","organizations_url":"https://api.github.com/users/msarahan/orgs","repos_url":"https://api.github.com/users/msarahan/repos","events_url":"https://api.github.com/users/msarahan/events{/privacy}","received_events_url":"https://api.github.com/users/msarahan/received_events","type":"User","site_admin":false},"created_at":"2018-12-12T20:52:18Z","updated_at":"2018-12-12T20:52:18Z","author_association":"CONTRIBUTOR","body":"yep, confirmed it.  I added a bit of a test by calling $CC --version in build/script for each output.  We'll add a test case for this."}}
{"actor":{"display_login":"msarahan"}}