Failed to create ICU collator, are ICU data files missing?
hsyed opened this issue · comments
Packaging graphql into postgres and then using the printSchema
function will trigger the ICU support. The following error will kill a backend:
# Fatal error in , line 0
# Failed to create ICU collator, are ICU data files missing?
#
==== C stack trace ===============================
/usr/lib/postgresql/9.6/lib/plv8.so(v8::base::debug::StackTrace::StackTrace()+0xe) [0x7f1d3b15793e]
/usr/lib/postgresql/9.6/lib/plv8.so(V8_Fatal+0xe0) [0x7f1d3b156350]
/usr/lib/postgresql/9.6/lib/plv8.so(+0xc1dab2) [0x7f1d3b142ab2]
/usr/lib/postgresql/9.6/lib/plv8.so(v8::internal::Runtime_CreateCollator(int, v8::internal::Object**, v8::internal::Isolate*)+0x14a) [0x7f1d3b07787a]
[0x1328cc0060c7]
I edited the docker file to add libicu-dev
to the buildDependencies
. I originally thought the library might need to be linked in statically. This didn't solve the problem. Does the static version of ICU not link in it's data statically ? Anyhow.
I added another layer to get the data files in:
RUN apt-get update \ && apt-get install -y libicu52 libicu-dev
With the hopes that this would solve the problem -- the ICU data object is available in the container under:
root@2ee21715730b:/# find / | grep libicudata
/usr/lib/x86_64-linux-gnu/libicudata.so.52.1
/usr/lib/x86_64-linux-gnu/libicudata.a
/usr/lib/x86_64-linux-gnu/libicudata.so
/usr/lib/x86_64-linux-gnu/libicudata.so.52
This should trigger the error for you:
DO LANGUAGE plv8 $$
var options =
{ year: "numeric", month: "long", day: "numeric",
hour: "2-digit", minute: "2-digit",
timeZoneName: "short", timeZone: "UTC" };
var portugueseTime =
new Intl.DateTimeFormat(["pt-BR", "pt-PT"], options);
$$;
the bundled ICU that comes with v8 does not link the data files, but instead builds them and mmap's them (depending on platform).
I've added a contrib
directory to https://github.com/JerrySievert/plv8 as a workaround, there are instructions in the README - otherwise, you can try building with the system ICU (see icu.gyp and use_system_icu=1
in third_party/icu
@JerrySievert many thanks -- hopefully we can integrate that here. @clkao is this possible ?