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

LDView on macOS not loading - missing/Incompatible libraries #57

Closed
trevorsandy opened this issue May 1, 2018 · 4 comments
Closed

LDView on macOS not loading - missing/Incompatible libraries #57

trevorsandy opened this issue May 1, 2018 · 4 comments
Assignees
Milestone

Comments

@trevorsandy
Copy link
Owner

trevorsandy commented May 1, 2018

Subject of the issue

LDView does not load on macOS

Error log: "dyld: Library not loaded: /usr/local/opt/libpng/lib/libpng16.16.dylib
Referenced from: /Applications/LPub3D.app/Contents/3rdParty/ldview-4.3/bin/LDView
Reason: Incompatible library version: LDView requires version 51.0.0 or later, but libpng16.16.dylib provides version 33.0.0"... but I have no idea on How to solve this!!

Your environment

  • Version of LPub3D - version 2.2.2
  • Operating system - macOS

Workaround

Install missing libraries:

Required LPub3D libraries on macOS

LDView:

  • XQuartz (OSMesa)
    https://www.xquartz.org
    /opt/X11/lib/libOSMesa.8.dylib (compatibility version 9.0.0, current version 9.0.0)
    /opt/X11/lib/libGLU.1.dylib (compatibility version 5.0.0, current version 5.1.0)

  • LibPNG version 1.6.35 or above
    http://www.libpng.org
    /usr/local/opt/libpng/lib/libpng16.16.dylib (compatibility version 52.0.0, current version 52.0.0)

  • GL2PS version 1.3.5 or above
    http://geuz.org/gl2ps
    /usr/local/opt/gl2ps/lib/libgl2ps.1.dylib (compatibility version 1.0.0, current version 1.4.0)

  • LibJPEG version 1.4 or above
    http://www.ijg.org
    /usr/local/opt/jpeg/lib/libjpeg.9.dylib (compatibility version 13.0.0, current version 13.0.0)

  • TinyXML version 2.5.2 or above
    http://www.grinninglizard.com/tinyxml/
    /usr/local/opt/tinyxml/lib/libtinyxml.dylib (compatibility version 0.0.0, current version 0.0.0)

  • MiniZIP version 1.1.0 or above
    http://www.winimage.com/zLibDll/minizip.html

POVRay:

  • XQuartz (X11)
  /opt/X11/lib/libXpm.4.dylib (compatibility version 16.0.0, current version 16.0.0)
  /opt/X11/lib/libSM.6.dylib (compatibility version 7.0.0, current version 7.1.0)
  /opt/X11/lib/libICE.6.dylib (compatibility version 10.0.0, current version 10.0.0)
  /opt/X11/lib/libX11.6.dylib (compatibility version 10.0.0, current version 10.0.0)
   /usr/local/opt/openexr/lib/libIlmImf-2_2.22.dylib (compatibility version 23.0.0, current version 23.0.0)
   /usr/local/opt/ilmbase/lib/libImath-2_2.23.dylib (compatibility version 24.0.0, current version 24.0.0)
   /usr/local/opt/ilmbase/lib/libHalf.23.dylib (compatibility version 24.0.0, current version 24.0.0)
   /usr/local/opt/ilmbase/lib/libIex-2_2.23.dylib (compatibility version 24.0.0, current version 24.0.0)
   /usr/local/opt/ilmbase/lib/libIexMath-2_2.23.dylib (compatibility version 24.0.0, current version 24.0.0)
   /usr/local/opt/ilmbase/lib/libIlmThread-2_2.23.dylib (compatibility version 24.0.0, current version 24.0.0)
  • SDL version 2.0.2 or above (used for the display preview)
    http://www.libsdl.org
    /usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib (compatibility version 10.0.0, current version 10.0.0)

Install brew (if not already installed)

  • $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install libraries

  • $ brew update
  • $ brew reinstall libpng
  • $ brew install tinyxml gl2ps libjpeg minizip openexr sdl2 libtiff

Check installed libraries - particularly libPNG as version 52.0.0 is required

  • $ otool -L $(brew list libpng | grep dylib$)
    /usr/local/Cellar/libpng/1.6.35/lib/libpng.dylib:
    /usr/local/opt/libpng/lib/libpng16.16.dylib (compatibility version 52.0.0, current version 52.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0)

Treating “dyld image not found” return

-See the steps from this excellent post: Fixing dyld image not found on Mac OS.

Solution

Within LPub3D, inform the user when renderer library dependencies are not satisfied.

@trevorsandy trevorsandy added this to the v2.2.3 milestone May 1, 2018
@trevorsandy trevorsandy self-assigned this May 1, 2018
@trevorsandy
Copy link
Owner Author

On macOS, the POVRay and LDView library dependencies are checked on startup. If any of the required libraries are missing, a flag indicating such is written to the plist.

A library check is performed at startup if the plist settings indicates there are missing renderer libraries. If the setting returns false for missing libraries, no check is performed; therefore, once the missing libraries are installed, no further checks are performed.

@trevorsandy
Copy link
Owner Author

trevorsandy commented Sep 5, 2018

It looks like we have a bit of "cat and mouse" here. Apparently, since the last update of this ticket and the release of v2.3.0, the homebrew libpng version has incremented from 51.0.0 to 52.0.0 and consequently on Travis CI where the production instance of LPub3D is built. As a result, the library dependency check as currently designed (check if library exist) is pretty much useless.

screenshot 2018-08-03 09 21 57

As such, the LDView renderer will not launch for LPub3D v2.3.0 on macOS unless the libpng version is 1.6.35, You can confirm this behaviour by navigating to LDView within the LPub3D application bundle and clicking the executable to launch it. Upon doing this, you should receive this console output:

Your-Mac:~ yourlogin$ /Applications/LPub3D.app/Contents/3rdParty/ldview-4.3/bin/ldview ; exit;
dyld: Library not loaded: /usr/local/opt/libpng/lib/libpng16.16.dylib
  Referenced from: /Applications/LPub3D.app/Contents/3rdParty/ldview-4.3/bin/ldview
  Reason: Incompatible library version: ldview requires version 52.0.0 or later, but libpng16.16.dylib provides version 51.0.0
Abort trap: 6
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
Deleting expired sessions...15 completed.

[Process completed]

To correct this behaviour, if not already updated, follow the Current Solution section below to update your instance of libpng on macOS.

Taking this scenario into account, it looks like I'll have to do 2 things to ensure this behaviour is put to bed for good.

First, specify the precise, and sufficiently backwards looking, version of libpng to be installed when building the Travis-CI environment and make that version of libpng the source of the LPub3D startup check.

Second, it will not be enough to simply check if the libpng file exist but also interrogate the version information.

Current Solution - until items above are implemented:

Install brew (if not already installed)

  • $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Reinstall libpng

  • $ brew update
  • $ brew reinstall libpng

Check installed libraries - particularly libPNG as version 52.0.0 is required for LPub3D v2.3.0

  • $ otool -L $(brew list libpng | grep dylib$)
    /usr/local/Cellar/libpng/1.6.35/lib/libpng.dylib:
    /usr/local/opt/libpng/lib/libpng16.16.dylib (compatibility version 52.0.0, current version 52.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0)

@trevorsandy trevorsandy modified the milestones: v2.3.0, v2.3.1 Sep 5, 2018
@trevorsandy trevorsandy changed the title LDView on macOS not loading - missing libraries LDView on macOS not loading - missing/Incompatible libraries Sep 7, 2018
@trevorsandy
Copy link
Owner Author

Closed for 2.3.1.

Will restore for later release when I decide to implement the automated notification defined above.

@trevorsandy
Copy link
Owner Author

trevorsandy commented Dec 6, 2018

Update for v2.3.4.

Add automatic library check on application load. Update required library versions.

Cheers,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant