Skip to content

[Feature]: Nightly release with statically-linked and/or rocm-prefix'd libLLVM20Β #1543

@wsmoses

Description

@wsmoses

Suggestion Description

Many projects also use LLVM, causing issues if linkinag against/dlopeining comgr, which itself uses libLLVM20.

At least for my use cases, the fact XLA has its own LLVM hits an issue when the dlopen init for comgrs LLVM is initialized.

ideally LLVM is built with a relevant rocm suffix (like below)
# set a SONAME suffix for FreeBSD JuliaLang/julia#32462
CMAKE_FLAGS+=(-DLLVM_VERSION_SUFFIX:STRING="rocm")
# Aggressively symbol version (added in LLVM 13.0.1)
CMAKE_FLAGS+=(-DLLVM_SHLIB_SYMBOL_VERSION:STRING="ROCM_LLVM_${LLVM_MAJ_VER}.${LLVM_MIN_VER}")

Also nice would be statically linking in libLLVM into comgr

#include <dlfcn.h>
int main() {
  # XLA build built against theRock, specifically: https://github.com/ROCm/TheRock/releases/download/nightly-tarball/therock-dist-linux-gfx110X-dgpu-7.0.0rc20250714.tar.gz
  dlopen("lib/libReactantExtra.so", RTLD_LAZY | RTLD_DEEPBIND);
}
Program received signal SIGSEGV, Segmentation fault.                                                                                                                                                                  
0x00007fffbd4a8ae3 in _GLOBAL__sub_I_ELFObjectFile.cpp () from /mnt3/wmoses/git/Yggdrasil/R/Reactant/re2/lib/llvm/lib/libLLVM.so.20.0git                                                                              
(gdb) bt                                                                                                                                                                                                              
#0  0x00007fffbd4a8ae3 in _GLOBAL__sub_I_ELFObjectFile.cpp () from /mnt3/wmoses/git/Yggdrasil/R/Reactant/re2/lib/llvm/lib/libLLVM.so.20.0git                                                                          
#1  0x00007ffff7fca71f in call_init (l=<optimized out>, argc=argc@entry=1, argv=argv@entry=0x7fffffffe058, env=env@entry=0x7fffffffe068) at ./elf/dl-init.c:74                                                        
#2  0x00007ffff7fca824 in call_init (env=<optimized out>, argv=<optimized out>, argc=<optimized out>, l=<optimized out>) at ./elf/dl-init.c:120                                                                       
#3  _dl_init (main_map=0x5555555592c0, argc=1, argv=0x7fffffffe058, env=0x7fffffffe068) at ./elf/dl-init.c:121                                                                                                        
#4  0x00007ffff7fc65b2 in __GI__dl_catch_exception (exception=exception@entry=0x0, operate=operate@entry=0x7ffff7fd1cc0 <call_dl_init>, args=args@entry=0x7fffffffda80) at ./elf/dl-catch.c:211                       
#5  0x00007ffff7fd1d7c in dl_open_worker (a=0x7fffffffdc30) at ./elf/dl-open.c:829                                                                                                                                    
#6  dl_open_worker (a=a@entry=0x7fffffffdc30) at ./elf/dl-open.c:792                                                                                                                                                  
#7  0x00007ffff7fc651c in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffdc10, operate=operate@entry=0x7ffff7fd1ce0 <dl_open_worker>, args=args@entry=0x7fffffffdc30) at ./elf/dl-catch.c:237          
#8  0x00007ffff7fd2164 in _dl_open (file=0x555555556004 "lib/libReactantExtra.so", mode=<optimized out>, caller_dlopen=0x555555555165 <main+28>, nsid=<optimized out>, argc=1, argv=0x7fffffffe058,                   
    env=0x7fffffffe068) at ./elf/dl-open.c:905                                                                                                                                                                        
#9  0x00007ffff7c981a4 in dlopen_doit (a=a@entry=0x7fffffffdee0) at ./dlfcn/dlopen.c:56                                                                                                                               
#10 0x00007ffff7fc651c in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffde20, operate=0x7ffff7c98140 <dlopen_doit>, args=0x7fffffffdee0) at ./elf/dl-catch.c:237                                      
#11 0x00007ffff7fc6669 in _dl_catch_error (objname=0x7fffffffde88, errstring=0x7fffffffde90, mallocedp=0x7fffffffde87, operate=<optimized out>, args=<optimized out>) at ./elf/dl-catch.c:256                         
#12 0x00007ffff7c97c83 in _dlerror_run (operate=operate@entry=0x7ffff7c98140 <dlopen_doit>, args=args@entry=0x7fffffffdee0) at ./dlfcn/dlerror.c:138                                                                  
#13 0x00007ffff7c9825f in dlopen_implementation (dl_caller=<optimized out>, mode=<optimized out>, file=<optimized out>) at ./dlfcn/dlopen.c:71                                                                        
#14 ___dlopen (file=<optimized out>, mode=<optimized out>) at ./dlfcn/dlopen.c:81                                                                                                                                     
#15 0x0000555555555165 in main ()                                                                                                                                                                                     
(gdb) disassemble                                                                                                   

cc @ftynse @giordano

Operating System

Ubuntu

GPU

No response

ROCm Component

Comgr

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    TODO

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions