diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index 073f73a91a177b08373430567284cf196f07dfec..4483b9d1329eb372d272eee339c603fa91b0715f 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -366,7 +366,7 @@ def get_rpaths(pkg):
                   if os.path.isdir(d.prefix.lib64))
     # Second module is our compiler mod name. We use that to get rpaths from
     # module show output. 
-    if pkg.compiler.modules and len(pkg.compiler.modules > 1):
+    if pkg.compiler.modules and len(pkg.compiler.modules) > 1:
         rpaths.append(get_path_from_module(pkg.compiler.modules[1]))
     return rpaths