pola-rs/r-polars

bug(release-lib): __fprintf_chk (glibc fortification symbol) present in `aarch64-unknown-linux-musl` binary

Open

#1,760 opened on Mar 21, 2026

View on GitHub
 (2 comments) (0 reactions) (0 assignees)R (39 forks)github user discovery
bugcihelp wanted

Repository metrics

Stars
 (562 stars)
PR merge metrics
 (PR metrics pending)

Description

The static library provided for the current 1.7.0 release candidate does not work correctly and as one would expect on alpine and also other musl environments.

It looks like this is a misconfiguration and consequence of an inconsistent setup on r-polars build side.

https://github.com/pola-rs/r-polars/blob/ef3c6d752f4a80e59f1fd2a841c67a4a853e3681/.github/workflows/release-lib.yml#L80

Since GCC is set as C compiler and _FORTIFY_SOURCE=2, the jemalloc memory allocator's C source is also compiled with GNU GCC (via cargo and jemalloc-sys -> build.rs) which is by default only intended for glibc targets. Here it is not only for the linker.

__fprintf_chk symbol emitted is not available for musl environments.

I made a workaround with LD_PRELOAD, but this is very unclean and better fixed upstream here :)

steps:
  'Check package':
    image: <myorgs-forgejo-container-registry-derived-from-alpine:3.22-image>
    pull: true
    environment:
      GITHUB_PAT:
        from_secret: GITHUB_PAT
      RCMDCHECK_NUM_COLORS: 300
      PKG_SYSREQS_PLATFORM: alpine
      PKG_SYSREQS: TRUE
      PKG_SYSREQS_VERBOSE: TRUE
      RENV_CONFIG_REPOS_OVERRIDE: https://<myorgs-cran-mirror>/arm64/alpine322/latest
      NOT_CRAN: 'true'
      LIBR_POLARS_BUILD: 'false'

    commands:
      - apk add --no-cache -q gcompat rust cargo
      - |
        mkdir -p ~/.R
        LD_PRELOAD=/lib/libgcompat.so.0 R -q -e '
          options(Ncpus = 4)
          options(repos = c(
            RMultiverse = "https://community.r-multiverse.org",
            CRAN = Sys.getenv("RENV_CONFIG_REPOS_OVERRIDE")
          ))
          renv::restore()
          rcmdcheck::rcmdcheck(
            args = c("--no-manual"),
            error_on = "warning"
          )
Error: Error installing package 'polars':
==================================

* installing *source* package ‘polars’ ...
** this is package ‘polars’ version ‘1.7.0’
- Installing polars ...                         FAILED
** using staged installation
--------------------- [ENVIRONMENT VARIABLES] ---------------------
TARGET = ''
PROFILE = 'release'
FEATURES = ''
NOT_CRAN = 'true'
LIBR_POLARS_BUILD = 'false'
-------------------------------------------------------------------
---------------------- [MOLD LINKER DISABLED] ----------------------
'mold' not found in PATH. Continuing without mold.
--------------------------------------------------------------------
---------------- [TRY TO DOWNLOAD PRE-BUILT BINARY] ----------------
The library was not found at </tmp/RtmpIiMgfm/renv-git-e6d71cf8e/tools/libr_polars.a>.
Trying to download pre-built binary from the Internet...
--------------------------------------------------------------------
Found pre-built binary at <[https://github.com/pola-rs/r-polars/releases/download/lib-v1.7.0-rc.3/libr_polars-1.7.0-rc.3-aarch64-unknown-linux-musl.tar.gz>.](https://github.com/pola-rs/r-polars/releases/download/lib-v1.7.0-rc.3/libr_polars-1.7.0-rc.3-aarch64-unknown-linux-musl.tar.gz%3E.)
Downloading...
Checking SHA256 for </tmp/RtmpBfcldA/fileb453799e84e.tar.gz>...
SHA256 matches for </tmp/RtmpBfcldA/fileb453799e84e.tar.gz>.
Extracted pre-built binary to </tmp/RtmpIiMgfm/renv-git-e6d71cf8e/tools> directory.
Done!
---------------------- [LIBRARY BINARY FOUND] ----------------------
The library was found at </tmp/RtmpIiMgfm/renv-git-e6d71cf8e/tools/libr_polars.a>. No need to build it.

Note: rustc version: rustc 1.87.0 (17067e9ac 2025-05-09) (Alpine Linux 1.87.0-r0)
--------------------------------------------------------------------
** libs
using C compiler: ‘gcc (Alpine 14.2.0) 14.2.0’
gcc -std=gnu23 -I"/opt/R/4.5.2/lib/R/include" -DNDEBUG   -I/usr/local/include -D__MUSL__    -fPIC  -g -O2  -D__MUSL__ -flax-vector-conversions -c init.c -o init.o
rm -f "/tmp/RtmpIiMgfm/renv-git-e6d71cf8e/src/rust/target//release/libr_polars.a"
if [ -f "/tmp/RtmpIiMgfm/renv-git-e6d71cf8e/src/../tools/libr_polars.a" ]; then \
	mkdir -p "/tmp/RtmpIiMgfm/renv-git-e6d71cf8e/src/rust/target//release" ; \
	mv "/tmp/RtmpIiMgfm/renv-git-e6d71cf8e/src/../tools/libr_polars.a" "/tmp/RtmpIiMgfm/renv-git-e6d71cf8e/src/rust/target//release/libr_polars.a" ; \
	exit 0; \
fi && \
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.cargo/bin" && \
  if [ "" != "wasm32-unknown-emscripten" ]; then \
    cargo build --lib --profile="release" --manifest-path="/tmp/RtmpIiMgfm/renv-git-e6d71cf8e/src/rust/Cargo.toml" --target-dir="/tmp/RtmpIiMgfm/renv-git-e6d71cf8e/src/rust/target" --target="" --features=""; \
  else \
    export CC="gcc -std=gnu23" && \
    export CFLAGS="-g -O2  -D__MUSL__ -flax-vector-conversions" && \
    export CARGO_PROFILE_DEV_PANIC="abort" && \
    export CARGO_PROFILE_RELEASE_PANIC="abort" && \
    export RUSTFLAGS=" -Zdefault-visibility=hidden" && \
    cargo build --lib --profile="release" --manifest-path="/tmp/RtmpIiMgfm/renv-git-e6d71cf8e/src/rust/Cargo.toml" --target-dir="/tmp/RtmpIiMgfm/renv-git-e6d71cf8e/src/rust/target" --target="" --features="" -Zbuild-std=panic_abort,std; \
  fi
gcc -std=gnu23 -shared -L/opt/R/4.5.2/lib/R/lib -L/usr/local/lib -fPIC -o polars.so init.o -L/tmp/RtmpIiMgfm/renv-git-e6d71cf8e/src/rust/target//release -lr_polars -L/opt/R/4.5.2/lib/R/lib -lR
if [ "true" != "true" ]; then \
	rm -Rf "/tmp/RtmpIiMgfm/renv-git-e6d71cf8e/src/rust/target//release/libr_polars.a" "" "" "/tmp/RtmpIiMgfm/renv-git-e6d71cf8e/src/rust/target//release/build"; \
fi
installing to /crow/src/<mydomain>/<myorg>/<mypackage>/renv/staging/1/00LOCK-renv-git-e6d71cf8e/00new/polars/libs
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘polars’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/crow/src/<mydomain>/<myorg>/<mypackage>/renv/staging/1/00LOCK-renv-git-e6d71cf8e/00new/polars/libs/polars.so':
  Error relocating /crow/src/<mydomain>/<myorg>/<mypackage>/renv/staging/1/00LOCK-renv-git-e6d71cf8e/00new/polars/libs/polars.so: __fprintf_chk: symbol not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/crow/src/<mydomain>/<myorg>/<mypackage>/renv/staging/1/polars’
install of package 'polars' failed [error code 1]
Traceback (most recent calls last):
13: renv::restore()
12: renv_restore_run_actions(project, diff, current, lockfile, rebuild)
11: renv_install_impl(records)
10: renv_install_staged(records)
 9: renv_install_default(records)
 8: handler(package, renv_install_package(record))
 7: renv_install_package(record)
 6: withCallingHandlers(renv_install_package_impl(record), error = function(e) writef("FAILED"))
 5: renv_install_package_impl(record)
 4: r_cmd_install(package, path)
 3: r_exec_error(package, output, "install", status)
 2: abort(all)
 1: stop(fallback)

Contributor guide