i wonder if it makes any difference. need to try it out.
in this repo here, they link `sdl2` lower case:
https://github.com/MasterQ32/SDL.zig/blob/6a9e3768/Sdk.zig#L312
i wonder if it makes any difference. need to try it out.
builds and runs 🎉 , but it still needs ngui.addIncludePath("/usr/local/Cellar/sdl2/2.24.0/include");.
I also tried with ngui.addIncludePath("/usr/local/include/SDL2"); instead but that also errors
> in this repo here, they link `sdl2` lower case:
> https://github.com/MasterQ32/SDL.zig/blob/6a9e3768/Sdk.zig#L312
>
> i wonder if it makes any difference. need to try it out.
```diff
+ // ngui.addLibraryPath("/usr/local/Cellar/sdl2/2.24.0/lib");
+ ngui.linkSystemLibrary("sdl2");
```
builds and runs 🎉 , but it still needs `ngui.addIncludePath("/usr/local/Cellar/sdl2/2.24.0/include");`.
I also tried with `ngui.addIncludePath("/usr/local/include/SDL2");` instead but that also errors
if you revert to how it all was before, without the extra addIncludePath and addLibraryPath, could you post the whole output here? i forgot what the actual error was.
what do brew --prefix sdl2 and ls $(brew --prefix sdl2) show?
is there anything in /usr/local/include or ls /usr/local/lib?
hey, a couple questions:
- if you revert to how it all was before, without the extra `addIncludePath` and `addLibraryPath`, could you post the whole output here? i forgot what the actual error was.
- what do `brew --prefix sdl2` and `ls $(brew --prefix sdl2)` show?
- is there anything in `/usr/local/include` or `ls /usr/local/lib`?
yeah, brew --prefix sdl2 looks good. i suspect something's fishy going on in the homebrew install.
what do you see when which pkg-config? it should print /opt/homebrew/bin/pkg-config or similar, where homebrew is installed. if it's different, you should probably overwrite it, so that homebrew's pkg-config comes first in the path.
when zig build with sdl2, it tries to execute something like pkg-config --libs --cflags sdl2 and i suspect this command fails. once the command works, there should be no need for the original patch with ngui.addIncludePath("/usr/local/Cellar/...").
yeah, `brew --prefix sdl2` looks good. i suspect something's fishy going on in the homebrew install.
what do you see when `which pkg-config`? it should print `/opt/homebrew/bin/pkg-config` or similar, where homebrew is installed. if it's different, you should probably overwrite it, so that homebrew's pkg-config comes first in the path.
once you find where `pkg-config` from homebrew is, try `pkg-config --list-all` - the list must include `sdl2`. found a relevan discussion in https://github.com/Homebrew/discussions/discussions/2987.
when zig build with sdl2, it tries to execute something like `pkg-config --libs --cflags sdl2` and i suspect this command fails. once the command works, there should be no need for the original patch with `ngui.addIncludePath("/usr/local/Cellar/...")`.
and assumes it isn't if the command fails, which it does in your case.
the path /usr/local/bin/pkg-config doesn't look like it's from homebrew install, at least according to https://github.com/Homebrew/discussions/discussions/2987. and you might also have two different SDL2 libs installed, one from homebrew and the other possibly from macports?
i would suggest you do this:
brew install pkg-config
add /opt/homebrew/bin, or whichever is the path where homebrew installs binaries in your system, to the PATH
try again pkg-config --list-all
if the above all works, try zig build without any patch - it should work!
> zsh: segmentation fault pkg-config --list-all
aha, i think we found the problem. zig runs that command to find out whether a library is installed here: https://github.com/ziglang/zig/blob/295451df/lib/std/build.zig#L1286
and assumes it isn't if the command fails, which it does in your case.
the path `/usr/local/bin/pkg-config` doesn't look like it's from homebrew install, at least according to https://github.com/Homebrew/discussions/discussions/2987. and you might also have two different SDL2 libs installed, one from homebrew and the other possibly from macports?
i would suggest you do this:
1. `brew install pkg-config`
2. add `/opt/homebrew/bin`, or whichever is the path where homebrew installs binaries in your system, to the `PATH`
3. try again `pkg-config --list-all`
4. if the above all works, try `zig build` without any patch - it should work!
it builds with
with zig 0.10.0-dev
doesn't build on macosto macos build 2 years agoin this repo here, they link
sdl2
lower case:https://github.com/MasterQ32/SDL.zig/blob/6a9e3768/Sdk.zig#L312
i wonder if it makes any difference. need to try it out.
builds and runs 🎉 , but it still needs
ngui.addIncludePath("/usr/local/Cellar/sdl2/2.24.0/include");
.I also tried with
ngui.addIncludePath("/usr/local/include/SDL2");
instead but that also errorshey, a couple questions:
addIncludePath
andaddLibraryPath
, could you post the whole output here? i forgot what the actual error was.brew --prefix sdl2
andls $(brew --prefix sdl2)
show?/usr/local/include
orls /usr/local/lib
?with
7226c31dfb
(replaced my /Users path so it is a bit shorter)that's probably it:
There is
SDL2
in/usr/local/include
and
ls /usr/local/lib
yeah,
brew --prefix sdl2
looks good. i suspect something's fishy going on in the homebrew install.what do you see when
which pkg-config
? it should print/opt/homebrew/bin/pkg-config
or similar, where homebrew is installed. if it's different, you should probably overwrite it, so that homebrew's pkg-config comes first in the path.once you find where
pkg-config
from homebrew is, trypkg-config --list-all
- the list must includesdl2
. found a relevan discussion in https://github.com/Homebrew/discussions/discussions/2987.when zig build with sdl2, it tries to execute something like
pkg-config --libs --cflags sdl2
and i suspect this command fails. once the command works, there should be no need for the original patch withngui.addIncludePath("/usr/local/Cellar/...")
.also with bash
but
aha, i think we found the problem. zig runs that command to find out whether a library is installed here: https://github.com/ziglang/zig/blob/295451df/lib/std/build.zig#L1286
and assumes it isn't if the command fails, which it does in your case.
the path
/usr/local/bin/pkg-config
doesn't look like it's from homebrew install, at least according to https://github.com/Homebrew/discussions/discussions/2987. and you might also have two different SDL2 libs installed, one from homebrew and the other possibly from macports?i would suggest you do this:
brew install pkg-config
/opt/homebrew/bin
, or whichever is the path where homebrew installs binaries in your system, to thePATH
pkg-config --list-all
zig build
without any patch - it should work!turned out that there was a conflict with highway (an ffmpeg dep), everything works after
brew uninstall highway
.