numba / llvmlite

A lightweight LLVM python binding for writing JIT compilers
https://llvmlite.pydata.org/
BSD 2-Clause "Simplified" License
1.94k stars 322 forks source link

Symbol not found when building on arm64 platform macOSX #1030

Open CoreJa opened 10 months ago

CoreJa commented 10 months ago

Reporting a bug

I'm building llvmlite==0.39.1(Python3.7) on MacOS 14(arm64 platform). I checked latest released version because this is the latest version available. I had to use Python3.7 to maintain an old project, which depends on numba.

Anyway, I made sure that llvm@11 is installed(via brew install llvm@11), with llvm-config in PATH. I also configured LDFLAGS and CPPFLAGS as env variables.

which llvm-config
/opt/homebrew/opt/llvm@11/bin/llvm-config

echo $LDFLAGS        
-L/opt/homebrew/opt/llvm@11/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++

echo $CPPFLAGS 
-I/opt/homebrew/opt/llvm@11/include

I'm using this line to install it, within virtualenv from Python3.7.

LLVM_CONFIG=$(which llvm-config) pip install llvmlite

This is what's going on.

Collecting llvmlite
  Downloading llvmlite-0.39.1.tar.gz (132 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 132.8/132.8 kB 1.1 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: llvmlite
  Building wheel for llvmlite (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [23 lines of output]
      running bdist_wheel
      /Users/ruic/Projects/venv_3.7/bin/python /private/var/folders/c4/9xg90tkd4sd6xdp3cpwfl68w0000gp/T/pip-install-vweqj8vt/llvmlite_42426bfaadb24029ac52633c1e267a9d/ffi/build.py
      LLVM version... MACOSX_DEPLOYMENT_TARGET=14.2 clang++ -std=c++11 -stdlib=libc++ -dynamiclib -I/opt/homebrew/Cellar/llvm@11/11.1.0_4/include -std=c++14 -stdlib=libc++ -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-rtti -g assembly.cpp bitcode.cpp core.cpp initfini.cpp module.cpp value.cpp executionengine.cpp transforms.cpp passmanagers.cpp targets.cpp dylib.cpp linker.cpp object_file.cpp custom_passes.cpp -o libllvmlite.dylib -L/opt/homebrew/opt/llvm@11/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++ "-Wl,-exported_symbol,_LLVMPY_*" -L/opt/homebrew/Cellar/llvm@11/11.1.0_4/lib -Wl,-search_paths_first -Wl,-headerpad_max_install_names -lLLVMXRay -lLLVMWindowsManifest -lLLVMTableGen -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMOrcJIT -lLLVMOrcError -lLLVMJITLink -lLLVMObjectYAML -lLLVMMCA -lLLVMLTO -lLLVMObjCARCOpts -lLLVMExtensions -lPolly -lPollyISL -lLLVMPasses -lLLVMCoroutines -lLLVMLineEditor -lLLVMLibDriver -lLLVMInterpreter -lLLVMFuzzMutate -lLLVMMCJIT -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMDWARFLinker -lLLVMDlltoolDriver -lLLVMOption -lLLVMDebugInfoGSYM -lLLVMCoverage -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMX86Disassembler -lLLVMX86CodeGen -lLLVMX86AsmParser -lLLVMX86Desc -lLLVMX86Info -lLLVMWebAssemblyDisassembler -lLLVMWebAssemblyCodeGen -lLLVMWebAssemblyDesc -lLLVMWebAssemblyAsmParser -lLLVMWebAssemblyInfo -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMRISCVDisassembler -lLLVMRISCVCodeGen -lLLVMRISCVAsmParser -lLLVMRISCVDesc -lLLVMRISCVUtils -lLLVMRISCVInfo -lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMMSP430Disassembler -lLLVMMSP430CodeGen -lLLVMMSP430AsmParser -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMLanaiDisassembler -lLLVMLanaiCodeGen -lLLVMLanaiAsmParser -lLLVMLanaiDesc -lLLVMLanaiInfo -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMBPFDisassembler -lLLVMBPFCodeGen -lLLVMBPFAsmParser -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMAVRDisassembler -lLLVMAVRCodeGen -lLLVMAVRAsmParser -lLLVMAVRDesc -lLLVMAVRInfo -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMUtils -lLLVMARMInfo -lLLVMAMDGPUDisassembler -lLLVMAMDGPUCodeGen -lLLVMMIRParser -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMLinker -lLLVMIRReader -lLLVMAsmParser -lLLVMFrontendOpenMP -lLLVMAMDGPUAsmParser -lLLVMAMDGPUDesc -lLLVMAMDGPUUtils -lLLVMAMDGPUInfo -lLLVMAArch64Disassembler -lLLVMMCDisassembler -lLLVMAArch64CodeGen -lLLVMCFGuard -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoDWARF -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMTextAPI -lLLVMBitReader -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader -lLLVMAArch64AsmParser -lLLVMMCParser -lLLVMAArch64Desc -lLLVMMC -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMBinaryFormat -lLLVMAArch64Utils -lLLVMAArch64Info -lLLVMSupport -lLLVMDemangle -lm -lz -lcurses -lxml2
      dyld[30251]: Symbol not found: __ZNKSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE3strEv
        Referenced from: <611B08D9-8ED8-341E-B8C7-3D646A6D4BC1> /opt/homebrew/Cellar/llvm@11/11.1.0_4/lib/libLLVM.dylib
        Expected in:     <C84AC400-FE17-31D8-BE42-AF5C773A86D8> /opt/homebrew/Cellar/llvm@11/11.1.0_4/lib/libc++.1.0.dylib
      clang-11: error: unable to execute command: Abort trap: 6
      clang-11: error: linker command failed due to signal (use -v to see invocation)
      make: *** [all] Error 254
      11.1.0

      SVML not detected
      Traceback (most recent call last):
        File "/private/var/folders/c4/9xg90tkd4sd6xdp3cpwfl68w0000gp/T/pip-install-vweqj8vt/llvmlite_42426bfaadb24029ac52633c1e267a9d/ffi/build.py", line 226, in <module>
          main()
        File "/private/var/folders/c4/9xg90tkd4sd6xdp3cpwfl68w0000gp/T/pip-install-vweqj8vt/llvmlite_42426bfaadb24029ac52633c1e267a9d/ffi/build.py", line 220, in main
          main_posix('osx', '.dylib')
        File "/private/var/folders/c4/9xg90tkd4sd6xdp3cpwfl68w0000gp/T/pip-install-vweqj8vt/llvmlite_42426bfaadb24029ac52633c1e267a9d/ffi/build.py", line 208, in main_posix
          subprocess.check_call(['make', '-f', makefile] + makeopts)
        File "/Users/ruic/.pyenv/versions/3.7.17/lib/python3.7/subprocess.py", line 363, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['make', '-f', 'Makefile.osx', '-j12']' returned non-zero exit status 2.
      error: command '/Users/ruic/Projects/venv_3.7/bin/python' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for llvmlite
  Running setup.py clean for llvmlite
Failed to build llvmlite
ERROR: Could not build wheels for llvmlite, which is required to install pyproject.toml-based projects

[notice] A new release of pip is available: 23.2.1 -> 23.3.2
[notice] To update, run: pip install --upgrade pip

From what I can tell, symbol not found should be related to compiling. But I'm really not sure what I'm missing. Please help!

gmarkall commented 9 months ago

What happens if you try the installation without additional LDFLAGS and CPPFLAGS set?