Repository: spack/spack

Issue:
Recent versions of icu4c do not compile with intel-19
Recent versions, namely 60.1 and 64.1, of the icu4c package fail to build with the intel-19 compiler. The intel-17 and intel-18 compilers work fine. The 57.1 and 58.2 versions compile fine with intel-19. This is likely a problem with the icu4c code, or the intel-19 compiler, but I wanted to create a spack issue first.


---

### Steps to reproduce the issue

```console
$ spack install icu4c@64.1%intel
16 errors found in build log:
     473       icpc      ...  messagepattern.cpp
     474       icpc      ...  ucat.cpp
     475       icpc      ...  locmap.cpp
     476       icpc      ...  uloc.cpp
     477       icpc      ...  locid.cpp
     478    In file included from ucurr.cpp(26):
  >> 479    static_unicode_sets.h(130): error #913: invalid multibyte character sequence
     480          {POUND_SIGN, u'£'},
     481                         ^
     482    
     483    In file included from ucurr.cpp(26):
  >> 484    static_unicode_sets.h(130): error #913: invalid multibyte character sequence
     485          {POUND_SIGN, u'£'},
     486                          ^
     487    
     488    In file included from ucurr.cpp(26):
  >> 489    static_unicode_sets.h(130): error: too many characters in character constant
     490          {POUND_SIGN, u'£'},
     491                       ^
     492    
     493    In file included from ucurr.cpp(26):
  >> 494    static_unicode_sets.h(131): error #913: invalid multibyte character sequence
     495          {RUPEE_SIGN, u'₹'},
     496                         ^
     497    
     498    In file included from ucurr.cpp(26):
  >> 499    static_unicode_sets.h(131): error #913: invalid multibyte character sequence
     500          {RUPEE_SIGN, u'₹'},
     501                          ^
     502    
     503    In file included from ucurr.cpp(26):
  >> 504    static_unicode_sets.h(131): error #913: invalid multibyte character sequence
     505          {RUPEE_SIGN, u'₹'},
     506                           ^
     507    
     532    
     533    In file included from ucurr.cpp(26):
  >> 534    static_unicode_sets.h(133): error #913: invalid multibyte character sequence
     535          {WON_SIGN, u'₩'},
     536                        ^
     537    
     538    In file included from ucurr.cpp(26):
  >> 539    static_unicode_sets.h(133): error #913: invalid multibyte character sequence
     540          {WON_SIGN, u'₩'},
     541                         ^
     542    
     543    In file included from ucurr.cpp(26):
  >> 544    static_unicode_sets.h(133): error: too many characters in character constant
     545          {WON_SIGN, u'₩'},
     546                     ^
     547    
     548       icpc      ...  locutil.cpp
     549       icpc      ...  locavailable.cpp
     550       icpc      ...  locdispnames.cpp
     551       icpc      ...  locdspnm.cpp
     552       icpc      ...  loclikely.cpp
     553    compilation aborted for ucurr.cpp (code 2)
     554    *** Failed compilation command follows: ----------------------------------------------------------
     555    /opt/packages/gpjohnsn/spack/lib/spack/env/intel/icpc -D_REENTRANT -DU_HAVE_ELF_H=1 -DU_HAVE_STRTOD_L=1 -DU
            _HAVE_XLOCALE_H=1 -I. -DDEFAULT_ICU_PLUGINS="/opt/packages/gpjohnsn/apps/linux-centos7-broadwell/intel-19.0
            .5.281/icu4c-64.1-62eg7vkvvkgf4ktwpthgk266x6ouqpzq/lib/icu"  -DU_ATTRIBUTE_DEPRECATED= -DU_COMMON_IMPLEMENT
            ATION -std=c++11 -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long -c -DPIC -fPIC -o ucurr.
            o ucurr.cpp
     556    --- ( rebuild with "make VERBOSE=1 all" to show all parameters ) --------
  >> 557    make[1]: *** [ucurr.o] Error 1
     558    make[1]: *** Waiting for unfinished jobs....
     559    make[1]: Leaving directory `/dev/shm/gpjohnsn/spack-stage-icu4c-64.1-62eg7vkvvkgf4ktwpthgk266x6ouqpzq/spack
            -src/source/common'
  >> 560    make: *** [all-recursive] Error 2
```

### Platform and user environment

Please report your OS here:
```commandline
$ uname -a 
Linux argon-build.hpc 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -d
Description:    CentOS Linux release 7.5.1804 (Core) 
``` 

### Additional information


```console
$ spack spec --install-status icu4c%intel                                                   
Input spec
--------------------------------
 -   icu4c%intel

Concretized
--------------------------------
 -   icu4c@64.1%intel@19.0.5.281 cxxstd=11 arch=linux-centos7-broadwell
[+]      ^python@3.7.4%intel@19.0.5.281+bz2+ctypes+dbm+lzma~nis~optimizations patches=ad05cbbb01a6a2a2496274098deea981d205f7c936acf56d976cdb540b87b843 +pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tix~tkinter~ucs4~uuid+zlib arch=linux-centos7-broadwell
[+]          ^bzip2@1.0.8%intel@19.0.5.281+shared arch=linux-centos7-broadwell
[+]              ^diffutils@3.7%intel@19.0.5.281 arch=linux-centos7-broadwell
[+]                  ^libiconv@1.16%intel@19.0.5.281 arch=linux-centos7-broadwell
[+]          ^expat@2.2.9%intel@19.0.5.281+libbsd arch=linux-centos7-broadwell
[+]              ^libbsd@0.10.0%intel@19.0.5.281 patches=71b49f52a01420ab632f23373135853a2565f88725fb77e625a7fbf7ea812eef arch=linux-centos7-broadwell
[+]          ^gdbm@1.18.1%intel@19.0.5.281 arch=linux-centos7-broadwell
[+]              ^readline@8.0%intel@19.0.5.281 arch=linux-centos7-broadwell
[+]                  ^ncurses@6.1%intel@19.0.5.281~symlinks~termlib arch=linux-centos7-broadwell
[+]                      ^pkgconf@1.6.3%intel@19.0.5.281 arch=linux-centos7-broadwell
[+]          ^gettext@0.20.1%intel@19.0.5.281+bzip2+curses+git~libunistring+libxml2+tar+xz arch=linux-centos7-broadwell
[+]              ^libxml2@2.9.9%intel@19.0.5.281~python arch=linux-centos7-broadwell
[+]                  ^xz@5.2.4%intel@19.0.5.281 arch=linux-centos7-broadwell
[+]                  ^zlib@1.2.11%intel@19.0.5.281+optimize+pic+shared arch=linux-centos7-broadwell
[+]              ^tar@1.32%intel@19.0.5.281 arch=linux-centos7-broadwell
[+]          ^libffi@3.2.1%intel@19.0.5.281 arch=linux-centos7-broadwell
[+]          ^openssl@1.1.1d%intel@19.0.5.281+systemcerts arch=linux-centos7-broadwell
[+]              ^perl@5.30.0%intel@19.0.5.281+cpanm+shared+threads arch=linux-centos7-broadwell
[+]          ^sqlite@3.30.1%intel@19.0.5.281~column_metadata+fts~functions~rtree arch=linux-centos7-broadwell
```



Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/icu4c/package.py b/var/spack/repos/builtin/packages/icu4c/package.py
--- a/var/spack/repos/builtin/packages/icu4c/package.py
+++ b/var/spack/repos/builtin/packages/icu4c/package.py
@@ -12,10 +12,9 @@ class Icu4c(AutotoolsPackage):
     C/C++ interface."""
 
     homepage = "http://site.icu-project.org/"
-    url      = "http://download.icu-project.org/files/icu4c/57.1/icu4c-57_1-src.tgz"
-    list_url = "http://download.icu-project.org/files/icu4c"
-    list_depth = 2
+    url      = "https://github.com/unicode-org/icu/releases/download/release-65-1/icu4c-65_1-src.tgz"
 
+    version('65.1', sha256='53e37466b3d6d6d01ead029e3567d873a43a5d1c668ed2278e253b683136d948')
     version('64.1', sha256='92f1b7b9d51b396679c17f35a2112423361b8da3c1b9de00aa94fd768ae296e6')
     version('60.1', sha256='f8f5a6c8fbf32c015a467972bdb1477dc5f5d5dfea908b6ed218715eeb5ee225')
     version('58.2', sha256='2b0a4410153a9b20de0e20c7d8b66049a72aef244b53683d0d7521371683da0c')
@@ -35,8 +34,12 @@ class Icu4c(AutotoolsPackage):
     configure_directory = 'source'
 
     def url_for_version(self, version):
-        url = "http://download.icu-project.org/files/icu4c/{0}/icu4c-{1}-src.tgz"
-        return url.format(version.dotted, version.underscored)
+        if version >= Version('65'):
+            url = "https://github.com/unicode-org/icu/releases/download/release-{0}/icu4c-{1}-src.tgz"
+            return url.format(version.dashed, version.underscored)
+        else:
+            url = "http://download.icu-project.org/files/icu4c/{0}/icu4c-{1}-src.tgz"
+            return url.format(version.dotted, version.underscored)
 
     def flag_handler(self, name, flags):
         if name == 'cxxflags':
@@ -47,6 +50,12 @@ def flag_handler(self, name, flags):
                              self.spec.variants['cxxstd'].value)))
         return (None, flags, None)
 
+    # Need to make sure that locale is UTF-8 in order to process source
+    # files in UTF-8.
+    @when('@59:')
+    def setup_build_environment(self, env):
+        env.set('LC_ALL', 'en_US.UTF-8')
+
     def configure_args(self):
         args = []
 


Test patch: