Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build rustc on systems that use musl libc #28667

Closed
leo-unglaub opened this Issue Sep 25, 2015 · 11 comments

Comments

Projects
None yet
6 participants
@leo-unglaub
Copy link

leo-unglaub commented Sep 25, 2015

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

@steveklabnik steveklabnik added the A-LLVM label Sep 25, 2015

@nagisa

This comment has been minimized.

Copy link
Contributor

nagisa commented Sep 25, 2015

We have instructions for building a musl-enabled rustc distribution.

AFAIR we require gnu libc for an otherwise standard build.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Sep 26, 2015

Could the patches for LLVM be merged upstream perhaps? That way we'd just pick up compatibility automatically!

@leo-unglaub

This comment has been minimized.

Copy link
Author

leo-unglaub commented Sep 28, 2015

@alexcrichton I think they could be merged with upstream. But i actually would prefer it to use the existing LLVM installation instead of rebuilding LLVM over and over again during the rustc build. Why/What do you need FileCheck for? Is it really needed?

@nagisa i have looked at the docs, but i am unable to compile rustc do to the error message i posted above.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Sep 28, 2015

Currently FileCheck is used to run some codegen tests that we have. Did you install LLVM via a package manager? I've found in ubuntu at least that llvm-tools gave binaries like FileCheck which may be useful?

@nagisa

This comment has been minimized.

Copy link
Contributor

nagisa commented Sep 28, 2015

You cannot rely on FileCheck being installed by the distribution. It also could pretty much be made optional IMO.

@leo-unglaub

This comment has been minimized.

Copy link
Author

leo-unglaub commented Sep 29, 2015

@alexcrichton i looked at all files distributed by Alpine Linux. There is no FileCheck available. I checked other distros as well and not all of then provide that file. Maybe this could be replaced with something more generic?

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Sep 29, 2015

Perhaps! It's not super critical that we run our codegen tests in all configurations (we have very few codegen tests right now) so it'd probably just make more sense to have a --disable-codegen-tests configure switch or something like that in which case we wouldn't look for FileCheck

@leo-unglaub

This comment has been minimized.

Copy link
Author

leo-unglaub commented Oct 6, 2015

So what would be the next steps to get this issue fixed so that Rust then runs on Alpine Linux?

@foutrelis

This comment has been minimized.

Copy link

foutrelis commented Dec 24, 2015

This was reported to us on Arch Linux, asking to ship FileCheck so Rust can be built using the system LLVM. [1] Upstream LLVM seems to believe FileCheck is only used for running LLVM tests. [2]

FileCheck used to be installed by the autotools build system but we have now switched to CMake which is the recommended way to build LLVM these days.

I will comment on the LLVM bug report that Rust uses it for some of its tests; either LLVM needs to install FileCheck for CMake builds or Rust to make it optional.

[1] https://bugs.archlinux.org/task/47510
[2] https://llvm.org/bugs/show_bug.cgi?id=25675

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jan 10, 2016

FileCheck isn't critical to our test suite, I'd be fine doing something like:

  • Add a ./configure option to skip running these tests (but they're still run by default)
  • Skip these tests automatically if a system LLVM is used
@JoshStrobl

This comment has been minimized.

Copy link

JoshStrobl commented Jan 19, 2016

Stuck with the same issue currently as well.

Solus doesn't ship llvm utils given we don't use the autotools system and with no way to skip the tests, I'm currently stuck delivering the Rust binaries as opposed to building the Rust source and cargo separately (which I'd prefer to do).

Given LLVM being such a bigger part of the system toolchain and thus making it a bit more of a PITA to update to newer versions, a ./configure option in Rust certainly seems like the most optimal short-term solution.

alexcrichton added a commit to alexcrichton/rust that referenced this issue Mar 10, 2016

mk: Add configure option for disabling codegen tests
Our `codegen` test suite requires the LLVM `FileCheck` utility but unfortunately
this isn't always available in all custom LLVM roots (e.g. those specified via
`--llvm-root`). This commit adds a `./configure` option called
`--disable-codegen-tests` which will manually disable running these tests. In
the case that this option is passed we can forgo the need for the `FileCheck`
executable. Note that we still require `FileCheck` by default as we will attempt
to run these tests.

Closes rust-lang#28667

alexcrichton added a commit to alexcrichton/rust that referenced this issue Mar 18, 2016

mk: Add configure option for disabling codegen tests
Our `codegen` test suite requires the LLVM `FileCheck` utility but unfortunately
this isn't always available in all custom LLVM roots (e.g. those specified via
`--llvm-root`). This commit adds a `./configure` option called
`--disable-codegen-tests` which will manually disable running these tests. In
the case that this option is passed we can forgo the need for the `FileCheck`
executable. Note that we still require `FileCheck` by default as we will attempt
to run these tests.

Closes rust-lang#28667

bors added a commit that referenced this issue Apr 2, 2016

Auto merge of #32168 - alexcrichton:fix-filecheck, r=aturon
mk: Add configure option for disabling codegen tests

Our `codegen` test suite requires the LLVM `FileCheck` utility but unfortunately
this isn't always available in all custom LLVM roots (e.g. those specified via
`--llvm-root`). This commit adds a `./configure` option called
`--disable-codegen-tests` which will manually disable running these tests. In
the case that this option is passed we can forgo the need for the `FileCheck`
executable. Note that we still require `FileCheck` by default as we will attempt
to run these tests.

Closes #28667

bors added a commit that referenced this issue Apr 3, 2016

Auto merge of #32168 - alexcrichton:fix-filecheck, r=aturon
mk: Add configure option for disabling codegen tests

Our `codegen` test suite requires the LLVM `FileCheck` utility but unfortunately
this isn't always available in all custom LLVM roots (e.g. those specified via
`--llvm-root`). This commit adds a `./configure` option called
`--disable-codegen-tests` which will manually disable running these tests. In
the case that this option is passed we can forgo the need for the `FileCheck`
executable. Note that we still require `FileCheck` by default as we will attempt
to run these tests.

Closes #28667

alexcrichton added a commit to alexcrichton/rust that referenced this issue Apr 3, 2016

mk: Add configure option for disabling codegen tests
Our `codegen` test suite requires the LLVM `FileCheck` utility but unfortunately
this isn't always available in all custom LLVM roots (e.g. those specified via
`--llvm-root`). This commit adds a `./configure` option called
`--disable-codegen-tests` which will manually disable running these tests. In
the case that this option is passed we can forgo the need for the `FileCheck`
executable. Note that we still require `FileCheck` by default as we will attempt
to run these tests.

Closes rust-lang#28667

bors added a commit that referenced this issue Apr 3, 2016

Auto merge of #32168 - alexcrichton:fix-filecheck, r=aturon
mk: Add configure option for disabling codegen tests

Our `codegen` test suite requires the LLVM `FileCheck` utility but unfortunately
this isn't always available in all custom LLVM roots (e.g. those specified via
`--llvm-root`). This commit adds a `./configure` option called
`--disable-codegen-tests` which will manually disable running these tests. In
the case that this option is passed we can forgo the need for the `FileCheck`
executable. Note that we still require `FileCheck` by default as we will attempt
to run these tests.

Closes #28667

@bors bors closed this in #32168 Apr 3, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.