patriciogonzalezvivo / glslViewer

Console-based GLSL Sandbox for 2D/3D shaders
BSD 3-Clause "New" or "Revised" License
4.62k stars 350 forks source link

Library not found error on Mac OS #293

Closed ManjitBedi closed 1 year ago

ManjitBedi commented 1 year ago

Hello,

I've just downloaded & installed the project from GitHub following the Mac build instructions.

I get the following error when I run the glslviewer application:

examples % glslViewer 2D/00_tests/test.frag
dyld[1239]: Library not loaded: '/usr/local/opt/glfw3/lib/libglfw3.3.dylib'
  Referenced from: '/usr/local/bin/glslViewer'
  Reason: tried: '/usr/local/opt/glfw3/lib/libglfw3.3.dylib' (no such file), '/usr/local/lib/libglfw3.3.dylib' (no such file), '/usr/lib/libglfw3.3.dylib' (no such file)

I'm using Mac OS version 12.6. I am using a MacBook Pro with the Apple M1 chipset.

patriciogonzalezvivo commented 1 year ago

Hi! Wonder if you compiled them from source or download a pre-compiled package.

Independently from that seems to be looking for glfw which could be resolve intalling it with brew

brew install glfw

That said, installing it from source would be better.

ManjitBedi commented 1 year ago

I followed the instructions using Homebrew and compiled the various dependancies for NCurses & FFMPEG.

I also tried installing the GLFW library with homebrew as you mentioned. It is a different version number for the library from libglfw3.3.dylib.

/opt/homebrew/Cellar/glfw/3.3.8/include/GLFW/ (2 files)
/opt/homebrew/Cellar/glfw/3.3.8/lib/libglfw.3.3.dylib
/opt/homebrew/Cellar/glfw/3.3.8/lib/cmake/ (4 files)
/opt/homebrew/Cellar/glfw/3.3.8/lib/pkgconfig/glfw3.pc
/opt/homebrew/Cellar/glfw/3.3.8/lib/ (2 other files)

Is this relevant the 'opt' directory being used on the M1 Mac over using 'usr'?

patriciogonzalezvivo commented 1 year ago

You mean you install glslViewer using homebrew? instead of compiling by source:

brew install glslviewer

About your question, the /opt/homebrew over /usr/local it's a per system option. If you have one will potentially not work with the other. My concern is that the main use vera which provides their own version of glfw but seems something is off and I'm trying to figure what could had happened there.

If you used brew install glslviewer do you mind giving a chance to the compiling by source way?:

ManjitBedi commented 1 year ago

Hi, I first did the install by compiling from the GitHub repo. That did not work for me.

ManjitBedi commented 1 year ago

I think I have it working now; I needed to delete the binary in the '/usr/' path and then reinstalled it with Homebrew to the ' /opt/homebrew/bin/glslviewer' path.

patriciogonzalezvivo commented 1 year ago

That’s great news! Question:

On Oct 13, 2022, at 5:38 PM, Manjit Bedi @.***> wrote:

 I think I have it working now; I needed to delete the binary in the '/usr/' path and then reinstalled it with Homebrew to the ' /opt/homebrew/bin/glslviewer' path.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

ManjitBedi commented 1 year ago

Hi Patricio,

The version is: /opt/homebrew/Cellar/glslviewer/2.1.2_1 (146 files, 48MB)

I don't recall seeing any compile errors with the source from GitHub but there was a warning installing ncurses with Homebrew.

ncurses is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have ncurses first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/ncurses/bin:$PATH"' >> ~/.zshrc

For compilers to find ncurses you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/ncurses/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/ncurses/include"

For pkg-config to find ncurses you may need to set:
  export PKG_CONFIG_PATH="/opt/homebrew/opt/ncurses/lib/pkgconfig"
patriciogonzalezvivo commented 1 year ago

Heads up you are running an older version, that we will use on this Tuesday workshop. If you don't mind uninstalling the brew version and giving another go to following this instructions to compile it from this repository would be great

Ps: probably you need to run those lines about ncurses to compile glslViewer w ncurses support