calyxir / calyx

Intermediate Language (IL) for Hardware Accelerator Generators
https://calyxir.org
MIT License
453 stars 45 forks source link

Cannot publish `calyx-lsp` #1947

Closed rachitnigam closed 2 months ago

rachitnigam commented 3 months ago

When trying to calyx-publish, I get the error message:

The following warnings were emitted during compilation:

warning: calyx-lsp@0.7.1: clang: error: no such file or directory: 'tree-sitter-calyx/src/parser.c'
warning: calyx-lsp@0.7.1: clang: error: no input files

error: failed to run custom build command for `calyx-lsp v0.7.1 (/Users/rachitnigam/git/calyx/target/package/calyx-lsp-0.7.1)`

Caused by:
  process didn't exit successfully: `/Users/rachitnigam/git/calyx/target/package/calyx-lsp-0.7.1/target/debug/build/calyx-lsp-a33b200fd9a3cd57/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-changed=tree-sitter-calyx/src/parser.c
  TARGET = Some("aarch64-apple-darwin")
  OPT_LEVEL = Some("0")
  HOST = Some("aarch64-apple-darwin")
  cargo:rerun-if-env-changed=CC_aarch64-apple-darwin
  CC_aarch64-apple-darwin = None
  cargo:rerun-if-env-changed=CC_aarch64_apple_darwin
  CC_aarch64_apple_darwin = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  cargo:rerun-if-env-changed=CFLAGS_aarch64-apple-darwin
  CFLAGS_aarch64-apple-darwin = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_apple_darwin
  CFLAGS_aarch64_apple_darwin = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:warning=clang: error: no such file or directory: 'tree-sitter-calyx/src/parser.c'
  cargo:warning=clang: error: no input files

  --- stderr

  error occurred: Command env -u IPHONEOS_DEPLOYMENT_TARGET "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=arm64-apple-darwin" "-mmacosx-version-min=13.1" "-I" "tree-sitter-calyx/src" "-Wall" "-Wextra" "-o" "/Users/rachitnigam/git/calyx/target/package/calyx-lsp-0.7.1/target/debug/build/calyx-lsp-7fb5e927164da4aa/out/47328a7e4e7ea9b1-parser.o" "-c" "tree-sitter-calyx/src/parser.c" with args "cc" did not execute successfully (status code exit status: 1).

Is there a step to get the treesitter stuff @sgpthomas?

sgpthomas commented 3 months ago

Does just cargo build work in calyx-lsp?

Because tree-sitter-calyx/src/parser.c exists in the git tree. So not sure why it would be missing.

rachitnigam commented 3 months ago

Yeah, that works fine

sgpthomas commented 3 months ago

my theory is that cargo publish runs the build.rs script in a different context than normal. I think it runs from the root directory, rather than from the calyx-lsp directory.

sgpthomas commented 3 months ago

Figured this out. We need to explicitly include some extra files so that the .crate file contains everything needed to build the binary.