Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kind: NotFound, message: "program not found" #99

Closed
ghost opened this issue Mar 21, 2023 · 7 comments
Closed

kind: NotFound, message: "program not found" #99

ghost opened this issue Mar 21, 2023 · 7 comments

Comments

@ghost
Copy link

ghost commented Mar 21, 2023

> cargo build -p typst-cli
   Compiling strum v0.24.1
   Compiling notify v5.1.0
   Compiling memmap2 v0.5.10
   Compiling typst-cli v0.0.0 (D:\Desktop\typst-main\cli)
error: failed to run custom build command for `typst-cli v0.0.0 (D:\Desktop\typst-main\cli)`

Caused by:
  process didn't exit successfully:
`D:\Desktop\typst-main\target\debug\build\typst-cli-1d6287d42bbc20b7\build-script-build`
(exit code: 1)
  --- stderr
  Error: Error { kind: NotFound, message: "program not found" }

error message is not very helpful, as it doesn't say what program it was even looking for.

@imatpot
Copy link
Sponsor

imatpot commented Mar 21, 2023

I might know what is causing this. I got a very similar error because I didn't have Git installed. In cli/build.rs there is a line that tries to fetch the current Git revision to add to the environment. This also causes problems when you build Typst in a non-repository (ergo a directory without a .git) as the truncation on line 7 of that same file panics.

This makes Git an undocumented de-facto dependency of Typst, which I personally don't think is good. The revision is also only ever used in println!() statements, which don't really add any benefit apart from development.

@ghost
Copy link
Author

ghost commented Mar 21, 2023

I might know what is causing this. I got a very similar error because I didn't have Git installed. In cli/build.rs there is a line that tries to fetch the current Git revision to add to the environment. This also causes problems when you build Typst in a non-repository (ergo a directory without a .git) as the truncation on line 7 of that same file panics.

@imatpot thanks for chasing this down, you are a cool guy :)

This makes Git an undocumented de-facto dependency of Typst, which I personally don't think is good. The revision is also only ever used in println!() statements, which don't really add any benefit apart from development.

I strongly agree with this paragraph. The whole reason I came to Typst, is because I hate the bloated and complicated process of setting up a LaTeX environment. The smaller, less dependencies, and simpler/faster the build process can be, the better. So to anyone listening, please remove the Git requirement, unless its absolutely needed.

@xkevio
Copy link
Contributor

xkevio commented Mar 21, 2023

From what I've gathered, they are working on removing those git dependencies to be able to package it properly.
That way, it'll soon be just a simple cargo install typst away, the crate name is already reserved.

@laurmaedje
Copy link
Member

I pushed a fix for this. When git is unavailable, the build script fails gracefully now.

@ghost
Copy link
Author

ghost commented Mar 21, 2023

I pushed a fix for this. When git is unavailable, the build script fails gracefully now.

confirmed thanks! @laurmaedje, can you clarify what process is used for building the release? I did this:

cargo build -p typst-cli --release

then ran strip on the result, and the executable is still 22.4 MB. compared to this:

https://github.com/typst/typst/releases/download/22-03-21-2/typst-x86_64-pc-windows-msvc.zip

which when extracted is 17.8 MB. or this:

https://github.com/typst/typst/releases/download/22-03-21/typst-x86_64-pc-windows-msvc.zip

which is only 11.2 MB.

@laurmaedje
Copy link
Member

It shouldn't do anything special. You can see all steps here: https://github.com/typst/typst/blob/main/.github/workflows/release.yml

@ghost ghost closed this as completed Mar 21, 2023
@ghost
Copy link
Author

ghost commented Mar 21, 2023

looks like building without fonts:

cargo build -p typst-cli --release --no-default-features

and then strip typst reduces down to 15.8 MB. good enough!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants