Skip to content

fix(jemalloc-sys): pin --libdir to avoid distro site-script lib64 redirect - #181

Draft
rtyler wants to merge 1 commit into
tikv:mainfrom
buoyant-data:fix/lib64-libdir-mismatch
Draft

fix(jemalloc-sys): pin --libdir to avoid distro site-script lib64 redirect#181
rtyler wants to merge 1 commit into
tikv:mainfrom
buoyant-data:fix/lib64-libdir-mismatch

Conversation

@rtyler

@rtyler rtyler commented Sep 7, 2026

Copy link
Copy Markdown

This was a 🦜 generated fix to a build error that has been buggin' the heck out of me in delta-io/delta-rs when using aarch64 machines.

Some Linux distributions ship an autoconf site-script (/usr/share/site/) that silently rewrites the configured libdir from ${prefix}/lib to ${prefix}/lib64 for 64-bit hosts (e.g. the OpenSUSE aarch64 site script). jemalloc is compiled via ./configure inside the build script, so its static libraries end up in $OUT_DIR/lib64. However, build.rs hard-codes the link-search path as $OUT_DIR/lib, so cargo can't find libjemalloc_pic.a and the build fails with:

error: could not find native static library jemalloc_pic,
perhaps an -L flag is missing?

Fix: pass --libdir=${out_dir}/lib explicitly to configure. This overrides any site-script redirect and keeps the installed path consistent with the search path already emitted by build.rs.

Reproduces on: OpenSUSE Leap 16 aarch64 (site script at /usr/share/site/aarch64-unknown-linux-gnu).

…irect

Some Linux distributions ship an autoconf site-script
(/usr/share/site/<triple>) that silently rewrites the configured libdir
from `${prefix}/lib` to `${prefix}/lib64` for 64-bit hosts (e.g. the
OpenSUSE aarch64 site script).  jemalloc is compiled via `./configure`
inside the build script, so its static libraries end up in
`$OUT_DIR/lib64`.  However, build.rs hard-codes the link-search path as
`$OUT_DIR/lib`, so cargo can't find `libjemalloc_pic.a` and the build
fails with:

  error: could not find native static library `jemalloc_pic`,
         perhaps an -L flag is missing?

Fix: pass `--libdir=${out_dir}/lib` explicitly to configure.  This
overrides any site-script redirect and keeps the installed path
consistent with the search path already emitted by build.rs.

Reproduces on: OpenSUSE Leap 16 aarch64 (site script at
/usr/share/site/aarch64-unknown-linux-gnu).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: R Tyler Croy <rtyler@buoyantdata.com>
@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ti-chi-bot

ti-chi-bot Bot commented Sep 7, 2026

Copy link
Copy Markdown

Welcome @rtyler! It looks like this is your first PR to tikv/jemallocator 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant