electron-userland / electron-spellchecker

Implement spellchecking, correctly
MIT License
238 stars 83 forks source link

Unable to build on High Sierra #88

Closed tommoor closed 7 years ago

tommoor commented 7 years ago

I upgraded to High Sierra public beta as it looks like it'll be likely released tomorrow. It seems as though this module doesn't build correctly unfortunately. I've tracked it down to paul's fork / old version of the underlying spellchecker module - perhaps this dep could be updated?

spellchecker

yarn add spellchecker
yarn add v0.23.4
info No lockfile found.
[1/4] πŸ”  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] πŸ”—  Linking dependencies...
[4/4] πŸ“ƒ  Building fresh packages...
success Saved lockfile.
success Saved 3 new dependencies.
β”œβ”€ any-promise@1.3.0
β”œβ”€ nan@2.7.0
└─ spellchecker@3.4.3
✨  Done in 13.06s.

paulcbetts/spellchecker

yarn add @paulcbetts/spellchecker
yarn add v0.23.4
info No lockfile found.
[1/4] πŸ”  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] πŸ”—  Linking dependencies...
[4/4] πŸ“ƒ  Building fresh packages...
[1/1] β‘€ @paulcbetts/spellchecker:             ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error /Users/tom/projects/temp/node_modules/@paulcbetts/spellchecker: Command failed.
Exit code: 1
Command: sh
Arguments: -c node-gyp rebuild
Directory: /Users/tom/projects/temp/node_modules/@paulcbetts/spellchecker
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.1
gyp info using node@7.8.0 | darwin | x64
gyp info spawn /usr/bin/python
gyp info spawn args [ '/usr/local/Cellar/yarn/0.23.4/libexec/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   '/Users/tom/projects/temp/node_modules/@paulcbetts/spellchecker/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/Cellar/yarn/0.23.4/libexec/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/tom/.node-gyp/7.8.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/tom/.node-gyp/7.8.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/Cellar/yarn/0.23.4/libexec/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/tom/projects/temp/node_modules/@paulcbetts/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 make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/base/md5.o
  CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/base/strings/string_piece.o
  CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/google/bdict_reader.o
../vendor/hunspell/src/google/bdict_reader.cc:670:15: warning: unused variable 'begin' [-Wunused-variable]
  const char* begin = reinterpret_cast<const char*>(&bdict_data_[cur_offset_]);
              ^
1 warning generated.
  CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/google/bdict.o
  CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/affentry.o
In file included from ../vendor/hunspell/src/hunspell/affentry.cxx:9:
../vendor/hunspell/src/hunspell/affentry.hxx:30:105: warning: implicit conversion of NULL constant to 'unsigned short' [-Wnull-conversion]
  struct hentry *      check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = NULL);
                                                                                                      ~ ^~~~
                                                                                                        0
../vendor/hunspell/src/hunspell/affentry.hxx:93:114: warning: implicit conversion of NULL constant to 'unsigned short' [-Wnull-conversion]
  struct hentry *   check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = NULL);
                                                                                                               ~ ^~~~
                                                                                                                 0
../vendor/hunspell/src/hunspell/affentry.cxx:546:57: warning: while loop has empty body [-Wempty-body]
                        while (p && *p != ']' && ((p = nextchar(p)) != NULL));
                                                                             ^
../vendor/hunspell/src/hunspell/affentry.cxx:546:57: note: put the semicolon on a separate line to silence this warning
3 warnings generated.
  CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/hunspell/affixmgr.o
In file included from ../vendor/hunspell/src/hunspell/affixmgr.cxx:12:
../vendor/hunspell/src/hunspell/affentry.hxx:30:105: warning: implicit conversion of NULL constant to 'unsigned short' [-Wnull-conversion]
  struct hentry *      check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = NULL);
                                                                                                      ~ ^~~~
                                                                                                        0
../vendor/hunspell/src/hunspell/affentry.hxx:93:114: warning: implicit conversion of NULL constant to 'unsigned short' [-Wnull-conversion]
  struct hentry *   check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = NULL);
                                                                                                               ~ ^~~~
                                                                                                                 0
2 warnings generated.
  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
In file included from ../vendor/hunspell/src/hunspell/hashmgr.cxx:9:
../vendor/hunspell/src/hunspell/hashmgr.hxx:32:21: warning: private field 'userword' is not used [-Wunused-private-field]
  int               userword;
                    ^
1 warning generated.
  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
  CXX(target) Release/obj.target/hunspell/vendor/hunspell/src/base/strings/string16.o
  LIBTOOL-STATIC Release/hunspell.a
  CXX(target) Release/obj.target/spellchecker/src/main.o
  CXX(target) Release/obj.target/spellchecker/src/spellchecker_hunspell.o
  CXX(target) Release/obj.target/spellchecker/src/spellchecker_mac.o
../src/spellchecker_mac.mm:184:13: error: cannot initialize a variable of type 'NSString *' with an rvalue of type 'const NSString *'
  NSString* globalLang = currentGlobalLanguage ? currentGlobalLanguage : autoLangauge;
            ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/spellchecker_mac.mm:185:13: error: cannot initialize a variable of type 'NSString *' with an rvalue of type 'const NSString *'
  NSString* ourLang = this->spellCheckerLanguage ? this->spellCheckerLanguage : autoLangauge;
            ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
make: *** [Release/obj.target/spellchecker/src/spellchecker_mac.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/Cellar/yarn/0.23.4/libexec/node_modules/node-gyp/lib/build.js:285:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:194:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 17.0.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/Cellar/yarn/0.23.4/libexec/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/tom/projects/temp/node_modules/@paulcbetts/spellchecker
gyp ERR! node -v v7.8.0
gyp ERR! node-gyp -v v3.6.1
gyp ERR! not ok
VishwasShashidhar commented 7 years ago

@tommoor Did you find any fix for this?

Jerczu commented 7 years ago

Look at the last comment it fixed the build for me without drastic cuts.

VishwasShashidhar commented 7 years ago

Thanks @Jerczu , will look into it.

Jerczu commented 7 years ago

I managed to build the package without issues. Whether it works in the app I don't know I am still building it. It looks like it's more spellchecker dependency error not the electron-spellchecker itself being broken. Especially if you just updated to new xcode.

Jerczu commented 7 years ago

Actually Scrap all of the above fix is change this line const NSString* autoLanguage = @"___AUTO_LANGUAGE"; to NSString* autoLanguage = @"___AUTO_LANGUAGE"; and it will work like a charm. Edit the spellchecker_mac.mm in @paulcbetts/spellchecker in your node_modules.

VishwasShashidhar commented 7 years ago

Thanks again @Jerczu . Tested it, works locally. Will you raise a PR?

Jerczu commented 7 years ago

Actually Yeah I might just do that

gerges-zz commented 7 years ago

Just want to add the title of this is incorrect, it impacts anyone who's upgraded to XCode 9 (including users on Sierra). To build an electron app that users spellchecker those users will need to manually downgrade XCode

anaisbetts commented 7 years ago

This should be fixed, if you're still seeing it ensure that @paulcbetts/spellchecker is on 4.0.6