Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Fix for v8 w/ node 12 + Switch to github actions. + Fix deprecated callback + Provide default value for spellchecker_use_hunspell #130

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

goddessfreya
Copy link
Contributor

βš›πŸ‘‹ Hello there! Welcome. Please follow the steps below to tell us about your contribution.

  1. Copy the correct template for your contribution
  1. Replace this text with the contents of the template
  2. Fill in all sections of the template
  3. Click "Create pull request"

@goddessfreya
Copy link
Contributor Author

Replaces #128

@goddessfreya goddessfreya changed the title Fix for v8 & node 12. Fix for v8 w/ node 12 + Switch to github actions. Dec 20, 2019
@goddessfreya goddessfreya changed the title Fix for v8 w/ node 12 + Switch to github actions. Fix for v8 w/ node 12 + Switch to github actions. + Fix deprecated callback Dec 20, 2019
commit 0c83612
Merge: 2c0d135 5cbdece
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 18:04:18 2019 -0700

    Merge pull request #4 from goddessfreya/Add-Github-actions

    Add Github actions

commit 5cbdece
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 18:01:01 2019 -0700

    Delete appveyor.yml

commit 4ddcbd3
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 18:00:49 2019 -0700

    Delete .travis.yml

commit c6f6c63
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 17:57:45 2019 -0700

    Update nodejs.yml

commit 84bccbd
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 17:55:23 2019 -0700

    Update nodejs.yml

commit f6720ea
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 17:50:59 2019 -0700

    Update nodejs.yml

commit 514a3f9
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 17:31:31 2019 -0700

    Add Github actions

Signed-off-by: Freya Gentz <[email protected]>
commit 84b6708
Merge: fef5593 1a0243e
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 19:43:16 2019 -0700

    Merge pull request #6 from goddessfreya/goddessfreya-patch-1

    Add clang testing

commit 1a0243e
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 19:37:34 2019 -0700

    Update nodejs.yml

commit 18e838f
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 19:35:27 2019 -0700

    Delete package-lock.json

commit d17cf27
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 19:22:57 2019 -0700

    Update nodejs.yml

commit 81c5ae6
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 19:12:42 2019 -0700

    Update nodejs.yml

commit 2db0f18
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 18:56:33 2019 -0700

    Update nodejs.yml

commit 855c3c1
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 18:49:38 2019 -0700

    Update nodejs.yml

commit f80be0a
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 18:38:49 2019 -0700

    Update nodejs.yml

commit 3c52d66
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 18:35:04 2019 -0700

    Update nodejs.yml

commit 5fe3493
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 18:34:31 2019 -0700

    Update nodejs.yml

commit 8c41771
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 18:34:05 2019 -0700

    Update nodejs.yml

commit 5bd03fe
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 18:33:49 2019 -0700

    Update nodejs.yml

commit aab4c50
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 18:33:35 2019 -0700

    Update nodejs.yml

commit 0e6f86f
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 18:30:31 2019 -0700

    Update nodejs.yml

commit fef5593
Merge: 0c83612 e99e477
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 18:16:48 2019 -0700

    Merge pull request #5 from abetomo/fix_deprecated_callback

    Fix deprecated callback

commit 0c83612
Merge: 2c0d135 5cbdece
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 18:04:18 2019 -0700

    Merge pull request #4 from goddessfreya/Add-Github-actions

    Add Github actions

commit 5cbdece
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 18:01:01 2019 -0700

    Delete appveyor.yml

commit 4ddcbd3
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 18:00:49 2019 -0700

    Delete .travis.yml

commit c6f6c63
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 17:57:45 2019 -0700

    Update nodejs.yml

commit 84bccbd
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 17:55:23 2019 -0700

    Update nodejs.yml

commit f6720ea
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 17:50:59 2019 -0700

    Update nodejs.yml

commit 514a3f9
Author: Freya Gentz <[email protected]>
Date:   Thu Dec 19 17:31:31 2019 -0700

    Add Github actions

commit e99e477
Author: abetomo <[email protected]>
Date:   Thu Jul 5 10:25:35 2018 +0900

    Fix deprecated callback

    The following warning.

    ```
    ../src/worker.cc: In member function β€˜virtual void
    CheckSpellingWorker::HandleOKCallback()’:
    ../src/worker.cc:44:25: warning: β€˜v8::Local<v8::Value>
    Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated
    [-Wdeprecated-declarations]
       callback->Call(2, argv);
    ```

Signed-off-by: Freya Gentz <[email protected]>
and add "freebsd" case.

Co-authored-by: Alexander Krotov <[email protected]>
@goddessfreya goddessfreya changed the title Fix for v8 w/ node 12 + Switch to github actions. + Fix deprecated callback Fix for v8 w/ node 12 + Switch to github actions. + Fix deprecated callback + Provide default value for spellchecker_use_hunspell Dec 20, 2019
@goddessfreya
Copy link
Contributor Author

@vladimiry
Copy link

@goddessfreya FYI, the versin with original fix 613ff91 is compilable with @electron 8.0.0-beta.5 (node 12.13.0) and 9.0.0-nightly.20191225 (node 12.14.0) but the HEAD / 98e4377 version is not.

rebuild using 8.0.0-beta.5 and 98e4377
make: Entering directory '/media/dev/_github/electron-mail/node_modules/spellchecker/build'
      CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/affentry.o
      CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/affixmgr.o
      CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/csutil.o
      CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/dictmgr.o
      CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/filemgr.o
      CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/hashmgr.o
      CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/hunspell.o
      CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/hunzip.o
      CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/phonet.o
      CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/replist.o
      CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/suggestmgr.o
      CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/parsers/textparser.o
      AR(target) Release/obj.target/hunspell.a
      COPY Release/hunspell.a
      CXX(target) Release/obj.target/spellchecker/src/main.o
    make: Leaving directory '/media/dev/_github/electron-mail/node_modules/spellchecker/build'
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
    
                    errorOut=gyp info it worked if it ends with ok
    gyp info using [email protected]
    gyp info using [email protected] | linux | x64
    gyp info find Python using Python version 2.7.17 found at "/usr/bin/python2"
    gyp info spawn /usr/bin/python2
    gyp info spawn args [
    gyp info spawn args   '/home/dev/.nvm/versions/node/v12.10.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
    gyp info spawn args   'binding.gyp',
    gyp info spawn args   '-f',
    gyp info spawn args   'make',
    gyp info spawn args   '-I',
    gyp info spawn args   '/media/dev/_github/electron-mail/node_modules/spellchecker/build/config.gypi',
    gyp info spawn args   '-I',
    gyp info spawn args   '/home/dev/.nvm/versions/node/v12.10.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
    gyp info spawn args   '-I',
    gyp info spawn args   '/home/dev/.electron-gyp/8.0.0-beta.5/include/node/common.gypi',
    gyp info spawn args   '-Dlibrary=shared_library',
    gyp info spawn args   '-Dvisibility=default',
    gyp info spawn args   '-Dnode_root_dir=/home/dev/.electron-gyp/8.0.0-beta.5',
    gyp info spawn args   '-Dnode_gyp_dir=/home/dev/.nvm/versions/node/v12.10.0/lib/node_modules/npm/node_modules/node-gyp',
    gyp info spawn args   '-Dnode_lib_file=/home/dev/.electron-gyp/8.0.0-beta.5/<(target_arch)/node.lib',
    gyp info spawn args   '-Dmodule_root_dir=/media/dev/_github/electron-mail/node_modules/spellchecker',
    gyp info spawn args   '-Dnode_engine=v8',
    gyp info spawn args   '--depth=.',
    gyp info spawn args   '--no-parallel',
    gyp info spawn args   '--generator-output',
    gyp info spawn args   'build',
    gyp info spawn args   '-Goutput_dir=.'
    gyp info spawn args ]
    gyp info spawn make
    gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
    In file included from ../vendor/hunspell/src/hunspell/affentry.cxx:9:
    ../vendor/hunspell/src/hunspell/affentry.hxx:30:105: warning: converting to non-pointer type β€˜short unsigned int’ from NULL [-Wconversion-null]
       30 |   struct hentry *      check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = NULL);
          |                                                                                                         ^~~~
    ../vendor/hunspell/src/hunspell/affentry.hxx:93:114: warning: converting to non-pointer type β€˜short unsigned int’ from NULL [-Wconversion-null]
       93 |   struct hentry *   check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = NULL);
          |                                                                                                                  ^~~~
    ../vendor/hunspell/src/hunspell/affentry.cxx: In member function β€˜int PfxEntry::test_condition(const char*)’:
    ../vendor/hunspell/src/hunspell/affentry.cxx:113:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
      113 |          case '.': if (!pos) { // dots are not metacharacters in groups: [.]
          |                    ^~
    ../vendor/hunspell/src/hunspell/affentry.cxx:120:5: note: here
      120 |     default: {
          |     ^~~~~~~
    ../vendor/hunspell/src/hunspell/affentry.cxx: In member function β€˜int SfxEntry::test_condition(const char*, const char*)’:
    ../vendor/hunspell/src/hunspell/affentry.cxx:501:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
      501 |         case '.': if (!pos) { // dots are not metacharacters in groups: [.]
          |                   ^~
    ../vendor/hunspell/src/hunspell/affentry.cxx:516:5: note: here
      516 |     default: {
          |     ^~~~~~~
    In file included from ../vendor/hunspell/src/hunspell/affixmgr.cxx:12:
    ../vendor/hunspell/src/hunspell/affentry.hxx:30:105: warning: converting to non-pointer type β€˜short unsigned int’ from NULL [-Wconversion-null]
       30 |   struct hentry *      check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = NULL);
          |                                                                                                         ^~~~
    ../vendor/hunspell/src/hunspell/affentry.hxx:93:114: warning: converting to non-pointer type β€˜short unsigned int’ from NULL [-Wconversion-null]
       93 |   struct hentry *   check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = NULL);
          |                                                                                                                  ^~~~
    ../vendor/hunspell/src/hunspell/affixmgr.cxx: In member function β€˜int AffixMgr::parse_convtable(char*, FileMgr*, RepList**, const char*)’:
    ../vendor/hunspell/src/hunspell/affixmgr.cxx:3654:58: warning: argument to β€˜sizeof’ in β€˜int strncmp(const char*, const char*, size_t)’ call is the same expression as the second source; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
     3654 |                              if (strncmp(piece, keyword, sizeof(keyword)) != 0) {
          |                                                          ^~~~~~~~~~~~~~~
    ../vendor/hunspell/src/hunspell/affixmgr.cxx: In member function β€˜int AffixMgr::encodeit(affentry&, char*)’:
    ../vendor/hunspell/src/hunspell/affixmgr.cxx:1075:12: warning: β€˜char* strncpy(char*, const char*, size_t)’ specified bound 20 equals destination size [-Wstringop-truncation]
     1075 |     strncpy(entry.c.conds, cs, MAXCONDLEN);
          |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../vendor/hunspell/src/hunspell/csutil.cxx: In function β€˜void strlinecat(char*, const char*)’:
    ../vendor/hunspell/src/hunspell/csutil.cxx:411:24: warning: β€˜char* strncpy(char*, const char*, size_t)’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
      411 |                 strncpy(dest, s, len);
          |                 ~~~~~~~^~~~~~~~~~~~~~
    ../vendor/hunspell/src/hunspell/csutil.cxx:407:21: note: length computed here
      407 |     int len = strlen(s);
          |               ~~~~~~^~~
    ../vendor/hunspell/src/hunspell/csutil.cxx: In function β€˜char* mystrrep(char*, const char*, const char*)’:
    ../vendor/hunspell/src/hunspell/csutil.cxx:567:16: warning: β€˜char* strncpy(char*, const char*, size_t)’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
      567 |         strncpy(pos, rep, replen);
          |         ~~~~~~~^~~~~~~~~~~~~~~~~~
    ../vendor/hunspell/src/hunspell/csutil.cxx:552:26: note: length computed here
      552 |       int replen = strlen(rep);
          |                    ~~~~~~^~~~~
    ../vendor/hunspell/src/hunspell/dictmgr.cxx: In member function β€˜int DictMgr::parse_file(const char*, const char*)’:
    ../vendor/hunspell/src/hunspell/dictmgr.cxx:102:37: warning: this statement may fall through [-Wimplicit-fallthrough=]
      102 |                        pdict->region=NULL;
          |                                     ^
    ../vendor/hunspell/src/hunspell/dictmgr.cxx:103:21: note: here
      103 |                     case 2: //deliberate fallthrough
          |                     ^~~~
    ../vendor/hunspell/src/hunspell/hunspell.cxx: In member function β€˜int Hunspell::spell(const char*, int*, char**)’:
    ../vendor/hunspell/src/hunspell/hunspell.cxx:369:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
      369 |             *info += SPELL_ORIGCAP;
    ../vendor/hunspell/src/hunspell/hunspell.cxx:370:6: note: here
      370 |      case NOCAP: {
          |      ^~~~
    ../vendor/hunspell/src/hunspell/hunspell.cxx:439:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
      439 |             }
          |             ^
    ../vendor/hunspell/src/hunspell/hunspell.cxx:441:6: note: here
      441 |      case INITCAP: {
          |      ^~~~
    ../vendor/hunspell/src/hunspell/hunspell.cxx: In member function β€˜int Hunspell::suggest(char***, const char*)’:
    ../vendor/hunspell/src/hunspell/hunspell.cxx:741:30: warning: this statement may fall through [-Wimplicit-fallthrough=]
      741 |                     capwords = 1;
          |                     ~~~~~~~~~^~~
    ../vendor/hunspell/src/hunspell/hunspell.cxx:742:6: note: here
      742 |      case HUHCAP: {
          |      ^~~~
    ../vendor/hunspell/src/hunspell/hunspell.cxx:865:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
      865 |               capwords = 1;
          |               ~~~~~~~~~^~~
    ../vendor/hunspell/src/hunspell/hunspell.cxx:866:11: note: here
      866 |           case HUHCAP: {
          |           ^~~~
    ../vendor/hunspell/src/hunspell/suggestmgr.cxx: In member function β€˜char* SuggestMgr::suggest_gen(char**, int, char*)’:
    ../vendor/hunspell/src/hunspell/suggestmgr.cxx:1723:12: warning: β€˜char* strncpy(char*, const char*, size_t)’ output truncated before terminating nul copying 3 bytes from a string of the same length [-Wstringop-truncation]
     1723 |     strncpy(ds, MORPH_TERM_SFX, MORPH_TAG_LEN);
          |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from /home/dev/.electron-gyp/8.0.0-beta.5/include/node/node.h:63,
                     from ../../nan/nan.h:54,
                     from ../src/main.cc:3:
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:8924:75: warning: β€˜v8::MicrotasksCompletedCallback’ is deprecated: Use *WithData version. [-Wdeprecated-declarations]
     8924 |   void AddMicrotasksCompletedCallback(MicrotasksCompletedCallback callback);
          |                                                                           ^
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:7239:16: note: declared here
     7239 | typedef void (*MicrotasksCompletedCallback)(Isolate*);
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:8932:78: warning: β€˜v8::MicrotasksCompletedCallback’ is deprecated: Use *WithData version. [-Wdeprecated-declarations]
     8932 |   void RemoveMicrotasksCompletedCallback(MicrotasksCompletedCallback callback);
          |                                                                              ^
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:7239:16: note: declared here
     7239 | typedef void (*MicrotasksCompletedCallback)(Isolate*);
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from ../src/main.cc:3:
    ../../nan/nan.h: In function β€˜void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
    ../../nan/nan.h:2298:62: warning: cast between incompatible function types from β€˜void (*)(uv_work_t*)’ {aka β€˜void (*)(uv_work_s*)’} to β€˜uv_after_work_cb’ {aka β€˜void (*)(uv_work_s*, int)’} [-Wcast-function-type]
     2298 |     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
          |                                                              ^
    ../src/main.cc: In static member function β€˜static Nan::NAN_METHOD_RETURN_TYPE {anonymous}::Spellchecker::CheckSpelling(Nan::NAN_METHOD_ARGS_TYPE)’:
    ../src/main.cc:149:89: error: no matching function for call to β€˜v8::Object::Set(v8::Local<v8::String>, Nan::imp::IntegerFactory<v8::Integer>::return_t)’
      149 |       misspelled_range->Set(Nan::New("start").ToLocalChecked(), Nan::New<Integer>(start));
          |                                                                                         ^
    In file included from /home/dev/.electron-gyp/8.0.0-beta.5/include/node/node.h:63,
                     from ../../nan/nan.h:54,
                     from ../src/main.cc:3:
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3612:37: note: candidate: β€˜v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’
     3612 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
          |                                     ^~~
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3612:37: note:   candidate expects 3 arguments, 2 provided
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3615:37: note: candidate: β€˜v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)’
     3615 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
          |                                     ^~~
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3615:37: note:   candidate expects 3 arguments, 2 provided
    ../src/main.cc:150:85: error: no matching function for call to β€˜v8::Object::Set(v8::Local<v8::String>, Nan::imp::IntegerFactory<v8::Integer>::return_t)’
      150 |       misspelled_range->Set(Nan::New("end").ToLocalChecked(), Nan::New<Integer>(end));
          |                                                                                     ^
    In file included from /home/dev/.electron-gyp/8.0.0-beta.5/include/node/node.h:63,
                     from ../../nan/nan.h:54,
                     from ../src/main.cc:3:
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3612:37: note: candidate: β€˜v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’
     3612 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
          |                                     ^~~
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3612:37: note:   candidate expects 3 arguments, 2 provided
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3615:37: note: candidate: β€˜v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)’
     3615 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
          |                                     ^~~
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3615:37: note:   candidate expects 3 arguments, 2 provided
    ../src/main.cc:151:42: error: no matching function for call to β€˜v8::Array::Set(size_t&, v8::Local<v8::Object>&)’
      151 |       result->Set(index, misspelled_range);
          |                                          ^
    In file included from /home/dev/.electron-gyp/8.0.0-beta.5/include/node/node.h:63,
                     from ../../nan/nan.h:54,
                     from ../src/main.cc:3:
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3612:37: note: candidate: β€˜v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’
     3612 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
          |                                     ^~~
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3612:37: note:   candidate expects 3 arguments, 2 provided
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3615:37: note: candidate: β€˜v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)’
     3615 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
          |                                     ^~~
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3615:37: note:   candidate expects 3 arguments, 2 provided
    ../src/main.cc: In static member function β€˜static Nan::NAN_METHOD_RETURN_TYPE {anonymous}::Spellchecker::GetAvailableDictionaries(Nan::NAN_METHOD_ARGS_TYPE)’:
    ../src/main.cc:241:73: error: no matching function for call to β€˜v8::Array::Set(size_t&, v8::Local<v8::String>)’
      241 |       result->Set(i, Nan::New(dict.data(), dict.size()).ToLocalChecked());
          |                                                                         ^
    In file included from /home/dev/.electron-gyp/8.0.0-beta.5/include/node/node.h:63,
                     from ../../nan/nan.h:54,
                     from ../src/main.cc:3:
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3612:37: note: candidate: β€˜v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’
     3612 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
          |                                     ^~~
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3612:37: note:   candidate expects 3 arguments, 2 provided
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3615:37: note: candidate: β€˜v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)’
     3615 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
          |                                     ^~~
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3615:37: note:   candidate expects 3 arguments, 2 provided
    ../src/main.cc: In static member function β€˜static Nan::NAN_METHOD_RETURN_TYPE {anonymous}::Spellchecker::GetCorrectionsForMisspelling(Nan::NAN_METHOD_ARGS_TYPE)’:
    ../src/main.cc:273:42: error: no matching function for call to β€˜v8::Array::Set(size_t&, v8::Local<v8::String>)’
      273 |       result->Set(i, val.ToLocalChecked());
          |                                          ^
    In file included from /home/dev/.electron-gyp/8.0.0-beta.5/include/node/node.h:63,
                     from ../../nan/nan.h:54,
                     from ../src/main.cc:3:
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3612:37: note: candidate: β€˜v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’
     3612 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
          |                                     ^~~
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3612:37: note:   candidate expects 3 arguments, 2 provided
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3615:37: note: candidate: β€˜v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)’
     3615 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
          |                                     ^~~
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3615:37: note:   candidate expects 3 arguments, 2 provided
    ../src/main.cc: In static member function β€˜static void {anonymous}::Spellchecker::Init(v8::Local<v8::Object>)’:
    ../src/main.cc:317:103: error: no matching function for call to β€˜v8::Object::Set(v8::Local<v8::String>, v8::Local<v8::Function>)’
      317 |     exports->Set(Nan::New("Spellchecker").ToLocalChecked(), tpl->GetFunction(context).ToLocalChecked());
          |                                                                                                       ^
    In file included from /home/dev/.electron-gyp/8.0.0-beta.5/include/node/node.h:63,
                     from ../../nan/nan.h:54,
                     from ../src/main.cc:3:
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3612:37: note: candidate: β€˜v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’
     3612 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
          |                                     ^~~
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3612:37: note:   candidate expects 3 arguments, 2 provided
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3615:37: note: candidate: β€˜v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)’
     3615 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
          |                                     ^~~
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:3615:37: note:   candidate expects 3 arguments, 2 provided
    In file included from ../../nan/nan.h:54,
                     from ../src/main.cc:3:
    ../src/main.cc: At global scope:
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/node.h:568:43: warning: cast between incompatible function types from β€˜void (*)(v8::Local<v8::Object>, v8::Local<v8::Object>)’ to β€˜node::addon_register_func’ {aka β€˜void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
      568 |       (node::addon_register_func) (regfunc),                          \
          |                                           ^
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/node.h:602:3: note: in expansion of macro β€˜NODE_MODULE_X’
      602 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
          |   ^~~~~~~~~~~~~
    ../src/main.cc:328:1: note: in expansion of macro β€˜NODE_MODULE’
      328 | NODE_MODULE(spellchecker, Init)
          | ^~~~~~~~~~~
    In file included from /home/dev/.electron-gyp/8.0.0-beta.5/include/node/node.h:63,
                     from ../../nan/nan.h:54,
                     from ../src/main.cc:3:
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h: In instantiation of β€˜void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/node_object_wrap.h:84:78:   required from here
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:10580:16: warning: cast between incompatible function types from β€˜v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka β€˜void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to β€˜Callback’ {aka β€˜void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
    10580 |                reinterpret_cast<Callback>(callback), type);
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h: In instantiation of β€˜void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
    ../../nan/nan_object_wrap.h:65:61:   required from here
    /home/dev/.electron-gyp/8.0.0-beta.5/include/node/v8.h:10580:16: warning: cast between incompatible function types from β€˜v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka β€˜void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to β€˜Callback’ {aka β€˜void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
    make: *** [spellchecker.target.mk:122: Release/obj.target/spellchecker/src/main.o] Error 1
    gyp ERR! build error 
    gyp ERR! stack Error: `make` failed with exit code: 2
    gyp ERR! stack     at ChildProcess.onExit (/home/dev/.nvm/versions/node/v12.10.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:196:23)
    gyp ERR! stack     at ChildProcess.emit (events.js:209:13)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
    gyp ERR! System Linux 5.4.2-1-MANJARO
    gyp ERR! command "/home/dev/.nvm/versions/node/v12.10.0/bin/node" "/home/dev/.nvm/versions/node/v12.10.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
    gyp ERR! cwd /media/dev/_github/electron-mail/node_modules/spellchecker
    gyp ERR! node -v v12.10.0
    gyp ERR! node-gyp -v v5.0.3
    gyp ERR! not ok 
    error Command failed with exit code 1.
    
                    command=/home/dev/.nvm/versions/node/v12.10.0/bin/node /usr/lib/node_modules/yarn/bin/yarn.js run install
                    workingDir=/media/dev/_github/electron-mail/node_modules/spellchecker
error Command failed with exit code 1.

@goddessfreya
Copy link
Contributor Author

Unfortunately, I tried my best and could not reproduce this build failure.

Running the following:

#!/bin/zsh -x

. ~/utils/prepare_nvm

FAILED=()
for v in 1 2 3 4 5 6 7 8 9 10 11 12 13 12.14.0 12.13.0; do
    echo Doing $v
    rm build node_modules package-lock.json -rf
    nvm install v$v
    nvm exec v$v npm install || FAILED+=($v)
done

echo Failed on versions "${FAILED[@]}"

Results in Failed on versions 1 2 3 4 5 6, which is expected.

All the v12.x CIs also did not fail at building spellchecker:
https://github.com/goddessfreya/node-spellchecker/runs/357515911
https://github.com/goddessfreya/node-spellchecker/runs/357515904
https://github.com/goddessfreya/node-spellchecker/runs/357515897
https://github.com/goddessfreya/node-spellchecker/runs/357515892
https://github.com/goddessfreya/node-spellchecker/runs/357515887

Can you provide me steps for reproducing this build failure?

@vladimiry
Copy link

Can you provide me steps for reproducing this build failure?

Being located in the module directory execute (node-gyp needs to be available in the PATH or install it as npm module running npm add --dev --no-save node-gyp and then the executable is ./node_modules/.bin/node-gyp):

HOME=~/.electron-gyp node-gyp rebuild --target=8.0.0-beta.5 --arch=x64 --dist- url=https://electronjs.org/headers

https://electronjs.org/docs/tutorial/using-native-node-modules

@goddessfreya
Copy link
Contributor Author

@vladimiry I got it to build with electron 7.1.7, and unfortunately the beta is not packaged in Archlinux's repos. I tried to build the beta manually, but the build just failed to apply some patches after 45 minutes of building, sooo, yeah.

Could you submit a PR against https://github.com/goddessfreya/node-spellchecker that resolved your build issues?

@vladimiry
Copy link

vladimiry commented Dec 27, 2019

the beta is not packaged in Archlinux's repos
build just failed to apply some patches after 45 minutes of building

I'm not sure what you mean by this. If you run Archlinux this is how to reproduce the issue:

  • sudo pacman -S node-gyp
  • git clone [email protected]:goddessfreya/node-spellchecker.git && cd node-spellchecker
  • npm install
  • HOME=~/.electron-gyp node-gyp rebuild --target=8.0.0-beta.5 --arch=x64 --dist- url=https://electronjs.org/headers Execution of this command takes something like 5-10 seconds max.

Then if you rewind to 613ff91 (corresponds to the #128 PR you posted before) and run HOME=~/.electron-gyp node-gyp rebuild --target=8.0.0-beta.5 --arch=x64 --dist- url=https://electronjs.org/headers again it will be successfuly compiled.

@goddessfreya
Copy link
Contributor Author

Following those instructions, I get the following, which is not the error reported by you: https://gist.github.com/goddessfreya/90babde3d51401c51ef9e3d717bd5f05

That lead me to believe it was a configuration error. Because of that, I decided to follow this section of the Arch packing guidelines to get it to build against the system's electron: https://wiki.archlinux.org/index.php/Electron_package_guidelines#Building_compiled_extensions_against_the_system_electron

With some fiddling of the provided instructions, this succeeded: https://gist.github.com/goddessfreya/904f5624d0db419f25aa54d3142c718f

As you may note, the system electron is version 7.1.7. As I mentioned, after fiddling with electron's PKGBUILD for ~50 minutes (45 minutes of which were waiting for electron to build), I could not get the version 8 alpha to build.

@vladimiry
Copy link

vladimiry commented Dec 27, 2019

@goddessfreya looks like node-gyp failed to find expected Python on your system. In my case, this is how the beginning of the command output looks like (you don't have last two lines listed here and PythonFinder raises the error below in your log):

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info find Python using Python version 3.8.0 found at "/usr/bin/python3"
gyp info spawn /usr/bin/python3

So you need to install python package too https://wiki.archlinux.org/index.php/Python (then maybe try running which python) or making node-gyp see the python if you have it installed in an unusual way see https://github.com/nodejs/node-gyp#configuring-python-dependency

@goddessfreya
Copy link
Contributor Author

I most certainly have python installed, I remember building it myself for unrelated reasons:

$ pacman -Q | grep python-gentz
lib32-python-gentz 3.8.1-2
python-gentz 3.8.1-2
$ pacman -Qqo /usr/bin/python  
python-gentz
$ which python
/usr/bin/python
$ python --version           
Python 3.8.1

Neither adding --python /usr/bin/python, exporting NODE_GYP_FORCE_PYTHON=/usr/bin/python nor calling npm config set python /usr/bin/python resolved the issue.

@vladimiry
Copy link

vladimiry commented Dec 27, 2019

@goddessfreya so you have custom python3, maybe then try installing sudo pacman -S python2 and then run PYTHON=/usr/bin/python2 HOME=~/.electron-gyp node-gyp rebuild --target=8.0.0-beta.5 --arch=x64 --dist- url=https://electronjs.org/headers (notice PYTHON=/usr/bin/python2) which is compatible with node-gyp and prints when executed:

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info find Python using Python version 2.7.17 found at "/usr/bin/python2"
gyp info spawn /usr/bin/python2
...

@goddessfreya
Copy link
Contributor Author

@vladimiry
Copy link

My bad, I noticed only now that python finder is a JS script and the exception is related to semver, so try installing it sudo pacman -S semver.

@goddessfreya
Copy link
Contributor Author

@vladimiry That package is already installed.

@goddessfreya
Copy link
Contributor Author

Alright, so I applied this patch to the system's node-gyp installation:

diff --git a/find-python.js b/usr/lib/node_modules/node-gyp/lib/find-python.js
index 9d918a8..43bf859 100644
--- a/find-python.js
+++ b/usr/lib/node_modules/node-gyp/lib/find-python.js
@@ -226,7 +226,7 @@ PythonFinder.prototype = {
       }
       this.addLog(`- version is "${version}"`)
 
-      const range = semver.Range(this.semverRange)
+      const range = new semver.Range(this.semverRange)
       var valid = false
       try {
         valid = range.test(version)

Now, when I run the command, I get the following:

$ HOME=~/.electron-gyp node-gyp rebuild --target=8.0.0-beta.5 --arch=x64 --dist- url=https://electronjs.org/headers
gyp info it worked if it ends with ok
gyp info using node-gyp@6.0.1
gyp info using node@13.5.0 | linux | x64
gyp info find Python using Python version 3.8.1 found at "/usr/bin/python3"
gyp http GET url=https://electronjs.org/headers/v8.0.0-beta.5/node-v8.0.0-beta.5.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: Invalid URI "url=https://electronjs.org/headers/v8.0.0-beta.5/node-v8.0.0-beta.5.tar.gz"
gyp ERR! stack     at Request.init (/usr/lib/node_modules/node-gyp/node_modules/request/request.js:273:31)
gyp ERR! stack     at new Request (/usr/lib/node_modules/node-gyp/node_modules/request/request.js:127:8)
gyp ERR! stack     at request (/usr/lib/node_modules/node-gyp/node_modules/request/index.js:53:10)
gyp ERR! stack     at download (/usr/lib/node_modules/node-gyp/lib/install.js:426:13)
gyp ERR! stack     at /usr/lib/node_modules/node-gyp/lib/install.js:162:19
gyp ERR! stack     at /usr/lib/node_modules/node-gyp/node_modules/mkdirp/index.js:30:20
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:153:23)
gyp ERR! System Linux 5.4.6.a-1-hardened
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild" "--target=8.0.0-beta.5" "--arch=x64" "--dist-" "url=https://electronjs.org/headers"
gyp ERR! cwd /home/gentz/Documents/node-spellchecker
gyp ERR! node -v v13.5.0
gyp ERR! node-gyp -v v6.0.1
gyp ERR! not ok 

@vladimiry
Copy link

Replace --dist- url=https://electronjs.org/headers with --dist-url=https://electronjs.org/headers (notice extra space there).

@vladimiry
Copy link

so I applied this patch to the system's node-gyp installation:

Btw nodejs/node-gyp#2005

@goddessfreya
Copy link
Contributor Author

Ah, nice to know it was already reported.

Signed-off-by: Freya Gentz <[email protected]>
@goddessfreya
Copy link
Contributor Author

@vladimiry Thanks for the help getting electron to work. I've pushed the fix: 37cebc4

@vladimiry
Copy link

vladimiry commented Dec 27, 2019

Very nice, can confirm compilation got working with both 8.0.0-beta.5 and 9.0.0-nightly.20191225.

@garrettm
Copy link

Will this be merged into a new release soon?

@vladimiry
Copy link

It works with electron v10 too by the way.

@eugene-pr
Copy link

Will the fixes be merged anytime, or the package is not supported anymore? We want to move to electron@9, and currently have an issue with building the app. It fails on compiling spellchecker native deps.

@niftylettuce
Copy link

I've pinged the maintainers by email to get an update on this, or if I can step in and help maintain.

@niftylettuce
Copy link

@goddessfreya any chance you could merge in #69 into your PR?

@niftylettuce
Copy link

You can use https://github.com/Wulf/nodehun in the meanwhile. brew install hunspell or sudo apt-get install hunspell. Not sure about Windows support, but it looks like Chocolatey has hunspell package as well.

@vladimiry
Copy link

It works with electron v10 too by the way.

v11 is also fine, just tried 11.0.0-beta.3.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants