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

Odin fails brew test on Big Sur #792

Closed
carlocab opened this issue Nov 25, 2020 · 20 comments
Closed

Odin fails brew test on Big Sur #792

carlocab opened this issue Nov 25, 2020 · 20 comments

Comments

@carlocab
Copy link

Context

  • Operating System: macOS 11.0.1
  • Please paste odin version output:
❯ odin version
odin version 0.13.0-

Expected Behavior

brew test odin should succeed.

Current Behavior

brew test odin produces the following error:

Error: odin: failed
An exception occurred within a child process:
  Errno::ENOENT: No such file or directory - ./hellope
[snip]

See Homebrew/homebrew-core#65223 (comment) for details.

Failure Information (for bugs)

Steps to Reproduce

Run the following commands in a terminal.

  1. brew install odin
  2. brew test odin

Failure Logs

test.01.odin.log

❯ 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>'
@carlocab
Copy link
Author

For reference, brew test odin attempts to compile the following program:

package main

import "core:fmt"

main :: proc() {
    fmt.println("Hellope!");
}

Compiling this program produces this error:

❯ odin build test.odin
ld: library not found for -lc

@gingerBill
Copy link
Member

Odin requires LLVM in order to work and it appears that LLVM is not being installed alongside Odin.

I don't know who has set up the homebrew for Odin.

@carlocab
Copy link
Author

carlocab commented Nov 25, 2020

Odin declares llvm as a dependency. You don't see it installed in the snippet I shared because I already have it installed and included in my PATH.

❯ brew info odin
odin: stable 0.13.0 (bottled), HEAD
Programming language with focus on simplicity, performance and modern systems
https://odin-lang.org/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/odin.rb
License: BSD-2-Clause
==> Dependencies
Required: llvm ✔
[snip]

If you check the CI tests in the PR I linked, you'll see that brew test odin succeeds on 10.14 and 10.15.

@gingerBill
Copy link
Member

Wait a minute... the problem appears to be -lc is missing which should only be called on Linux, not macOS.

@carlocab
Copy link
Author

I see. Well, for some reason, it is being called on Big Sur but not on earlier versions of macOS.

@Platin21
Copy link
Contributor

You can’t add -lc in the macOS big sur version.

@gingerBill
Copy link
Member

I don't even see where -lc is being added either.

@carlocab
Copy link
Author

You can’t add -lc in the macOS big sur version.

Noted. I didn't add it.

@Platin21
Copy link
Contributor

Platin21 commented Nov 25, 2020

It’s bit added for macOS and the main reason is that it doesn’t work. There is no library for that anymore they moved that completely to System. So yeah should not be there and it also seems like it isn’t?

Could be that this doesn’t include the fix? Not sure will look.

@Platin21
Copy link
Contributor

Platin21 commented Nov 25, 2020

Yeah it’s not in 13.0 but in current master it is correct.
So the question is more when will be a new version released @gingerBill ?
Do we wait until we get llvm api working?

@carlocab
Copy link
Author

carlocab commented Nov 25, 2020

Homebrew can also apply a patch to 13.0 to get it working if the new version isn't going to be released soon. I don't use Odin, however, so it would help if someone here can provide one, ideally hosted on this repo.

The llvm brew formula gives examples of upstream patches that have been applied to the version packaged by Homebrew: https://github.com/Homebrew/homebrew-core/blob/deda5a05551ab74d5313af112d3bb2054f9b6af8/Formula/llvm.rb#L12-L30

@Platin21
Copy link
Contributor

Thing is the patch would be inside of this repo itself. Just to fix that github changed there default macOS version.

@carlocab
Copy link
Author

carlocab commented Nov 25, 2020

Yes, I understand that. Is there a specific commit on this repo that can be applied to 13.0?

If not, then, if the patch is small, it can be added directly in the Homebrew formula (the Ruby file that determines how Odin is installed). If it isn't, then I can submit it to Homebrew/formula-patches for hosting until the next version of Odin is released.

@Platin21
Copy link
Contributor

Should be 81398d2 i think.

@carlocab

This comment has been minimized.

@carlocab
Copy link
Author

Patch doesn't apply cleanly, sadly.

==> Patching
==> Applying 81398d21ed25ca50dcfab7b9c7135c33adbb8e34.patch
patching file src/main.cpp
Hunk #1 FAILED at 431.
Hunk #2 FAILED at 2221.
2 out of 2 hunks FAILED -- saving rejects to file src/main.cpp.rej
patching file src/main.cpp
Hunk #2 succeeded at 2100 (offset -39 lines).
patching file src/main.cpp
Hunk #1 FAILED at 435.
1 out of 1 hunk FAILED -- saving rejects to file src/main.cpp.rej
patching file src/main.cpp
Hunk #2 FAILED at 431.
Hunk #3 succeeded at 2097 (offset -39 lines).
Hunk #4 FAILED at 2181.
2 out of 4 hunks FAILED -- saving rejects to file src/main.cpp.rej
patching file src/main.cpp
Hunk #2 FAILED at 434.
Hunk #3 succeeded at 2100 (offset -39 lines).
Hunk #4 FAILED at 2187.
2 out of 4 hunks FAILED -- saving rejects to file src/main.cpp.rej
patching file src/main.cpp
Hunk #2 FAILED at 431.
Hunk #3 succeeded at 2097 (offset -39 lines).
Hunk #4 FAILED at 2182.
2 out of 4 hunks FAILED -- saving rejects to file src/main.cpp.rej

@Platin21
Copy link
Contributor

Yeah i almost suspected that because it’s a merge and there where other changes.

@carlocab
Copy link
Author

I see.

Well, if you can come up with a single patch that can work (or even a series of commits that will), I'd be happy to fix the brew formula so that it'll work.

Otherwise, I guess brew-packaged Odin may have to wait for the next release to work on Big Sur.

@Rylan12
Copy link

Rylan12 commented Dec 14, 2020

I've opened a PR to backport the patch to work until the next version of odin is released. That should solve the problem.

Homebrew/homebrew-core#66906

@carlocab
Copy link
Author

Thanks, @Rylan12!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants