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

Can build standalone but not as dependency #1178

Open
sjml opened this issue Mar 29, 2024 · 0 comments
Open

Can build standalone but not as dependency #1178

sjml opened this issue Mar 29, 2024 · 0 comments

Comments

@sjml
Copy link

sjml commented Mar 29, 2024

I'm trying to embed Tectonic in another program but am running into build issues that I can't quite pin down...

I'm building on macOS with dependencies installed via Homebrew.

This works just fine:

git clone https://github.com/tectonic-typesetting/tectonic
cd tectonic
git submodule update --init
PKG_CONFIG_PATH=$(brew --prefix icu4c)/lib/pkgconfig cargo build

But this fails:

cargo new tectonic-embed
cd tectonic-embed
cargo add tectonic
PKG_CONFIG_PATH=$(brew --prefix icu4c)/lib/pkgconfig cargo build

With trouble building the vendored HarfBuzz, it looks like.

[snip]
error: failed to run custom build command for `tectonic_bridge_harfbuzz v0.2.9`

Caused by:
  process didn't exit successfully: `/Users/shane/Projects/tectonic-embed/target/debug/build/tectonic_bridge_harfbuzz-e78f2c9e3f07e8a3/build-script-build` (exit status: 101)
  --- stdout
  TARGET = Some("aarch64-apple-darwin")
  OPT_LEVEL = Some("0")
  HOST = Some("aarch64-apple-darwin")
  cargo:rerun-if-env-changed=CXX_aarch64-apple-darwin
  CXX_aarch64-apple-darwin = None
  cargo:rerun-if-env-changed=CXX_aarch64_apple_darwin
  CXX_aarch64_apple_darwin = None
  cargo:rerun-if-env-changed=HOST_CXX
  HOST_CXX = None
  cargo:rerun-if-env-changed=CXX
  CXX = 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=CXXFLAGS_aarch64-apple-darwin
  CXXFLAGS_aarch64-apple-darwin = None
  cargo:rerun-if-env-changed=CXXFLAGS_aarch64_apple_darwin
  CXXFLAGS_aarch64_apple_darwin = None
  cargo:rerun-if-env-changed=HOST_CXXFLAGS
  HOST_CXXFLAGS = None
  cargo:rerun-if-env-changed=CXXFLAGS
  CXXFLAGS = None
  cargo:rerun-if-env-changed=AR_aarch64-apple-darwin
  AR_aarch64-apple-darwin = None
  cargo:rerun-if-env-changed=AR_aarch64_apple_darwin
  AR_aarch64_apple_darwin = None
  cargo:rerun-if-env-changed=HOST_AR
  HOST_AR = None
  cargo:rerun-if-env-changed=AR
  AR = None
  cargo:rerun-if-env-changed=ARFLAGS_aarch64-apple-darwin
  ARFLAGS_aarch64-apple-darwin = None
  cargo:rerun-if-env-changed=ARFLAGS_aarch64_apple_darwin
  ARFLAGS_aarch64_apple_darwin = None
  cargo:rerun-if-env-changed=HOST_ARFLAGS
  HOST_ARFLAGS = None
  cargo:rerun-if-env-changed=ARFLAGS
  ARFLAGS = None
  cargo:rustc-link-lib=static=harfbuzz
  cargo:rustc-link-search=native=/Users/shane/Projects/tectonic-embed/target/debug/build/tectonic_bridge_harfbuzz-d62862240405c468/out
  cargo:rerun-if-env-changed=CXXSTDLIB_aarch64-apple-darwin
  CXXSTDLIB_aarch64-apple-darwin = None
  cargo:rerun-if-env-changed=CXXSTDLIB_aarch64_apple_darwin
  CXXSTDLIB_aarch64_apple_darwin = None
  cargo:rerun-if-env-changed=HOST_CXXSTDLIB
  HOST_CXXSTDLIB = None
  cargo:rerun-if-env-changed=CXXSTDLIB
  CXXSTDLIB = None
  cargo:rustc-link-lib=c++
  cargo:include-path=/Users/shane/Projects/tectonic-embed/target/debug/build/tectonic_bridge_harfbuzz-d62862240405c468/out;/opt/homebrew/Cellar/graphite2/1.3.14/include

  --- stderr
  thread 'main' panicked at /Users/shane/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tectonic_bridge_harfbuzz-0.2.9/build.rs:143:47:
  failed to copy header: Os { code: 2, kind: NotFound, message: "No such file or directory" }
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I noted this discussion where the problem was resolved by enabling external-harfbuzz but that just seems to have a different set of build issues where it looks like the XeTeX build is looking for <harfbuzz/hb.h> but the pkg-config include flag is already pointing to the harfbuzz directory so it's missing the header:

[snip]
The following warnings were emitted during compilation:

warning: tectonic_xetex_layout@0.2.4: In file included from layout/xetex-XeTeXFontInst.cpp:42:
warning: tectonic_xetex_layout@0.2.4: layout/tectonic_xetex_layout.h:42:10: fatal error: 'harfbuzz/hb.h' file not found
warning: tectonic_xetex_layout@0.2.4: #include <harfbuzz/hb.h>
warning: tectonic_xetex_layout@0.2.4:          ^~~~~~~~~~~~~~~
warning: tectonic_xetex_layout@0.2.4: 1 error generated.

error: failed to run custom build command for `tectonic_xetex_layout v0.2.4`

I was about to start mucking around with CFLAGS but figured there might be some deeper issue I'm missing, at least with regard to getting the vendored version building properly when the Tectonic is a dependency.

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

1 participant