Closed carlocab closed 3 years ago
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
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.
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.
Wait a minute... the problem appears to be -lc
is missing which should only be called on Linux, not macOS.
I see. Well, for some reason, it is being called on Big Sur but not on earlier versions of macOS.
You can’t add -lc in the macOS big sur version.
I don't even see where -lc
is being added either.
You can’t add -lc in the macOS big sur version.
Noted. I didn't add it.
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.
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?
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
Thing is the patch would be inside of this repo itself. Just to fix that github changed there default macOS version.
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.
Great, thanks. Let me try and see if that commit will apply.
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
Yeah i almost suspected that because it’s a merge and there where other changes.
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.
I've opened a PR to backport the patch to work until the next version of odin
is released. That should solve the problem.
Thanks, @Rylan12!
Context
odin version
output:Expected Behavior
brew test odin
should succeed.Current Behavior
brew test odin
produces the following error:See https://github.com/Homebrew/homebrew-core/pull/65223#issuecomment-733654271 for details.
Failure Information (for bugs)
Steps to Reproduce
Run the following commands in a terminal.
brew install odin
brew test odin
Failure Logs
test.01.odin.log