Repository: conda/conda-build

Issue:
Conda-build tries to run 'CMD' when installing R packages on Mac OS X
<!--
Thanks for opening an issue! A few things to keep in mind:

- This issue tracker is for issues with or enhancements for conda-build.

For conda issues, you should open an issue at https://github.com/conda/conda/issues
For Anaconda issues, you should open an issue at https://github.com/ContinuumIO/anaconda-issues/issues
For an issue with a particular conda-forge package, you should open an issue on the 
corresponding feedstock: https://github.com/conda-forge
-->

### Actual Behavior

<!-- What actually happens? -->

In a virtual environment, after successfully running both `conda skeleton cran cvauc` and `conda skeleton cran nnls`, both `conda-build r-cvauc` and `conda-build r-nnls` fail to exit successfully.

The full output is extremely long, I will post both at the end, but the relevant portion of the error messages, which happened to be identical to both, seemed to be:

```
Fatal error: cannot open file 'CMD': No such file or directory
Traceback (most recent call last):
  File "/opt/anaconda/anaconda3/bin/conda-build", line 11, in <module>
    sys.exit(main())
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/cli/main_build.py", line 420, in main
    execute(sys.argv[1:])
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/cli/main_build.py", line 411, in execute
    verify=args.verify)
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/api.py", line 199, in build
    notest=notest, need_source_download=need_source_download, variants=variants)
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/build.py", line 2097, in build_tree
    notest=notest,
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/build.py", line 1370, in build
    utils.check_call_env(cmd, env=env, cwd=src_dir, stats=build_stats)
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/utils.py", line 301, in check_call_env
    return _func_defaulting_env_to_os_environ('call', *popenargs, **kwargs)
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/utils.py", line 280, in _func_defaulting_env_to_os_environ
    raise subprocess.CalledProcessError(proc.returncode, _args)
subprocess.CalledProcessError: Command '['/bin/bash', '-e', '/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/work/conda_build.sh']' returned non-zero exit status 2.
```


### Expected Behavior

<!-- What do you think should happen? -->

When I googled `Fatal error: cannot open file 'CMD': No such file or directory`, the only relevant result I was able to find was [this question on StackOverflow](https://stackoverflow.com/questions/38062284/when-trying-to-run-r-script-from-cmd-getting-fatal-error-cannot-open-file-cm). However, the answers to that question did not help me to resolve my issue, because it was a Windows user running R with `R.exe`, and everything in the answers was addressed in terms of a Windows installation. Luckily the question was tagged `cmd`, so clicking on the tag gave the following description of what `CMD` is:

> Command Prompt (executable name cmd.exe) is the Microsoft supplied command line interpreter on OS/2, Windows CE, and all Windows operating systems (including Windows NT, Windows 2000, Windows XP, Vista, 7, 8, 10, Windows Server 2003, Server 2008, Server 2012, and Server 2016).

Most likely this is not something which should be called/required to run on a Mac OS X installation. That being said, I am not really sure that is what is happening, since I don't quite fully understand the output of `conda-build` and the resulting error messages. (And I don't really know what `CMD` is.)

If that is what is happening, then the expected behavior would be that `conda-build`, when running on Mac OS X or other non-Windows platform, does not attempt to call the Windows command line utility and thereby unnecessarily force itself to fail. There seemed to be no other problems with the conda R package creation procedure working besides this.

### Steps to Reproduce

<!-- Steps to reproduce issue. -->

To better isolate issues, first I did:

`conda create --name RHomework03`

then of course

`conda activate RHomework03`

*Not essential to reproduce, just some possibly insightful context:*  
Then I ran `conda skeleton cran SuperLearner` which ***did*** work, i.e. [the previous issue](https://github.com/conda/conda-build/issues/2758) has most definitely been fixed, which is most definitely appreciated. This created a recipe directory `r-superlearner` with all of the necessary files in the present working directory, so from that same directory I ran `conda-build r-superlearner` which wasn't successful, but it told me clearly why, namely there were two dependencies not in the repositories, `cvauc` and `nnls`, 

```
File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda/resolve.py", line 172, in verify_specs
    raise ResolvePackageNotFound(bad_deps)
conda.exceptions.ResolvePackageNotFound: 
  - r-nnls
  - r-cvauc
```
`...`
```
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/environ.py", line 708, in get_install_actions
    raise DependencyNeedsBuildingError(exc, subdir=subdir)
conda_build.exceptions.DependencyNeedsBuildingError: Unsatisfiable dependencies for platform osx-64: {'r-cvauc', 'r-nnls'}
```
Inconvenient, but clearly not a game-ender/show-stopper, right?

*Continuation of steps necessary to reproduce:*  
So then I ran `conda skeleton cran cvauc` and `conda skeleton cran nnls`, no errors, no problems whatsoever. The previous issue has most definitely been fixed, which is again most definitely appreciated, and everything up until this point works great. These commands created the recipe directories `r-cvauc` and `r-nnls` with all of the necessary files in the present working directory. 

So from that same present working directory I ran `conda-build r-cvauc` which wasn't successful, for reasons *not* obviously related to dependencies. (Maybe there is a package called `CMD` which I should have? `conda install cmd` did not turn up any results, so it seems likely that this is simply an OS compatibility issue as explained above.)

I then tried `conda-build r-nnls` which also wasn't successful, for the same reason apparently that `conda-build r-cvauc` wasn't successful. The full outputs of both are at the very end of this post.

This doesn't seem to be a[n issue with me having too many channels](https://github.com/ContinuumIO/anaconda-issues/issues/8900) because this time I created a virtual environment, and the output of `conda info` below seems to suggest that I am not calling anything besides the default channels from that environment.

##### Output of `conda info`
<!-- Between the ticks below, paste the output of 'conda info' -->
```
    active environment : RHomework3
    active env location : /opt/anaconda/anaconda3/envs/RHomework3
            shell level : 2
       user config file : /Users/williamkrinsman/.condarc
 populated config files : 
          conda version : 4.5.0
    conda-build version : 3.7.2
         python version : 3.6.4.final.0
       base environment : /opt/anaconda/anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/osx-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/pro/osx-64
                          https://repo.anaconda.com/pkgs/pro/noarch
          package cache : /opt/anaconda/anaconda3/pkgs
                          /Users/williamkrinsman/.conda/pkgs
       envs directories : /opt/anaconda/anaconda3/envs
                          /Users/williamkrinsman/.conda/envs
               platform : osx-64
             user-agent : conda/4.5.0 requests/2.18.4 CPython/3.6.4 Darwin/15.6.0 OSX/10.11.6
                UID:GID : 504:20
             netrc file : None
           offline mode : False
```
##### Output of `conda list --show-channel-urls`

```
# packages in environment at /opt/anaconda/anaconda3/envs/RHomework3:
#
# Name                    Version                   Build  Channel
```

##### Output of `conda-build r-cvauc`

```
Adding in variants from internal_defaults
INFO:conda_build.variants:Adding in variants from internal_defaults
Attempting to finalize metadata for r-cvauc
INFO:conda_build.metadata:Attempting to finalize metadata for r-cvauc
Solving environment: ...working... done
Solving environment: ...working... done
BUILD START: ['r-cvauc-1.1.0-r343h889e2dd_0.tar.bz2']
Solving environment: ...working... done

## Package Plan ##

  environment location: /opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl


The following NEW packages will be INSTALLED:

    _r-mutex:        1.0.0-anacondar_1      
    bwidget:         1.9.11-0               
    bzip2:           1.0.6-hd86a083_4       
    ca-certificates: 2017.08.26-ha1e5d58_0  
    cairo:           1.14.12-hab642c4_0     
    cctools:         895-h7512d6f_0         
    clang:           4.0.1-h662ec87_0       
    clang_osx-64:    4.0.1-h1ce6c1d_10      
    clangxx:         4.0.1-hc9b4283_0       
    clangxx_osx-64:  4.0.1-h22b1bf0_10      
    compiler-rt:     4.0.1-h5487866_0       
    curl:            7.58.0-ha441bb4_0      
    fontconfig:      2.12.6-h9850fc5_0      
    freetype:        2.8-h12048fb_1         
    gettext:         0.19.8.1-h15daf44_3    
    gfortran_osx-64: 4.8.5-h22b1bf0_3       
    glib:            2.53.6-h33f6a65_2      
    graphite2:       1.3.10-h337f25e_1      
    gsl:             2.2.1-h002c638_3       
    harfbuzz:        1.7.4-h08e020e_0       
    icu:             58.2-h4b95b61_1        
    jpeg:            9b-he5867d9_2          
    krb5:            1.14.2-h9a779f2_6      
    ld64:            274.2-h7c2db76_0       
    libcurl:         7.58.0-hf30b1f0_0      
    libcxx:          4.0.1-h579ed51_0       
    libcxxabi:       4.0.1-hebd6815_0       
    libffi:          3.2.1-h475c297_4       
    libgfortran:     3.0.1-h93005f0_2       
    libiconv:        1.15-hdd342a3_7        
    libpng:          1.6.34-he12f830_0      
    libssh2:         1.8.0-h322a93b_4       
    libtiff:         4.0.9-h0dac147_0       
    libxml2:         2.9.7-hab757c2_0       
    llvm:            4.0.1-hc748206_0       
    llvm-lto-tapi:   4.0.1-h6701bc3_0       
    llvm-openmp:     4.0.1-hda82c8b_0       
    ncurses:         6.0-hd04f020_2         
    openssl:         1.0.2n-hdbc3d79_0      
    pango:           1.41.0-h3bae10e_0      
    pcre:            8.41-hfb6ab37_1        
    pixman:          0.34.0-hca0a616_3      
    r-base:          3.4.3-h9b62496_0       
    r-bitops:        1.0_6-r343h7f474d2_4   
    r-catools:       1.17.1-r343he124285_4  
    r-data.table:    1.10.4_3-r343h7f474d2_0
    r-gdata:         2.18.0-r343h889e2dd_0  
    r-gplots:        3.0.1-r343h889e2dd_0   
    r-gtools:        3.5.0-r343h7f474d2_4   
    r-kernsmooth:    2.23_15-r343h883f7c5_4 
    r-rocr:          1.0_7-r343h889e2dd_4   
    readline:        7.0-hc1231fa_4         
    tk:              8.6.7-h35a86e2_3       
    tktable:         2.10-h1de35cc_0        
    xz:              5.2.3-h0278029_2       
    zlib:            1.2.11-hf3cbc9b_2      

Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Solving environment: ...working... done
Source cache directory is: /opt/anaconda/anaconda3/conda-bld/src_cache
Downloading source to cache: cvAUC_1.1.0_c4d8ed53b9.tar.gz
Downloading https://mran.microsoft.com/snapshot/2018-01-01/src/contrib/cvAUC_1.1.0.tar.gz
Success
Extracting download
source tree in: /opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/work
INFO: activate-gfortran_osx-64.sh made the following environmental changes:
+DEBUG_FFLAGS=-march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -Og -g -Wall -Wextra -fcheck=all -fbacktrace -fimplicit-none -fvar-tracking-assignments
+F95=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-gfortran
+FC=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-gfortran
+FFLAGS=-march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe
+FORTRANFLAGS=-march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe
+GFORTRAN=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-gfortran
+HOST=x86_64-apple-darwin13.4.0
INFO: activate_clang_osx-64.sh made the following environmental changes:
+AR=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-ar
+AS=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-as
+CC=x86_64-apple-darwin13.4.0-clang
+CFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/include -fdebug-prefix-map=${SRC_DIR}=/usr/local/src/conda/${PKG_NAME}-${PKG_VERSION} -fdebug-prefix-map=${PREFIX}=/usr/local/src/conda-prefix
+CHECKSYMS=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-checksyms
+CLANG=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-clang
+CODESIGN_ALLOCATE=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-codesign_allocate
+CPPFLAGS=-D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9
+DEBUG_CFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -Og -g -Wall -Wextra -I/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/include -fdebug-prefix-map=${SRC_DIR}=/usr/local/src/conda/${PKG_NAME}-${PKG_VERSION} -fdebug-prefix-map=${PREFIX}=/usr/local/src/conda-prefix
+INDR=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-indr
+INSTALL_NAME_TOOL=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-install_name_tool
+LD=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-ld
+LDFLAGS=-Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib -L/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib
+LDFLAGS_LD=-pie -headerpad_max_install_names -dead_strip_dylibs -rpath /opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib -L/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib
+LIBTOOL=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-libtool
+LIPO=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-lipo
+NM=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-nm
+NMEDIT=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-nmedit
+OTOOL=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-otool
+PAGESTUFF=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-pagestuff
+RANLIB=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-ranlib
+REDO_PREBINDING=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-redo_prebinding
+SEGEDIT=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-segedit
+SEG_ADDR_TABLE=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-seg_addr_table
+SEG_HACK=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-seg_hack
+SIZE=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-size
+STRINGS=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-strings
+STRIP=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-strip
+_CONDA_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_x86_64_apple_darwin13_4_0
INFO: activate_clangxx_osx-64.sh made the following environmental changes:
+CLANGXX=/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/bin/x86_64-apple-darwin13.4.0-clang++
+CXX=x86_64-apple-darwin13.4.0-clang++
+CXXFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0 -I/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/include -fdebug-prefix-map=${SRC_DIR}=/usr/local/src/conda/${PKG_NAME}-${PKG_VERSION} -fdebug-prefix-map=${PREFIX}=/usr/local/src/conda-prefix
+DEBUG_CXXFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0 -Og -g -Wall -Wextra -I/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/include -fdebug-prefix-map=${SRC_DIR}=/usr/local/src/conda/${PKG_NAME}-${PKG_VERSION} -fdebug-prefix-map=${PREFIX}=/usr/local/src/conda-prefix
Fatal error: cannot open file 'CMD': No such file or directory
Traceback (most recent call last):
  File "/opt/anaconda/anaconda3/bin/conda-build", line 11, in <module>
    sys.exit(main())
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/cli/main_build.py", line 420, in main
    execute(sys.argv[1:])
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/cli/main_build.py", line 411, in execute
    verify=args.verify)
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/api.py", line 199, in build
    notest=notest, need_source_download=need_source_download, variants=variants)
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/build.py", line 2097, in build_tree
    notest=notest,
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/build.py", line 1370, in build
    utils.check_call_env(cmd, env=env, cwd=src_dir, stats=build_stats)
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/utils.py", line 301, in check_call_env
    return _func_defaulting_env_to_os_environ('call', *popenargs, **kwargs)
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/utils.py", line 280, in _func_defaulting_env_to_os_environ
    raise subprocess.CalledProcessError(proc.returncode, _args)
subprocess.CalledProcessError: Command '['/bin/bash', '-e', '/opt/anaconda/anaconda3/conda-bld/r-cvauc_1521985481724/work/conda_build.sh']' returned non-zero exit status 2.
```

##### Output of `conda-build r-nnls`

```
Adding in variants from internal_defaults
INFO:conda_build.variants:Adding in variants from internal_defaults
Attempting to finalize metadata for r-nnls
INFO:conda_build.metadata:Attempting to finalize metadata for r-nnls
Solving environment: ...working... done
Solving environment: ...working... done
Solving environment: ...working... done
BUILD START: ['r-nnls-1.4-r343h883f7c5_0.tar.bz2']
Solving environment: ...working... done

## Package Plan ##

  environment location: /opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla


The following NEW packages will be INSTALLED:

    _r-mutex:        1.0.0-anacondar_1    
    bwidget:         1.9.11-0             
    bzip2:           1.0.6-hd86a083_4     
    ca-certificates: 2017.08.26-ha1e5d58_0
    cairo:           1.14.12-hab642c4_0   
    cctools:         895-h7512d6f_0       
    clang:           4.0.1-h662ec87_0     
    clang_osx-64:    4.0.1-h1ce6c1d_10    
    clangxx:         4.0.1-hc9b4283_0     
    clangxx_osx-64:  4.0.1-h22b1bf0_10    
    compiler-rt:     4.0.1-h5487866_0     
    curl:            7.58.0-ha441bb4_0    
    fontconfig:      2.12.6-h9850fc5_0    
    freetype:        2.8-h12048fb_1       
    gettext:         0.19.8.1-h15daf44_3  
    gfortran_osx-64: 4.8.5-h22b1bf0_3     
    glib:            2.53.6-h33f6a65_2    
    graphite2:       1.3.10-h337f25e_1    
    gsl:             2.2.1-h002c638_3     
    harfbuzz:        1.7.4-h08e020e_0     
    icu:             58.2-h4b95b61_1      
    jpeg:            9b-he5867d9_2        
    krb5:            1.14.2-h9a779f2_6    
    ld64:            274.2-h7c2db76_0     
    libcurl:         7.58.0-hf30b1f0_0    
    libcxx:          4.0.1-h579ed51_0     
    libcxxabi:       4.0.1-hebd6815_0     
    libffi:          3.2.1-h475c297_4     
    libgfortran:     3.0.1-h93005f0_2     
    libiconv:        1.15-hdd342a3_7      
    libpng:          1.6.34-he12f830_0    
    libssh2:         1.8.0-h322a93b_4     
    libtiff:         4.0.9-h0dac147_0     
    libxml2:         2.9.7-hab757c2_0     
    llvm:            4.0.1-hc748206_0     
    llvm-lto-tapi:   4.0.1-h6701bc3_0     
    llvm-openmp:     4.0.1-hda82c8b_0     
    ncurses:         6.0-hd04f020_2       
    openssl:         1.0.2n-hdbc3d79_0    
    pango:           1.41.0-h3bae10e_0    
    pcre:            8.41-hfb6ab37_1      
    pixman:          0.34.0-hca0a616_3    
    r-base:          3.4.3-h9b62496_0     
    readline:        7.0-hc1231fa_4       
    tk:              8.6.7-h35a86e2_3     
    tktable:         2.10-h1de35cc_0      
    xz:              5.2.3-h0278029_2     
    zlib:            1.2.11-hf3cbc9b_2    

Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Solving environment: ...working... done
Solving environment: ...working... done

## Package Plan ##

  environment location: /opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env


The following NEW packages will be INSTALLED:

    cctools:         895-h7512d6f_0   
    clang:           4.0.1-h662ec87_0 
    clang_osx-64:    4.0.1-h1ce6c1d_10
    compiler-rt:     4.0.1-h5487866_0 
    gfortran_osx-64: 4.8.5-h22b1bf0_3 
    ld64:            274.2-h7c2db76_0 
    libcxx:          4.0.1-h579ed51_0 
    libcxxabi:       4.0.1-hebd6815_0 
    libgfortran:     3.0.1-h93005f0_2 
    llvm:            4.0.1-hc748206_0 
    llvm-lto-tapi:   4.0.1-h6701bc3_0 
    make:            4.2.1-h0cf4ea2_0 

Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Source cache directory is: /opt/anaconda/anaconda3/conda-bld/src_cache
Downloading source to cache: nnls_1.4_0e5d77abae.tar.gz
Downloading https://mran.microsoft.com/snapshot/2018-01-01/src/contrib/nnls_1.4.tar.gz
Success
Extracting download
source tree in: /opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/work
INFO: activate-gfortran_osx-64.sh made the following environmental changes:
+DEBUG_FFLAGS=-march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -Og -g -Wall -Wextra -fcheck=all -fbacktrace -fimplicit-none -fvar-tracking-assignments
+F95=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-gfortran
+FC=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-gfortran
+FFLAGS=-march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe
+FORTRANFLAGS=-march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe
+GFORTRAN=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-gfortran
+HOST=x86_64-apple-darwin13.4.0
INFO: activate_clang_osx-64.sh made the following environmental changes:
+AR=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-ar
+AS=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-as
+CC=x86_64-apple-darwin13.4.0-clang
+CFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/include -fdebug-prefix-map=${SRC_DIR}=/usr/local/src/conda/${PKG_NAME}-${PKG_VERSION} -fdebug-prefix-map=${PREFIX}=/usr/local/src/conda-prefix
+CHECKSYMS=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-checksyms
+CLANG=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-clang
+CODESIGN_ALLOCATE=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-codesign_allocate
+CPPFLAGS=-D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9
+DEBUG_CFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -Og -g -Wall -Wextra -I/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/include -fdebug-prefix-map=${SRC_DIR}=/usr/local/src/conda/${PKG_NAME}-${PKG_VERSION} -fdebug-prefix-map=${PREFIX}=/usr/local/src/conda-prefix
+INDR=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-indr
+INSTALL_NAME_TOOL=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-install_name_tool
+LD=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-ld
+LDFLAGS=-Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/lib -L/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/lib
+LDFLAGS_LD=-pie -headerpad_max_install_names -dead_strip_dylibs -rpath /opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/lib -L/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/lib
+LIBTOOL=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-libtool
+LIPO=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-lipo
+NM=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-nm
+NMEDIT=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-nmedit
+OTOOL=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-otool
+PAGESTUFF=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-pagestuff
+RANLIB=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-ranlib
+REDO_PREBINDING=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-redo_prebinding
+SEGEDIT=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-segedit
+SEG_ADDR_TABLE=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-seg_addr_table
+SEG_HACK=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-seg_hack
+SIZE=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-size
+STRINGS=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-strings
+STRIP=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-strip
+_CONDA_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_x86_64_apple_darwin13_4_0
INFO: activate_clangxx_osx-64.sh made the following environmental changes:
+CLANGXX=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-clang++
+CXX=x86_64-apple-darwin13.4.0-clang++
+CXXFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0 -I/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/include -fdebug-prefix-map=${SRC_DIR}=/usr/local/src/conda/${PKG_NAME}-${PKG_VERSION} -fdebug-prefix-map=${PREFIX}=/usr/local/src/conda-prefix
+DEBUG_CXXFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0 -Og -g -Wall -Wextra -I/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/include -fdebug-prefix-map=${SRC_DIR}=/usr/local/src/conda/${PKG_NAME}-${PKG_VERSION} -fdebug-prefix-map=${PREFIX}=/usr/local/src/conda-prefix
INFO: activate-gfortran_osx-64.sh made the following environmental changes:
+F95=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-gfortran
+FC=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-gfortran
+GFORTRAN=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-gfortran
-F95=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-gfortran
-FC=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-gfortran
-GFORTRAN=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-gfortran
INFO: activate_clang_osx-64.sh made the following environmental changes:
+AR=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-ar
+AS=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-as
+CHECKSYMS=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-checksyms
+CLANG=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-clang
+CODESIGN_ALLOCATE=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-codesign_allocate
+INDR=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-indr
+INSTALL_NAME_TOOL=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-install_name_tool
+LD=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-ld
+LIBTOOL=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-libtool
+LIPO=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-lipo
+NM=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-nm
+NMEDIT=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-nmedit
+OTOOL=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-otool
+PAGESTUFF=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-pagestuff
+RANLIB=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-ranlib
+REDO_PREBINDING=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-redo_prebinding
+SEGEDIT=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-segedit
+SEG_ADDR_TABLE=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-seg_addr_table
+SEG_HACK=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-seg_hack
+SIZE=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-size
+STRINGS=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-strings
+STRIP=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_build_env/bin/x86_64-apple-darwin13.4.0-strip
-AR=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-ar
-AS=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-as
-CHECKSYMS=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-checksyms
-CLANG=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-clang
-CODESIGN_ALLOCATE=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-codesign_allocate
-INDR=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-indr
-INSTALL_NAME_TOOL=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-install_name_tool
-LD=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-ld
-LIBTOOL=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-libtool
-LIPO=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-lipo
-NM=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-nm
-NMEDIT=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-nmedit
-OTOOL=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-otool
-PAGESTUFF=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-pagestuff
-RANLIB=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-ranlib
-REDO_PREBINDING=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-redo_prebinding
-SEGEDIT=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-segedit
-SEG_ADDR_TABLE=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-seg_addr_table
-SEG_HACK=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-seg_hack
-SIZE=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-size
-STRINGS=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-strings
-STRIP=/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/bin/x86_64-apple-darwin13.4.0-strip
Fatal error: cannot open file 'CMD': No such file or directory
Traceback (most recent call last):
  File "/opt/anaconda/anaconda3/bin/conda-build", line 11, in <module>
    sys.exit(main())
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/cli/main_build.py", line 420, in main
    execute(sys.argv[1:])
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/cli/main_build.py", line 411, in execute
    verify=args.verify)
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/api.py", line 199, in build
    notest=notest, need_source_download=need_source_download, variants=variants)
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/build.py", line 2097, in build_tree
    notest=notest,
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/build.py", line 1370, in build
    utils.check_call_env(cmd, env=env, cwd=src_dir, stats=build_stats)
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/utils.py", line 301, in check_call_env
    return _func_defaulting_env_to_os_environ('call', *popenargs, **kwargs)
  File "/opt/anaconda/anaconda3/lib/python3.6/site-packages/conda_build/utils.py", line 280, in _func_defaulting_env_to_os_environ
    raise subprocess.CalledProcessError(proc.returncode, _args)
subprocess.CalledProcessError: Command '['/bin/bash', '-e', '/opt/anaconda/anaconda3/conda-bld/r-nnls_1521986432452/work/conda_build.sh']' returned non-zero exit status 2.
```


Discussion:
I think I posted the same issue (#2779). The reason is that ``R CMD INSTALL`` is a valid command for ``R.exe`` but not for ``Rscript.exe``. If ``Rscript.exe`` is used, it complains that CMD is not a file.
Indeed, sorry about this.  @mingwandroid asked me to make that switch so that R script runs would give better console output, and I didn't consider the implications carefully.  We'll revert $R so that your existing scripts work, but incorporate RScript differently.
Yeah, I should've checked this more.
@tobiasraabe You're right, I should have looked more closely at already existing issues before filing my own.

If you judge it to be the same as mine, then I trust your judgment. It is unclear to me if the solution proposed by @tobiasraabe will be sufficient for non-Windows users, for whom none of `R.exe`, `Rscript.exe`, or `CMD` are valid binaries.

Resolving patch:
diff --git a/conda_build/build.py b/conda_build/build.py
--- a/conda_build/build.py
+++ b/conda_build/build.py
@@ -1929,7 +1929,8 @@ def test(recipedir_or_package_or_metadata, config, stats, move_broken=True):
                 tf.write("IF %ERRORLEVEL% NEQ 0 exit 1\n")
         if r_files:
             tf.write('"{r}" "{test_file}"\n'.format(
-                r=metadata.config.r_bin(metadata.config.test_prefix, metadata.config.host_platform),
+                r=metadata.config.rscript_bin(metadata.config.test_prefix,
+                                              metadata.config.host_platform),
                 test_file=join(metadata.config.test_dir, 'run_test.r')))
             if utils.on_win:
                 tf.write("IF %ERRORLEVEL% NEQ 0 exit 1\n")
diff --git a/conda_build/config.py b/conda_build/config.py
--- a/conda_build/config.py
+++ b/conda_build/config.py
@@ -466,6 +466,16 @@ def _get_lua(self, prefix, platform):
         return res
 
     def _get_r(self, prefix, platform):
+        if platform.startswith('win'):
+            res = join(prefix, 'Scripts', 'R.exe')
+            # MRO test:
+            if not os.path.exists(res):
+                res = join(prefix, 'bin', 'R.exe')
+        else:
+            res = join(prefix, 'bin', 'R')
+        return res
+
+    def _get_rscript(self, prefix, platform):
         if platform.startswith('win'):
             res = join(prefix, 'Scripts', 'Rscript.exe')
             # MRO test:
@@ -590,6 +600,9 @@ def lua_bin(self, prefix, platform):
     def r_bin(self, prefix, platform):
         return self._get_r(prefix, platform)
 
+    def rscript_bin(self, prefix, platform):
+        return self._get_rscript(prefix, platform)
+
     @property
     def info_dir(self):
         """Path to the info dir in the build prefix, where recipe metadata is stored"""


Test patch: