GLFW cannot find Vulkan SDK because of filtered environment variables


#1

Is there any way to disable the automatic environment variable filtering?

Unfortunately, if I try to build GLFW from source, its cmake build script looks environment variables like VULKAN_SDK in order to enable Vulkan features in the GLFW library.

I also thought about adding something like with-vulkan support to the glfw formula, but I cannot figure out how to add a depends_on to depend on a cask when working in a formula (not a cask). Any suggestions?


(Jonathan Chang) #2

env :std in your formula will disable environment filtering, but it also makes builds much more likely to fail due to the peculiarities of everyone’s personal installed and environment variables. Even though dealing with superenv can sometimes be a pain I’ve found it to be worth the trouble.

I think you’d need to specify a custom Requirement in your formula. It probably wouldn’t be accepted in Homebrew/core though since I think the official tap is avoiding adding options to formulae.


(Mike McQuaid) #3

You can set environment variables using ENV["VULKAN_SDK"] = "/foo/bar in the formula itself. This avoids users having to set it even with environment filtering disabled.

It can be disabled but we’ll never accept a change to a Homebrew/homebrew-core formula that requires it to be disabled.

As @jonchang correctly noted: we won’t accept Homebrew/homebrew-core formulae or changes that depend on casks. Again this is all pointing a bit again to the argument that building this formula from source is a better fit. If you open a half-working PR (or even less) to do so you’ll find the Homebrew/homebrew-core maintainers probably pretty willing to help you get this working (given Vulkan is a relatively prominent project at this point).

Good luck (genuinely)!


#4

Ok, I believe I undestand the ENV issue now. As an aside, one thing that is still confusing is that brew help install still shows options like —env=super which doesn’t seem to work anymore. Is that a bug? Or do docs need to be updated to remove that?

Another issue I came across with the glfw formula and its Vulkan integration is that the current stable release of glfw does not properly build with Vulkan. Something about the paths of the Vulkan SDK changed, so it broke some assumptions of glfw 3.2.1. However, that was fixed in a later commit, so right now you have to use the —HEAD option to build without errors. I think I’ll try putting an issue with the glfw github repo to ask them to tag their working vulkan commit so that there is a release to use with brew (to avoid having to download an unversioned commit).

Is it possible for a formula option to force a build from source rather than install from bottle? Currently that is what glfw requires to enable its Vulkan features.

Regarding a formula instead of cask, I put the cask out there just to make vulkan available ASAP. I’m willing to try putting a regular from source formula together, but I’d need help from those more experienced with brew. In a day or so, I’ll start a thread here to get feedback for that.

Thanks!

Andrew


(Mike McQuaid) #5

Good idea! I’d recommend opening a pull request rather than a thread; it’s much easier to discuss code than the abstract.