libGL issue when running visualization apps on OSX

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

libGL issue when running visualization apps on OSX

ASpeers
Hello,

I am trying to get PCL up and running on OSX Lion and have been running into some difficulties.  I first attempted to install everything via binaries and ran into the problem described here. but wasn't able to resolve the issue in the same manner (simply uninstalling and reinstalling libusb-dev).  I then attempted to compile PCL-1.3.1 from source and seemed to have no issues during the compilation of the main source (or any applications).  When I try to run any "visualization" based app (including something like pcd_viewer) I get the following error:

Andrews-MacBook-Pro:tools Andrew$ ./pcd_viewer
dyld: Library not loaded: /opt/local/lib/libGL.1.dylib
  Referenced from: /opt/local/lib/vtk-5.6/libvtkWidgets.5.6.dylib
  Reason: image not found
Trace/BPT trap: 5

If I search for the library in question I get the following versions:

/Developer/SDKs/MacOSX10.6.sdk/usr/X11/lib/libGL.1.dylib
/Developer/SDKs/MacOSX10.7.sdk/usr/X11/lib/libGL.1.dylib
/Developer-old/SDKs/MacOSX10.4u.sdk/usr/X11R6/lib/libGL.1.dylib
/Developer-old/SDKs/MacOSX10.5.sdk/usr/X11/lib/libGL.1.dylib
/Developer-old/SDKs/MacOSX10.6.sdk/usr/X11/lib/libGL.1.dylib
/usr/X11/lib/libGL.1.dylib

I have attempted to add some of these paths to my DYLD_LIBRARY_PATH and get different errors depending on what directory I add.  For example, if I try to use the libGL.1.dylib located in /usr/X11/lib I get

Andrews-MacBook-Pro:tools Andrew$ ./pcd_viewer dyld: Symbol not found: __cg_png_create_info_struct  Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /usr/X11/lib/libPng.dylib
 in /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
Trace/BPT trap: 5

If I try to use any of the /Developer/.... paths I get an error as follows:

Andrews-MacBook-Pro:tools Andrew$ ./pcd_viewer dyld: Library not loaded: /opt/local/lib/libGL.1.dylib
  Referenced from: /opt/local/lib/vtk-5.6/libvtkWidgets.5.6.dylib
  Reason: no suitable image found.  Did find:
        /Developer/SDKs/MacOSX10.7.sdk/usr/X11/lib//libGL.1.dylib: mach-o, but wrong filetype
Trace/BPT trap: 5

I have scoured the internet attempting to find a solution and I was wondering if any of you might have come across this issue before or have any ideas that I could try.  Getting this to work on my native operating system instead of having to keep a Ubuntu VM for my PCL development would be a great help.

Thanks in advance!
Regards,
Andrew
Reply | Threaded
Open this post in threaded view
|

Re: libGL issue when running visualization apps on OSX

Kevin Matzen
I ended up installing the mesa port from MacPorts.
Reply | Threaded
Open this post in threaded view
|

Re: libGL issue when running visualization apps on OSX

ASpeers
Looks like it worked.  Thanks for the amazing save Kevin :-)!

The fix:
'sudo port install mesa'
Then recompile any demos/personal code.

Just incase someone else has the same issue sometime in the future.

Andrew
Reply | Threaded
Open this post in threaded view
|

Re: libGL issue when running visualization apps on OSX

Radu B. Rusu
Administrator
Andrew, Kevin,

Thanks! What's the best place on our website to put this information on?

Cheers,
Radu.
--
http://pointclouds.org

On 12/09/2011 03:42 PM, ASpeers wrote:

> Looks like it worked.  Thanks for the amazing save Kevin :-)!
>
> The fix:
> 'sudo port install mesa'
> Then recompile any demos/personal code.
>
> Just incase someone else has the same issue sometime in the future.
>
> Andrew
>
> --
> View this message in context: http://www.pcl-users.org/libGL-issue-when-running-visualization-apps-on-OSX-tp3574302p3574425.html
> Sent from the Point Cloud Library (PCL) Users mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: libGL issue when running visualization apps on OSX

ASpeers
Hi Radu,

If it were me, I would add it to the compiling from source instructions here.  Maybe add a FAQ / common installation issues subsection (as judging from the lack of info I found when searching for my issue I would assume it to be a rather rare occurrence).  Also, I'm not sure if a packaged version of the mesa port would be needed for the 'installation from binaries' option on OSX.  I had issues using the binaries so I went to compiling from source and manually installing the other ports but that may have helped.

Thanks again for the help!  I spent the rest of the night half enjoying my new working PCL install and half kicking myself for not posting on the boards earlier :-).

Regards,
Andrew
Reply | Threaded
Open this post in threaded view
|

Re: libGL issue when running visualization apps on OSX

Radu B. Rusu
Administrator
Hi Andrew,


On 12/09/2011 08:01 PM, ASpeers wrote:

> Hi Radu,
>
> If it were me, I would add it to the compiling from source instructions
> http://pointclouds.org/downloads/source.html here .  Maybe add a FAQ /
> common installation issues subsection (as judging from the lack of info I
> found when searching for my issue I would assume it to be a rather rare
> occurrence).  Also, I'm not sure if a packaged version of the mesa port
> would be needed for the 'installation from binaries' option on OSX.  I had
> issues using the binaries so I went to compiling from source and manually
> installing the other ports but that may have helped.

Good suggestion! I didn't know precisely where to best put it, so I added a section called "Troubleshooting" when
compiling from source at http://www.pointclouds.org/downloads/source.html. Someone with better organizational skills
could move it around, make it more prominent somewhere else on the web page, etc.


> Thanks again for the help!  I spent the rest of the night half enjoying my
> new working PCL install and half kicking myself for not posting on the
> boards earlier :-).

[You're welcome.] I know how that feels :)

Cheers,
Radu.
--
http://pointclouds.org
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: libGL issue when running visualization apps on OSX

Kevin Matzen
I think the issue in the original post stems from libpng being out of sync in MacPorts than the rest of the world.  libpng cites a portability issue in that the 1.5.x API broke backwards compatibility with the 1.4.x API.  And MacPorts has libpng 1.4.8.  Apple builds ImageIO.framework with libpng 1.5.2.

So, I'm not sure if this is correct or not, but after extracting the pkg, it looks like these weren't built with all of the necessary dependencies included.  For example, the X11 variant (I'm guessing this variant was used since X11 starts up when I use the visualization tools) of vtk-devel depends on mesa.  You can build the dependencies with
sudo port mpkg port_name
rather than
sudo port pkg port_name
which will only package up the specified port itself.

Or at least tell people which ports to install as dependencies.  I'm not sure why the MacPorts installers don't just ask if you want to resolve the dependencies automatically.

Actually, I'm not really sure, which of these ports were forked by PCL and which could be obtained directly from MacPorts as-is?  libusb is the big one, right?  Everyone seems to be using their own fork of this.
Reply | Threaded
Open this post in threaded view
|

Re: libGL issue when running visualization apps on OSX

Radu B. Rusu
Administrator
Kevin,

None of the ports (and thus the binary DMGs provided on http://www.pointclouds.org/downloads/macosx.html have been
forked. All are original Mac ports (see http://dev.pointclouds.org/projects/pcl/wiki/How_to_create_DMG_installers for
information on how we created them).

Cheers,
Radu.
--
http://pointclouds.org

On 12/11/2011 09:40 AM, Kevin Matzen wrote:

> I think the issue in the original post stems from libpng being out of sync in
> MacPorts than the rest of the world.  libpng cites a portability issue in
> that the 1.5.x API broke backwards compatibility with the 1.4.x API.  And
> MacPorts has libpng 1.4.8.  Apple builds ImageIO.framework with libpng
> 1.5.2.
>
> So, I'm not sure if this is correct or not, but after extracting the pkg, it
> looks like these weren't built with all of the necessary dependencies
> included.  For example, the X11 variant (I'm guessing this variant was used
> since X11 starts up when I use the visualization tools) of vtk-devel depends
> on mesa.  You can build the dependencies with
> sudo port mpkg port_name
> rather than
> sudo port pkg port_name
> which will only package up the specified port itself.
>
> Or at least tell people which ports to install as dependencies.  I'm not
> sure why the MacPorts installers don't just ask if you want to resolve the
> dependencies automatically.
>
> Actually, I'm not really sure, which of these ports were forked by PCL and
> which could be obtained directly from MacPorts as-is?  libusb is the big
> one, right?  Everyone seems to be using their own fork of this.
>
> --
> View this message in context: http://www.pcl-users.org/libGL-issue-when-running-visualization-apps-on-OSX-tp3574302p3577721.html
> Sent from the Point Cloud Library (PCL) Users mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: libGL issue when running visualization apps on OSX

Kevin Matzen
Oh.  That makes things easier.  I guess the only thing is to execute
sudo port mdmg port_name
instead of
sudo port dmg port_name

It's going to end up being a bloated file with all the dependencies, but if these aren't forked, then they really only make sense for people who do not already use MacPorts or don't want to build them.  And if they don't use MacPorts or want to build them, then they need the dependencies anyway.

I think I didn't feel like trusting the wiki page since the dmg page states:
"All the binary installers in the table above have been generated using MacPorts."
But the OpenNI packages were not according to the wiki.  They only use PackageMaker.
Reply | Threaded
Open this post in threaded view
|

Re: libGL issue when running visualization apps on OSX

Radu B. Rusu
Administrator

On 12/11/2011 10:02 AM, Kevin Matzen wrote:
> Oh.  That makes things easier.  I guess the only thing is to execute
> sudo port mdmg port_name
> instead of
> sudo port dmg port_name
>
> It's going to end up being a bloated file with all the dependencies, but if
> these aren't forked, then they really only make sense for people who do not
> already use MacPorts or don't want to build them.  And if they don't use
> MacPorts or want to build them, then they need the dependencies anyway.


I don't know how that affects things, so I'll defer this to other MacOS developers that know better. Last time I asked
someone recommended we don't do that as we draw in way too many other packages that the user might have installed. The
current set of DMGs works perfectly on freshly installed MacOS machines (with X11).

> I think I didn't feel like trusting the wiki page since the dmg page states:
> "All the binary installers in the table above have been generated using
> MacPorts."
> But the OpenNI packages were not according to the wiki.  They only use
> PackageMaker.

Good catch! Thanks, I just fixed that.

Cheers,
Radu.
--
http://pointclouds.org
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: libGL issue when running visualization apps on OSX

ASpeers
It might help if the macport commands for installing the dependencies were added to the "compile from source" section.  That would simplify the build for many and would limit the number of people depending on using the binaries of the dependencies.

Just a thought!
Andrew