Repository: spack/spack

Issue:
Installation issue: Tau 
Tau fails with g++: error: unrecognized command line option '-G' on our Cray-XC Cori machine. 

### Steps to reproduce the issue

```console
$ spack install tau%gcc 
```

### Platform and user environment
Cori - Cray-XC backend os=cnl6 


### Additional information
Logs: 

```commandline
  >> 755    g++: error: unrecognized command line option '-G'
     756    Makefile:56: recipe for target 'libtau_plugin_interrupt_trigger.so' failed
  >> 757    make[2]: *** [libtau_plugin_interrupt_trigger.so] Error 1
     758    make[2]: *** Waiting for unfinished jobs....
  >> 759    g++: error: unrecognized command line option '-G'
     760    Makefile:32: recipe for target 'libtau_plugin_function_registration_complete.so' failed
  >> 761    make[2]: *** [libtau_plugin_function_registration_complete.so] Error 1
  >> 762    g++: error: unrecognized command line option '-G'
     763    Makefile:44: recipe for target 'libtau_plugin_atomic_event_registration_complete.so' failed
  >> 764    make[2]: *** [libtau_plugin_atomic_event_registration_complete.so] Error 1
  >> 765    g++: error: unrecognized command line option '-G'
     766    Makefile:50: recipe for target 'libtau_plugin_end_of_execution.so' failed
  >> 767    make[2]: *** [libtau_plugin_end_of_execution.so] Error 1
  >> 768    g++: error: unrecognized command line option '-G'
     769    Makefile:38: recipe for target 'libtau_plugin_atomic_event_trigger.so' failed
  >> 770    make[2]: *** [libtau_plugin_atomic_event_trigger.so] Error 1
     771    make[2]: Leaving directory '/tmp/mamelara/spack-stage/spack-stage-NnKvhN/tau-2.28/plugins/testplugins'
     772    Makefile:27: recipe for target 'install' failed
  >> 773    make[1]: *** [install] Error 2
     774    make[1]: Leaving directory '/tmp/mamelara/spack-stage/spack-stage-NnKvhN/tau-2.28/plugins'
     775    Makefile:177: recipe for target 'install' failed
  >> 776    make: *** [install] Error 2
```



Discussion:
@sameershende I believe this is your package?
On Crays, TAU needs a -arch=craycnl flag that the tau.py package should add. We are looking into this. 

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/tau/package.py b/var/spack/repos/builtin/packages/tau/package.py
--- a/var/spack/repos/builtin/packages/tau/package.py
+++ b/var/spack/repos/builtin/packages/tau/package.py
@@ -61,6 +61,7 @@ class Tau(Package):
     variant('craycnl', default=False, description='Build for Cray compute nodes')
     variant('bgq', default=False, description='Build for IBM BlueGene/Q compute nodes')
     variant('ppc64le', default=False, description='Build for IBM Power LE nodes')
+    variant('x86_64', default=False, description='Force build for x86 Linux instead of auto-detect')
 
     depends_on('pdt', when='+pdt')  # Required for TAU instrumentation
     depends_on('scorep', when='+scorep')
@@ -124,6 +125,21 @@ def install(self, spec, prefix):
         options = ["-prefix=%s" % prefix,
                    "-iowrapper"]
 
+        if '+craycnl' in spec:
+            options.append('-arch=craycnl')
+
+        if '+bgq' in spec:
+            options.append('-arch=bgq')
+
+        if '+ppc64le' in spec:
+            options.append('-arch=ibm64linux')
+
+        if '+x86_64' in spec:
+            options.append('-arch=x86_64')
+
+        if ('platform=cray' in self.spec) and ('+x86_64' not in spec):
+            options.append('-arch=craycnl')
+
         if '+pdt' in spec:
             options.append("-pdt=%s" % spec['pdt'].prefix)
 


Test patch: