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

Fix macOS build #525

Merged
merged 8 commits into from
Jul 11, 2022
Merged

Fix macOS build #525

merged 8 commits into from
Jul 11, 2022

Conversation

thislooksfun
Copy link
Contributor

Hello!

I want to help with some bun development, but I ran into a few hurdles while setting up my dev environment. I figured I wouldn't be the only one, so I fixed up the problems I encountered (at least I think I fixed all of them, I might have forgotten a step I had to do), and am submitting them here!

I'm brand new to zig, and my Makefile is a bit rusty, so if you notice anything that could/should be done differently/better, please let me know!

Running them the other way around results in a failed build.
`test/scripts` has node packages as well. If they aren't installed, then
some of the tests fail to start.
One of the dependencies tries to run `cargo`, and will fail the build if
it can't. The `cargo` command is provided by the `rust` brew package.
This requirement applies to _all_ macOS builds, not just those on Apple
Silicon, and also had some slightly confusing wording.
This leading whitespace was making my system treat the argument as a
file with name ` -L$(LLVM_PREFIX)/lib` (leading whitespace included),
instead of as a library path argument.
The macOS instructions say to install `llvm@13`, which has a different
path than the bare `llvm` install (`brew --prefix llvm@13` != `brew
--prefix llvm`). This patch takes a slightly smarter approach:

1. If the user defined `LLVM_PREFIX` and it points to a valid path on
   disk, use that.
2. If `LLVM_PREFIX` is NOT a valid path, try setting it to the `llvm@13`
   path.
3. If it's STILL not a valid path, try the plain `llvm` path
4. If it's STILL not valid, set it to a user-friendly error.

There might be a better solution for doing this, I'm not well-versed in
Makefile syntax, but it's at least slightly better than it was before.
`std.math.cast` was changed in 0e6285c8fc31ff866df96847fe34e660da38b4a9.
It used to throw if the cast would overflow, but now it returns `null`
instead.
@thislooksfun thislooksfun changed the title Fix macos build Fix macOS build Jul 10, 2022
@addy
Copy link
Contributor

addy commented Jul 11, 2022

@thislooksfun I was also getting the futex.zig compiler errors during build.

What version of Zig did you use to compile with, and were you also getting an error in identifier_cache.zig about id_start_bitset.meta.blob being missing?

@thislooksfun
Copy link
Contributor Author

@addy I was using the latest version, 0.10.0. And yes, I did! I fixed that by running make identifier-cache before make jsc.

@Jarred-Sumner Jarred-Sumner merged commit 7199263 into oven-sh:main Jul 11, 2022
@thislooksfun thislooksfun deleted the fix-macos-build branch July 11, 2022 14:04
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

Successfully merging this pull request may close these issues.

None yet

3 participants