trevorsandy / lpub3d

An LDraw™ editor for LEGO® style digital building instructions.
https://trevorsandy.github.io/lpub3d/
136 stars 19 forks source link

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

Closed trevorsandy closed 5 years ago

trevorsandy commented 6 years ago

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

Workaround

Install missing libraries:

Required LPub3D libraries on macOS

LDView:

POVRay:

Install brew (if not already installed)

Install libraries

Check installed libraries - particularly libPNG as version 52.0.0 is required

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 commented 6 years ago

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 commented 6 years ago

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)

Reinstall libpng

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

trevorsandy commented 6 years ago

Closed for 2.3.1.

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

trevorsandy commented 5 years ago

Update for v2.3.4.

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

Cheers,