You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to build a Homebrew formula (#95) but hitting a problem wherein the cli module's build.rs assumes that it's being run from inside a directory with git information. Looking at it, sure enough, it's trying to use git rev-parse HEAD to get the latest commit. I tried coding around it to get the basename of the current directory instead, but hit some Rust Result/Option safety stuff that exhausted the very limited time I have right now.
I think the better solution for getting build-time information is to use built, which generates some code in a module accessible at runtime for things like hash, version, etc.
I had a similar issue where git rev-parse HEAD failed to run, because the folder of the repository was not considered a save directory. In this case, just rungit config --global --add safe.directory /path/of/typst
Hope that helps someone.
If you download a source archive from a release, e.g. 22-03-21-2, unpack, and cd into it, e.g.
tag=22-03-21-2
thedir=$(mktemp -d -t typst-test-compile)
mkdir -p ${thedir}cd${thedir}
wget https://github.com/typst/typst/archive/refs/tags/${tag}.tar.gz
tar xf ${tag}.tar.gz
cd typst-${tag}
cargo build -p typst-cli
(which is essentially what Homebrew does when building)
you will see
error: failed to run custom build command for `typst-cli v0.0.0 (/private/var/folders/pg/6lxh4v9x1jvfvfnyfl1bpd900000gq/T/typst-test-compile.tMRd0tGk/typst-22-03-21-2/cli)`
Caused by:
process didn't exit successfully: `/private/var/folders/pg/6lxh4v9x1jvfvfnyfl1bpd900000gq/T/typst-test-compile.tMRd0tGk/typst-22-03-21-2/target/debug/build/typst-cli-294daf656803e0dd/build-script-build` (exit status: 101)
--- stderr
thread 'main' panicked at 'byte index 8 is out of bounds of ``', cli/build.rs:7:48
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
I can't speak to the safe.directory thing, I think that's more likely related to a particular environment's git configuration.
Activity
SaadiSave commentedon Mar 22, 2023
Refer to #110, it's a similar issue
N4tus commentedon Mar 22, 2023
I had a similar issue where
git rev-parse HEADfailed to run, because the folder of the repository was not considered a save directory. In this case, just rungit config --global --add safe.directory /path/of/typstHope that helps someone.
CGMossa commentedon Mar 22, 2023
Can we please have some details here? What are you people doing exactly that requires the addition of
safe.directory?colindean commentedon Mar 22, 2023
@CGMossa Sorry, this does warrant more context.
If you download a source archive from a release, e.g. 22-03-21-2, unpack, and cd into it, e.g.
(which is essentially what Homebrew does when building)
you will see
I can't speak to the
safe.directorything, I think that's more likely related to a particular environment's git configuration.Use built for build-time information for version
figsoda commentedon Mar 22, 2023
#173