# Fixing GCC/Homebrew building issues on macOS?

**URL:** <https://discourse.julialang.org/t/fixing-gcc-homebrew-building-issues-on-macos/12584>\
**Category:** General Usage\
**Created:** [July 22, 2018, 2:45pm UTC](https://discourse.julialang.org/t/fixing-gcc-homebrew-building-issues-on-macos/12584 "2018-07-22T14:45:41Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonathanBieler](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jonathanBieler](https://discourse.julialang.org/u/jonathanBieler)\
**Post date:** [July 22, 2018, 2:45pm UTC](https://discourse.julialang.org/t/fixing-gcc-homebrew-building-issues-on-macos/12584/1 "2018-07-22T14:45:41Z")

</div>

**Context:** A lot of packages that have binary dependencies on macOS use Homebrew to install them. A few months ago there was some changes that caused Homebrew to build GCC from sources instead of just downloading it. Building GCC from scratch take hours (and all your CPUs) and since a lot of packages are affected by this it’s a serious issue (specially with 1.0 coming).

As I understand the [Homebrew devs](https://github.com/Homebrew/homebrew-core/issues/27751#issuecomment-406840522) don’t have time to deal with this so we need to fix the issue ourselves and make a PR. I would give it a try but I don’t really understand what the issue is.

Does anybody here that is familliar with Homebrew can give us some hints, and hopefully we can fix this somehow ?

---

<div class="post-metadata">

**Author:** ![djsegal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/djsegal/32/13752_2.png) [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Post date:** [July 22, 2018, 4:27pm UTC](https://discourse.julialang.org/t/fixing-gcc-homebrew-building-issues-on-macos/12584/2 "2018-07-22T16:27:33Z")

</div>

is this at all related to:

> [@Anyone know status of HDF5 build problems?](https://discourse.julialang.org/t/anyone-know-status-of-hdf5-build-problems/12575/2):
>
> Just got this working about the same time you posted this. I think the thing that got me closest to the solution was doing: brew install hdf5 in the terminal. And then Pkg.build("HDF5") in the REPL but stuff like this is always hard to remember how to solve? I think doing stuff like: brew doctor brew update and softwareupdate --install -a also helped. Good luck! @andreasnoack @denizyuret, are those things you did to get JLD working on macs?

---

<div class="post-metadata">

**Author:** ![jonathanBieler](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jonathanBieler](https://discourse.julialang.org/u/jonathanBieler)\
**Post date:** [July 23, 2018, 9:40am UTC](https://discourse.julialang.org/t/fixing-gcc-homebrew-building-issues-on-macos/12584/3 "2018-07-23T09:40:40Z")

</div>

Maybe I overestimate the issue, I don’t know if other packages beside hdf5 depends on gcc (I haven’t found a way to check this with homebrew).

If HDF5.jl is the only packages suffering from this a solution might be to switch to `BinaryProvider.jl` for distributing the binaries and avoid problem altogether.

---

<div class="post-metadata">

**Author:** ![andreasnoack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andreasnoack/32/27_2.png) [@andreasnoack](https://discourse.julialang.org/u/andreasnoack)\
**Post date:** [July 30, 2018, 9:40am UTC](https://discourse.julialang.org/t/fixing-gcc-homebrew-building-issues-on-macos/12584/4 "2018-07-30T09:40:10Z")

</div>

Using BinaryBuilder/Provider would be a good solution but I’m not sure what to do with MPI. Do people generally need a HDF5 build that works with MPI or can the default be non-parallel? If people need an MPI linked HDF5 they might have HDF5 on their system already which BinaryProvider might be able to detect. Is that the case @staticfloat?

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [July 30, 2018, 9:56am UTC](https://discourse.julialang.org/t/fixing-gcc-homebrew-building-issues-on-macos/12584/5 "2018-07-30T09:56:16Z")

</div>

> If people need an MPI linked HDF5 they might have HDF5 on their system already which BinaryProvider might be able to detect

Pretty sure that’s against the core philosophy of BinaryProvider + BinaryBuilder.

But there should be no problem in adapting the build script to do this.

Just have something like:

```Julia
path = detect_system_hdf5()
if path != nothing && check_version(path) && check_mpi(path)
    write_deps(path)
    exit()
end

```

Maybe a `write_deps(library_path)` could be part of BinaryProvider, to make this a bit more smooth 😉

---

<div class="post-metadata">

**Author:** ![andreasnoack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andreasnoack/32/27_2.png) [@andreasnoack](https://discourse.julialang.org/u/andreasnoack)\
**Post date:** [July 30, 2018, 10:01am UTC](https://discourse.julialang.org/t/fixing-gcc-homebrew-building-issues-on-macos/12584/6 "2018-07-30T10:01:54Z")

</div>

I think having some standardized functionality for this would be useful. It doesn’t seem ideal that each package has custom code to handle these cases.

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [July 30, 2018, 10:11am UTC](https://discourse.julialang.org/t/fixing-gcc-homebrew-building-issues-on-macos/12584/7 "2018-07-30T10:11:23Z")

</div>

Well, if we have the `write_deps` in BinaryProvider, that’s probably all we can ask for.  
`Base.Libdl.find_library` is the closest a library can offer to help finding a system library, and `check_version` is highly library specific! 😉

It could be bundled in one function, but I’m not sure how that should be integrated into BinaryProvider’s work flow.

---

<div class="post-metadata">

**Author:** ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Post date:** [July 30, 2018, 4:36pm UTC](https://discourse.julialang.org/t/fixing-gcc-homebrew-building-issues-on-macos/12584/8 "2018-07-30T16:36:37Z")

</div>

Not sure it is related but installing `Cairo` and `Makie` is quite troublesome now on macOS.

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [July 30, 2018, 4:50pm UTC](https://discourse.julialang.org/t/fixing-gcc-homebrew-building-issues-on-macos/12584/9 "2018-07-30T16:50:44Z")

</div>

I hope mostly Cairo? That’s kind of unrelated, but hopefully soon fixed in some way by [https://github.com/JuliaGraphics/Cairo.jl/pull/229](https://github.com/JuliaGraphics/Cairo.jl/pull/229)!

---

<div class="post-metadata">

**Author:** ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Post date:** [July 30, 2018, 5:00pm UTC](https://discourse.julialang.org/t/fixing-gcc-homebrew-building-issues-on-macos/12584/10 "2018-07-30T17:00:29Z")

</div>

You are right. I cant get `Cairo.jl` to work on osx.

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [July 30, 2018, 5:05pm UTC](https://discourse.julialang.org/t/fixing-gcc-homebrew-building-issues-on-macos/12584/11 "2018-07-30T17:05:39Z")

</div>

Cairo is being very awkward on both v0.6 and v0.7 at the moment. In [https://github.com/JuliaGraphics/Cairo.jl/issues/230](https://github.com/JuliaGraphics/Cairo.jl/issues/230) you might find a temporary workround.
