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

llvm: add mlir #65223

Closed
wants to merge 3 commits into from
Closed

llvm: add mlir #65223

wants to merge 3 commits into from

Conversation

carlocab
Copy link
Member

@carlocab carlocab commented Nov 19, 2020

There's been some interest in the flang compiler for llvm:

Homebrew/discussions#143
#63081

It seems possible to build flang separately from llvm, but it appears to
require having built mlir. See the flang README. Aside from being a
pre-requisite for flang, mlir is a mature project with a number of
interesting applications
.

mlir, therefore, seems worthy of inclusion in the llvm formula even if
flang is currently not suitable for homebrew/core. (flang does build
and test successfully upon declaring a dependency on llvm in this PR.)

Test failure appears to be unrelated to the PR, and has been reported
upstream: odin-lang/Odin#792


  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

@BrewTestBot BrewTestBot added the python Python use is a significant feature of the PR or issue label Nov 19, 2020
@carlocab carlocab mentioned this pull request Nov 19, 2020
5 tasks
carlocab added a commit to carlocab/homebrew-core that referenced this pull request Nov 19, 2020
- [x] Have you followed the [guidelines for contributing](https://github.com/Homebrew/homebrew-core/blob/HEAD/CONTRIBUTING.md)?
- [x] Have you checked that there aren't other open [pull requests](https://github.com/Homebrew/homebrew-core/pulls) for the same formula update/change?
- [ ] Have you built your formula locally with `brew install --build-from-source <formula>`, where `<formula>` is the name of the formula you're submitting?
- [ ] Is your test running fine `brew test <formula>`, where `<formula>` is the name of the formula you're submitting?
- [ ] Does your build pass `brew audit --strict <formula>` (after doing `brew install <formula>`)?

Sets up flang as a separate formula so that llvm can be built without a
gcc dependency. See Homebrew#63081

Follow up to Homebrew#65223

`brew audit` does not like the `depends_on "llvm"`, but I don't think
this will build with just Apple Clang. flang needs to be built with
mlir.
@carlocab

This comment has been minimized.

- [x] Have you followed the [guidelines for contributing](https://github.com/Homebrew/homebrew-core/blob/HEAD/CONTRIBUTING.md)?
- [x] Have you checked that there aren't other open [pull requests](https://github.com/Homebrew/homebrew-core/pulls) for the same formula update/change?
- [ ] Have you built your formula locally with `brew install --build-from-source <formula>`, where `<formula>` is the name of the formula you're submitting?
- [ ] Is your test running fine `brew test <formula>`, where `<formula>` is the name of the formula you're submitting?
- [ ] Does your build pass `brew audit --strict <formula>` (after doing `brew install <formula>`)?

There's been some interest in the flang compiler for llvm:

Homebrew/discussions#143
Homebrew#63081

It seems possible to build flang separately from llvm, but it appears to
require having built mlir. See the flang [README](https://github.com/llvm/llvm-project/blob/master/flang/README.md).

My laptop is too sadly underpowered to build llvm. I will try to devise
a test if this is built successfully. I think I should also be able to
add a separate formula for flang if this is successful.
@carlocab

This comment has been minimized.

@carlocab carlocab marked this pull request as draft November 20, 2020 14:34
Building llvm with mlir succeeded on my local machine with a similar
procedure (except using ninja), so hopefully this works.
@carlocab carlocab marked this pull request as ready for review November 25, 2020 02:14
@carlocab
Copy link
Member Author

carlocab commented Nov 25, 2020

This is the error in the log archive:

❯ cat test.01.odin
2020-11-25 05:22:08 +0000

/usr/local/Cellar/odin/0.13.0/bin/odin
build
hellope.odin

ld: library not found for -lc
Error from the raw logs

An exception occurred within a child process:
  Errno::ENOENT: No such file or directory - ./hellope
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/odin.rb:49:in ``'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/odin.rb:49:in `block in <class:Odin>'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1872:in `block (3 levels) in run_test'
/usr/local/Homebrew/Library/Homebrew/utils.rb:500:in `with_env'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1871:in `block (2 levels) in run_test'
/usr/local/Homebrew/Library/Homebrew/formula.rb:910:in `with_logging'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1870:in `block in run_test'
/usr/local/Homebrew/Library/Homebrew/mktemp.rb:63:in `block in run'
/usr/local/Homebrew/Library/Homebrew/mktemp.rb:63:in `chdir'
/usr/local/Homebrew/Library/Homebrew/mktemp.rb:63:in `run'
/usr/local/Homebrew/Library/Homebrew/formula.rb:2114:in `mktemp'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1864:in `run_test'
/usr/local/Homebrew/Library/Homebrew/test.rb:43:in `block in <main>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:33:in `block in catch'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:108:in `timeout'
/usr/local/Homebrew/Library/Homebrew/test.rb:42:in `<main>'

This error is not related to the PR:

Testing Odin under the existing llvm formula produces what looks to be the same error.

❯ brew install odin && brew test odin
==> Downloading https://homebrew.bintray.com/bottles/odin-0.13.0.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/772509e10bf0a73af78b51e4f85309eb6d25e0078d1f2fa02bfa2d252e0055ca?respons
######################################################################## 100.0%
==> Pouring odin-0.13.0.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/odin/0.13.0: 133 files, 2.6MB
==> Testing odin
==> /usr/local/Cellar/odin/0.13.0/bin/odin version
==> /usr/local/Cellar/odin/0.13.0/bin/odin build hellope.odin
Error: odin: failed
An exception occurred within a child process:
  Errno::ENOENT: No such file or directory - ./hellope
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/odin.rb:49:in ``'
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/odin.rb:49:in `block in <class:Odin>'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1862:in `block (3 levels) in run_test'
/usr/local/Homebrew/Library/Homebrew/utils.rb:500:in `with_env'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1861:in `block (2 levels) in run_test'
/usr/local/Homebrew/Library/Homebrew/formula.rb:900:in `with_logging'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1860:in `block in run_test'
/usr/local/Homebrew/Library/Homebrew/mktemp.rb:63:in `block in run'
/usr/local/Homebrew/Library/Homebrew/mktemp.rb:63:in `chdir'
/usr/local/Homebrew/Library/Homebrew/mktemp.rb:63:in `run'
/usr/local/Homebrew/Library/Homebrew/formula.rb:2104:in `mktemp'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1854:in `run_test'
/usr/local/Homebrew/Library/Homebrew/test.rb:43:in `block in <main>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:33:in `block in catch'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:108:in `timeout'
/usr/local/Homebrew/Library/Homebrew/test.rb:42:in `<main>'

See also: #65000 (comment)

@BrewTestBot
Copy link
Member

:shipit: @fxcoudert has triggered a merge.

@fxcoudert
Copy link
Member

Not sure I understand why calling make through cmake works when calling make directly doesn't, but I don't think it can hurt. (Using ninja, on the other hand, has in the past lead to a huge increase in our binary size, so we don't want that)

@carlocab
Copy link
Member Author

Yup, I really don't get it either. Who knows what's inside llvm's build scripts...

I experimented building with Ninja too, and it's not as bad as it used to be (~3GB install), but still worse than just Make.

Thanks!

@carlocab carlocab deleted the llvm-mlir branch November 25, 2020 21:19
@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Dec 26, 2020
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Dec 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age python Python use is a significant feature of the PR or issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants