Skip to content

[Bug] undefined symbol: LLVMInitializeSPIRVTarget #7446

Closed

Description

@guliaka

🦥 Unsloth Studio Setup
────────────────────────────────────────────────────
installing isolated Node (system Node/npm left untouched)...
node v24.18.0 | npm 11.16.0 (isolated)
frontend up to date
python unsloth 2026.7.5 is up to date
python dependencies up to date
gpu AMD ROCm (gfx1201)
ROCm: /opt/rocm
hipconfig: 7.14.60850-0000000
GPU: AMD Ryzen Threadripper 9960X 24-Cores
installing prebuilt llama.cpp...
existing install detected -- validating update
llama.cpp prebuilt up to date and validated
installed release: unslothai/llama.cpp@b10079-mix-fb3d4ca (tag b10079)
whisper.cpp prebuilt up to date

Errors when loading models, tried multiple:

{"timestamp": "2026-07-25T19:48:06.477266Z", "level": "error", "event": "llama-server exited with code 127. Output (tail): 0.00.017.780 W Setting 'enable_thinking' via --chat-template-kwargs is deprecated. Use --reasoning on / --reasoning off instead.\n0.00.023.006 I cmn  common_param: common_params_print_info: verbosity = 3 (adjust with the `-lv N` CLI arg)\n0.00.023.301 W srv  llama_server: -----------------\n0.00.023.303 W srv  llama_server: CORS is set to allow all origins ('*') and no API key is set\n0.00.023.303 W srv  llama_server: this can be a security risk (cross-origin attacks)\n0.00.023.303 W srv  llama_server: more info: https://github.com/ggml-org/llama.cpp/pull/25655\n0.00.023.303 W srv  llama_server: -----------------\n0.00.024.500 I srv    load_model: loading model '/home/gt/.cache/huggingface/hub/models--unsloth--gemma-4-26B-A4B-it-GGUF/snapshots/c099eb48e663fd284577b04978a94ffccb261841/gemma-4-26B-A4B-it-UD-Q4_K_XL.gguf'\n/home/gt/.unsloth/llama.cpp/llama-server: symbol lookup error: /opt/rocm/lib/libamd_comgr.so.3: undefined symbol: LLVMInitializeSPIRVTarget, version LLVM_23.0 Full log: /home/gt/.unsloth/studio/logs/llama-server/llama-1785008885-retry-port-47325-try1.log"}
{"timestamp": "2026-07-25T19:48:06.478372Z", "level": "error", "event": "Error loading model: llama-server failed to start. Check that the GGUF file is valid and you have enough memory.", "exception": "Traceback (most recent call last):\n  File \"/home/gt/.unsloth/studio/unsloth_studio/lib/python3.13/site-packages/studio/backend/routes/inference.py\", line 4683, in _load_model_impl\n    success = await load_with_tensor_fallback(\n              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n    ...<5 lines>...\n    )\n    ^\n  File \"/home/gt/.unsloth/studio/unsloth_studio/lib/python3.13/site-packages/studio/backend/core/inference/tensor_fallback.py\", line 52, in load_with_tensor_fallback\n    success = await attempt_load(requested_tensor, extra_args)\n              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/gt/.unsloth/studio/unsloth_studio/lib/python3.13/site-packages/studio/backend/routes/inference.py\", line 4665, in _attempt_gguf_load\n    return await asyncio.to_thread(\n           ^^^^^^^^^^^^^^^^^^^^^^^^\n    ...<10 lines>...\n    )\n    ^\n  File \"/home/gt/.local/share/uv/python/cpython-3.13.14-linux-x86_64-gnu/lib/python3.13/asyncio/threads.py\", line 26, in to_thread\n    return await loop.run_in_executor(None, func_call)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/gt/.local/share/uv/python/cpython-3.13.14-linux-x86_64-gnu/lib/python3.13/concurrent/futures/thread.py\", line 59, in run\n    result = self.fn(*self.args, **self.kwargs)\n  File \"/home/gt/.unsloth/studio/unsloth_studio/lib/python3.13/site-packages/studio/backend/core/inference/llama_cpp.py\", line 1389, in wrapped\n    return load(self, *args, **kwargs)\n  File \"/home/gt/.unsloth/studio/unsloth_studio/lib/python3.13/site-packages/studio/backend/core/inference/llama_cpp.py\", line 8256, in load_model\n    raise RuntimeError(\n    ...<6 lines>...\n    )\nRuntimeError: llama-server failed to start. Check that the GGUF file is valid and you have enough memory."}



🦥 You can also ask via our Reddit page: https://reddit.com/r/unsloth/

Activity

  1. guliaka commented on Jul 26, 2026

    @guliaka
    Author

    Environment:

    • OS: Ubuntu 24.04 (Noble)                                                                                                   
    • GPU: AMD (ROCm 7.14 / amdrocm-llvm7.14)                                                                                    
    • Inference: Unsloth Studio (bundled llama.cpp / llama-server)                                                               
    • LLVM versions on system: 18, 19, 20 (Ubuntu repos) + 23 (LLVM project llvm-toolchain-noble experimental repo)              
                                                                                                                                 
    Symptom:                                                                                                                     
    On model loading, llama-server exits immediately with code 127. The error log shows:                                               
                                                                                                                                 
      symbol lookup error: /opt/rocm/lib/libamd_comgr.so.3: undefined symbol: LLVMInitializeSPIRVTarget, version LLVM_23.0       
                                                                                                                                 
    Unsloth Studio reports: RuntimeError: llama-server failed to start. Check that the GGUF file is valid and you have enough    
    memory.                                                                                                                      
                                                                                                                                 
    Root Cause:                                                                                                                  
    The ROCm package libamd_comgr.so.3 depends on libLLVM.so.23.0git. The correct version of this library exists in ROCm's       
    bundled path (/opt/rocm/lib/llvm/lib/libLLVM.so.23.0git) and exports the required                                            
    LLVMInitializeSPIRVTarget@@LLVM_23.0 symbol.                                                                                 
                                                                                                                                 
    However, the LLVM build process for llama.cpp copies/bundles LLVM artifacts into the build directory:                        
                                                                                                                                 
    • ~/.unsloth/llama.cpp/build/bin/libLLVM.so.23.0git                                                                          
    • ~/.unsloth/whisper.cpp/build/bin/libLLVM.so.23.0git                                                                        
                                                                                                                                 
    These build artifacts are incomplete (missing the SPIRV target symbol). The dynamic linker resolves libLLVM.so.23.0git       
    from the build/bin directory instead of ROCm's correct bundled version, causing the symbol lookup to fail at runtime.        
                                                                                                                                 
    Resolution / Workaround:                                                                                                     
    Remove the broken LLVM build artifacts so the linker falls through to ROCm's correct bundled library:                        
                                                                                                                                 
      ─ bash                                                                                                                     
      rm -f ~/.unsloth/llama.cpp/build/bin/libLLVM.so* ~/.unsloth/whisper.cpp/build/bin/libLLVM.so.23.0git                       
                                                                                                                                 
    Restart llama-server / Unsloth Studio after removal.                                                                         
                                                                                                                                 
    Recommendation for Unsloth Studio:                                                                                           
                                                                                                                                 
    1. Do not bundle/inject libLLVM.so.* files into the build/bin directory unless they are complete, runtime-verified copies    
    that match the host system's ROCm LLVM requirements.                                                                         
    2. Add an LD_LIBRARY_PATH or rpath fallback in the launcher that prioritizes /opt/rocm/lib/llvm/lib for libLLVM.so.23.0git   
    and libclang-cpp.so.23.0git.                                                                                                 
    3. Pre-warm/startup script should clean up stale build/bin LLVM symlinks to prevent boot-time crashes on AMD systems. 
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions