Skip to content

PyROOT macro compilation fails on macOS due to libffi-trampolines.dylib linking restriction #272324

@diegobaronm

Description

@diegobaronm

brew config AND brew doctor output OR brew gist-logs <formula> link

brew doctor:

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  icu4c@77

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libcvmfs_cache.2.12.0.dylib
  /usr/local/lib/libcvmfs_client.2.12.0.dylib
  /usr/local/lib/libcvmfs_crypto.2.12.0.dylib
  /usr/local/lib/libcvmfs_crypto_debug.2.12.0.dylib
  /usr/local/lib/libcvmfs_fuse.2.12.0.dylib
  /usr/local/lib/libcvmfs_fuse_debug.2.12.0.dylib
  /usr/local/lib/libcvmfs_fuse_stub.2.12.0.dylib
  /usr/local/lib/libcvmfs_util.2.12.0.dylib
  /usr/local/lib/libcvmfs_util_debug.2.12.0.dylib

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae and may need to be deleted.

Unexpected header files:
  /usr/local/include/libcvmfs.h
  /usr/local/include/libcvmfs_cache.h

brew config:

HOMEBREW_VERSION: 5.1.0
ORIGIN: https://github.com/Homebrew/brew
HEAD: 4135badeddc3899aa2e89d3ea1caee320c55d299
Last commit: 3 days ago
Branch: stable
Core tap JSON: 14 Mar 19:42 UTC
Core cask tap JSON: 14 Mar 19:42 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.QgQccCRKRl/org.xquartz:0
HOMEBREW_DOWNLOAD_CONCURRENCY: 20
HOMEBREW_FORBID_PACKAGES_FROM_PATHS: set
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 4.0.1 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/4.0.1/bin/ruby
CPU: deca-core 64-bit arm_blizzard_avalanche
Clang: 17.0.0 build 1700
Git: 2.50.1 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 26.3.1-arm64
CLT: 26.3.0.0.1.1771626560
Xcode: 26.3
Metal Toolchain: N/A
Rosetta 2: false

Verification

  • My brew doctor output says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.
  • I searched for recent similar issues at https://github.com/Homebrew/homebrew-core/issues?q=is%3Aissue and found no duplicates.
  • My issue is not about a failure to build a formula from source.

What were you trying to do (and why)?

I am trying to use PyROOT from the ROOT homebrew installation.
This has been also flagged to the ROOT developers here

Thanks in advance!

What happened (include all command output)?

I get the following linker error:

Info in <TMacOSXSystem::ACLiC>: creating shared library /Users/user/Downloads/./test_cpp.so
ld: cannot link directly with 'libffi-trampolines.dylib' because product being built is not an allowed client of it
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
Error in <ACLiC>: Executing 'cd "/Users/user/Downloads" ; clang++ -fPIC -c -O3 -DNDEBUG -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -m64 -pipe -W -Woverloaded-virtual -fsigned-char -fsized-deallocation -fno-common -Qunused-arguments -pthread -stdlib=libc++ -std=c++17  -I/opt/homebrew/Cellar/root/6.38.04/include/root -isysroot "/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk" -I"/opt/homebrew/Cellar/root/6.38.04/etc/root" -I"/opt/homebrew/Cellar/root/6.38.04/etc/root/cling" -I"/opt/homebrew/Cellar/root/6.38.04/etc/root/cling/plugins/include" -I"/opt/homebrew/Cellar/root/6.38.04/include/root" -I"/opt/homebrew/include" -I"/opt/homebrew/opt/python@3.14/Frameworks/Python.framework/Versions/3.14/include/python3.14"   -D__ACLIC__ "/Users/user/Downloads/test_cpp_ACLiC_dict.cxx" ; clang++ -O3 -DNDEBUG "/Users/user/Downloads/test_cpp_ACLiC_dict.o" -dynamiclib -Wl,-w -Wl,-undefined,dynamic_lookup -Wl,-headerpad_max_install_names -m64 -Wl,-dead_strip_dylibs -Wl,-rpath,/opt/homebrew/Cellar/root/6.38.04/lib/root   "/opt/homebrew/Cellar/python@3.14/3.14.3_1/Frameworks/Python.framework/Versions/3.14/Python" "/usr/lib/libffi-trampolines.dylib" "/opt/homebrew/Cellar/root/6.38.04/lib/root/cppyy/libcppyy.so" "/opt/homebrew/Cellar/root/6.38.04/lib/root/libCPyCppyy.so" "/opt/homebrew/Cellar/root/6.38.04/lib/root/libCore.so" "/opt/homebrew/Cellar/pcre2/10.47_1/lib/libpcre2-8.0.dylib" "/opt/homebrew/Cellar/xz/5.8.2/lib/liblzma.5.dylib" "/opt/homebrew/Cellar/xxhash/0.8.3/lib/libxxhash.0.8.3.dylib" "/opt/homebrew/Cellar/lz4/1.10.0/lib/liblz4.1.10.0.dylib" "/opt/homebrew/Cellar/zstd/1.5.7_1/lib/libzstd.1.5.7.dylib" "/opt/homebrew/Cellar/root/6.38.04/lib/root/libRIO.so" "/opt/homebrew/Cellar/root/6.38.04/lib/root/libThread.so" "/opt/homebrew/Cellar/root/6.38.04/lib/root/libCling.so" "/opt/homebrew/Cellar/root/6.38.04/lib/root/ROOT/libROOTPythonizations.so" "/opt/homebrew/Cellar/root/6.38.04/lib/root/libTree.so" "/opt/homebrew/Cellar/root/6.38.04/lib/root/libImt.so" "/opt/homebrew/Cellar/root/6.38.04/lib/root/libNet.so" "/opt/homebrew/Cellar/root/6.38.04/lib/root/libMultiProc.so" "/opt/homebrew/Cellar/tbb/2022.3.0/lib/libtbb.12.17.dylib" "/opt/homebrew/Cellar/openssl@3/3.6.1/lib/libssl.3.dylib" "/opt/homebrew/Cellar/openssl@3/3.6.1/lib/libcrypto.3.dylib" "/opt/homebrew/Cellar/tbb/2022.3.0/lib/libtbbmalloc.2.17.dylib" -o "/Users/user/Downloads/./test_cpp.so"' failed!

What did you expect to happen?

Just normal compilation. I noticed that if I do:

export DYLD_LIBRARY_PATH=/opt/homebrew/opt/libffi/lib:$DYLD_LIBRARY_PATH

the problem goes away.

Step-by-step reproduction instructions (by running brew commands)

# Install ROOT with brew

brew install root

# Create a test macro to compile using PyROOT
Name the file `test.cpp`

#include <iostream>
void test() {
    std::cout << "hello" << std::endl;
}

# Use Python / PyROOT to compile

python3
import ROOT
ROOT.gROOT.ProcessLine(".L test_macro.C+")

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstream issueAn upstream issue report is needed

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions