Skip to content

Cannot build rustc on systems that use musl libc #28667

Closed
@leo-unglaub

Description

@leo-unglaub

Hey,
currently it's not possible to build rustc on Alpine Linux because it is based on musl libc. The main problem is that your shipped LLVM version does not contain the patches needed to compile on musl libc.

/tmp/rustc-beta/src/llvm/lib/Support/DynamicLibrary.cpp: In static member function 'static void* llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(const char*)':
/tmp/rustc-beta/src/llvm/lib/Support/DynamicLibrary.cpp:148:21: error: invalid conversion from 'const void*' to 'void*' [-fpermissive]
     EXPLICIT_SYMBOL(stderr);
                     ^
/tmp/rustc-beta/src/llvm/lib/Support/DynamicLibrary.cpp:141:43: note: in definition of macro 'EXPLICIT_SYMBOL'
    if (!strcmp(symbolName, #SYM)) return &SYM
                                           ^
/tmp/rustc-beta/src/llvm/lib/Support/DynamicLibrary.cpp:149:21: error: invalid conversion from 'const void*' to 'void*' [-fpermissive]
     EXPLICIT_SYMBOL(stdout);
                     ^
/tmp/rustc-beta/src/llvm/lib/Support/DynamicLibrary.cpp:141:43: note: in definition of macro 'EXPLICIT_SYMBOL'
    if (!strcmp(symbolName, #SYM)) return &SYM
                                           ^
/tmp/rustc-beta/src/llvm/lib/Support/DynamicLibrary.cpp:150:21: error: invalid conversion from 'const void*' to 'void*' [-fpermissive]
     EXPLICIT_SYMBOL(stdin);
                     ^
/tmp/rustc-beta/src/llvm/lib/Support/DynamicLibrary.cpp:141:43: note: in definition of macro 'EXPLICIT_SYMBOL'
    if (!strcmp(symbolName, #SYM)) return &SYM

The following patches are needed for LLVM to build on Alpine Linux: http://git.alpinelinux.org/cgit/aports/tree/main/llvm?id=HEAD

Sadly it is not possible to use the system LLVM version, because Alpine Linux does not ship FileCheck. So that makes it impossible to use ./configure --llvm-root

Thanks and greetings
Leo

### Tasks

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions