gpt4all: Unable to build typescript binding

System Info

gpt4all version: Unsure (cloned the gpt4all repo 6/17/2023) Python version: Python 3.10.10 Platform: OSX (M1) Node version: 20.3

Information

  • The official example notebooks/scripts
  • My own modified scripts

Related Components

  • backend
  • bindings
  • python-bindings
  • chat-ui
  • models
  • circleci
  • docker
  • api

Reproduction

  1. After cloning, navigate to gpt4all-bindings/typescript
  2. Following the README, run yarn
  3. Get the following error:
  CXX(target) Release/obj.target/gpt4all/../../gpt4all-backend/llmodel_c.o
../../../gpt4all-backend/llmodel_c.cpp:31:5: error: cannot use 'try' with exceptions disabled
    try {
    ^
1 error generated.
make: *** [Release/obj.target/gpt4all/../../gpt4all-backend/llmodel_c.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2

Analysis:

The c++ code that we are trying to compile is using try statements and throw statements. However, the c++ compiler flags provided in binding.gyp prevent the use of exceptions in c++ code (link), making compilation impossible.

I tried modifying the compiler flag to be -fexceptions instead of -fno-exceptions in an attempt to allow exceptions, but this did not change the behavior.

Expected behavior

I would like to be able to run yarn in the typescript binding directory, as specified in the README, without errors, so I can begin using typescript bindings in my node project.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 22

Most upvoted comments

@jacoobes Just FYI, do not include "OTHER_CPLUSPLUSFLAGS": ["-std=gnu++20"], in your changes. I copied this by accident when trying out things. That line actually does not do anything

@dsbrgg hey, ur issue seems related to hermes models.

check #870 the workaround is to make sure npast is not 0 after the second call to prompt. Its a bit unergonomic, and ill try to push out fixes in the ts bindings soon

hey, can you try again? i recently synced my branch with main, i tested and it works on my end (windows x64)

I had a fellow tester make it work on ubuntu, unsure of his architecture however.