[FIX] qAnimation plugin crash OSX

For any question about plugins!
Post Reply
Bruzzlee
Posts: 3
Joined: Thu Jan 25, 2018 2:40 pm

[FIX] qAnimation plugin crash OSX

Post by Bruzzlee »

Hi everyone
I want to share my fix for the qAnimation plugin crash OSX which is described in the those topics:
http://www.danielgm.net/cc/forum/viewto ... tion#p7628
http://www.danielgm.net/cc/forum/viewto ... tion#p8504
http://www.danielgm.net/cc/forum/viewto ... tion#p9065

The last few hours I've investigated that crash and found out that the ffmpeg libraries caused the problem. I replaced the necessary libraries with newer versions an now it worked!

FFMPEG Library source: HOMEBREW ( brew install ffmpeg ) on 25.01.2018
libversion.png
libversion.png (25.29 KiB) Viewed 13143 times
Simply copy an replace the files from CC_ffmpeg_57_osx.zip to /Applications/CloudCompare.app/Contents/Frameworks
Files: http://ul.to/nx4zw7yx
Working libraries used on OSX Sierra 10.12.6 with CloudCompare 2.9.1

(Don't switch between windows during rendering. In my case it will result in an error)

Cheers Bruzzlee
asmaloney
Posts: 38
Joined: Tue Feb 19, 2013 9:53 pm
Location: Canada
Contact:

Re: [FIX] qAnimation plugin crash OSX

Post by asmaloney »

Thanks Bruzzlee.

This will only work until you change/modify/update/move the homebrew ffmpeg libs on your machine.

All of those dylibs have hard-coded paths to the homebrew-installed versions. So you'll get the one in the homebrew install, not the one right next to it.

For example, on my machine, homebrew's libavcodec.57.107.100.dylib includes paths to:

Code: Select all

/Users/maloney/dev/Cellar/ffmpeg/3.4.1/lib/libswresample.2.dylib
/Users/maloney/dev/Cellar/ffmpeg/3.4.1/lib/libavutil.2.dylib
So once those files are moved or changed, you'll crash again.

To create a distributable application, all these paths must be changed to be relative to where they are installed. So in the example, they will become:

Code: Select all

@executable_path/../Frameworks/libswresample.2.dylib
@executable_path/../Frameworks/libavutil.2.dylib
Because CC includes so many libs it's easy to miss things and - since I only have dev machines - I won't see the problem immediately. I do have a script to do this and then I go through and manually check all the paths since I know this is an issue.

I've checked what I released w/2.9.1 and I don't yet see the problem, but I'll let you know if I find it.
asmaloney
Posts: 38
Joined: Tue Feb 19, 2013 9:53 pm
Location: Canada
Contact:

Re: [FIX] qAnimation plugin crash OSX

Post by asmaloney »

Bruzzlee:

I can't reproduce a crash with the animation plugin in 2.9.1.

I tried it on a machine with homebrew installed in a different path and it works fine for me.

Can you please try the unmodified 2.9.1 again and tell me what the crash report says? It is easier for me to track if you can report it as a GitHub issue.

Thanks.
Bruzzlee
Posts: 3
Joined: Thu Jan 25, 2018 2:40 pm

Re: [FIX] qAnimation plugin crash OSX

Post by Bruzzlee »

First of all: Thanks for your effort to provide CC for OSX!

Report done:
https://github.com/CloudCompare/CloudCompare/issues/643

I did not do that in the first place as I thought it is not a CloudCompare problem itself.

Cheers Bruzzlee
Bruzzlee
Posts: 3
Joined: Thu Jan 25, 2018 2:40 pm

Re: [FIX] qAnimation plugin crash OSX

Post by Bruzzlee »

asmaloney wrote:Thanks Bruzzlee.

This will only work until you change/modify/update/move the homebrew ffmpeg libs on your machine.

All of those dylibs have hard-coded paths to the homebrew-installed versions. So you'll get the one in the homebrew install, not the one right next to it.

For example, on my machine, homebrew's libavcodec.57.107.100.dylib includes paths to:

Code: Select all

/Users/maloney/dev/Cellar/ffmpeg/3.4.1/lib/libswresample.2.dylib
/Users/maloney/dev/Cellar/ffmpeg/3.4.1/lib/libavutil.2.dylib
So once those files are moved or changed, you'll crash again.

To create a distributable application, all these paths must be changed to be relative to where they are installed. So in the example, they will become:

Code: Select all

@executable_path/../Frameworks/libswresample.2.dylib
@executable_path/../Frameworks/libavutil.2.dylib
Because CC includes so many libs it's easy to miss things and - since I only have dev machines - I won't see the problem immediately. I do have a script to do this and then I go through and manually check all the paths since I know this is an issue.

I've checked what I released w/2.9.1 and I don't yet see the problem, but I'll let you know if I find it.
I've checked my .dylib's - you are right. There are some hard coded paths:
In my case:
/usr/local/opt/ffmpeg/lib/
/usr/local/Cellar/ffmpeg/3.4.1/lib/

In the original libraries I found this
--prefix=/Users/maloney/dev/Cellar/ffmpeg/3.4
in every library. But as you wrote that you tested it with a different path I don't think that is causing the problem.
asmaloney
Posts: 38
Joined: Tue Feb 19, 2013 9:53 pm
Location: Canada
Contact:

Re: [FIX] qAnimation plugin crash OSX

Post by asmaloney »

In the original libraries I found this
--prefix=/Users/maloney/dev/Cellar/ffmpeg/3.4
in every library.
Yeah - that's fine. That's just a text string storing the compile options used when building it. They do not affect the load paths.

For way too much info about the libs, you can play with 'otool'. For example:

Code: Select all

otool -L libavcodec.57.dylib
will show the load paths we care about - in this case:

Code: Select all

	@executable_path/../Frameworks/libavcodec.57.dylib (compatibility version 57.0.0, current version 57.107.100)
	@executable_path/../Frameworks/libswresample.2.dylib (compatibility version 2.0.0, current version 2.9.100)
	@executable_path/../Frameworks/libavutil.55.dylib (compatibility version 55.0.0, current version 55.78.100)
	...
If any non-system hard-coded paths show up there, then we'll have a problem when distributing the application.

For way WAY too much info:

Code: Select all

otool -l libavcodec.57.dylib
will give you all the load commands and RPATH-related stuff.
TheOrdinaryMan
Posts: 5
Joined: Mon May 14, 2018 5:23 pm

Re: [FIX] qAnimation plugin crash OSX

Post by TheOrdinaryMan »

Hey,

Is there any progress towards an update or fix for this problem? I'm on High Sierra, I tried replacing the framework files with the ones in the OP but all that did was completely remove the qAnimation plugin button from the CloudCompare window.
asmaloney
Posts: 38
Joined: Tue Feb 19, 2013 9:53 pm
Location: Canada
Contact:

Re: [FIX] qAnimation plugin crash OSX

Post by asmaloney »

@TheOrdinaryMan:

I was never able to reproduce this crash with the CloudCompare 2.9.1 release on macOS 10.12.

Would you please create an issue on GitHub with the details of the error you're seeing?
TheOrdinaryMan
Posts: 5
Joined: Mon May 14, 2018 5:23 pm

Re: [FIX] qAnimation plugin crash OSX

Post by TheOrdinaryMan »

Not much here that wasn't already stated in the other topics, but here you go:

https://github.com/CloudCompare/CloudCo ... -329214102
Post Reply