Intl not defined in V8 8.8

71 Views Asked by At

I build v8 as a static monolithic library for my macOS x86_64 system (for a javascript runtime project). The V8 version i used is 8.8.278.17. Followed the steps from https://v8.dev/docs/i18n Still when i try to execute a javascript code which uses Intl.DateTimeFormat object. I get Intl not defined error. (acc to https://v8.dev/blog/intl we should have Intl support on v8)

ICU version installed in system is 70.1 which shows that is supports Intl object. I tried to map v8 version with Intl compatibilty but i didn't found any reference which suggest that issue is due to v8 version.

Can anybody help if its due to v8 version mismatch or perhaps how the ICU library are installed or something else

Added the link to the sample project : https://github.com/hardikjain1008/test-v8/

1

There are 1 best solutions below

2
jmrk On

Comparing your code to the official "hello, world" sample, a few things stand out:

  • Your question says you're working with V8 8.8.278.17 (which is a surprising choice, given its old age: 3 years!), but the repro case you've uploaded uses V8 11.6.189.22 (from a more reasonable 5 months ago). Which is it?

  • The official sample calls v8::V8::InitializeICUDefaultLocation(argv[0]);. You do v8::V8::InitializeICU();. Have you tried doing what the official sample does? Does that help?

  • The documentation for v8::V8::InitializeICU() (which you're calling) says:

    * If V8 was compiled with the ICU data in an external file, the location
    * of the data file has to be provided.
    

    Since you're not providing the data file's location, I guess it's not surprising that something isn't working?

  • You call PLATFORM = v8::platform::NewDefaultPlatform() twice. While that's most likely unrelated to the problem you're having, it's also entirely unnecessary.