pcl
pcl copied to clipboard
CloudViewer not supported on Mac
I've bumped against this one last year, but forgot to report it back then.
Your Environment
- Operating System and version: Mac OSX 10.11.6
- Compiler: LLVM Clang 3.8
- PCL Version: master
Expected Behavior
Open an empty cloudviewer window.
Current Behavior
The rendering backend is complaining that some methods are not being called from the main thread.
Code to Reproduce
CMake
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(cloud_viewer)
find_package(PCL 1.5 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable (cloud_viewer cloud_viewer.cpp)
target_link_libraries (cloud_viewer ${PCL_LIBRARIES})
Snippet
#include <pcl/visualization/cloud_viewer.h>
int
main (int argc, char** argv)
{
pcl::visualization::CloudViewer viewer ("Cluster viewer");
while (!viewer.wasStopped ())
{
boost::this_thread::sleep (boost::posix_time::microseconds (100));
}
return (0);
}
Output
$ ./cloud_viewer
2016-11-06 20:07:19.775 cloud_viewer[10114:307786] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1259/Misc.subproj/NSUndoManager.m:359
2016-11-06 20:07:19.775 cloud_viewer[10114:307786] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.
2016-11-06 20:07:19.777 cloud_viewer[10114:307786] (
0 CoreFoundation 0x00007fff94c89452 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff8cb8773c objc_exception_throw + 48
2 CoreFoundation 0x00007fff94c8e12a +[NSException raise:format:arguments:] + 106
3 Foundation 0x00007fff97602856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
4 Foundation 0x00007fff97587af1 +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 170
5 AppKit 0x00007fff994d9e22 -[NSApplication run] + 844
6 libpcl_visualization.1.8.dylib 0x000000011c54bb55 _ZN3pcl13visualization13PCLVisualizer8spinOnceEib + 357
7 libpcl_visualization.1.8.dylib 0x000000011c5de769 _ZN3pcl13visualization11CloudViewer16CloudViewer_implclEv + 3129
8 libpcl_visualization.1.8.dylib 0x000000011c5dd1ec _ZN5boost6detail11thread_dataINS_17reference_wrapperIN3pcl13visualization11CloudViewer16CloudViewer_implEEEE3runEv + 28
9 libboost_thread-mt.dylib 0x000000010fa66715 _ZN5boost12_GLOBAL__N_112thread_proxyEPv + 53
10 libsystem_pthread.dylib 0x00007fff9b94399d _pthread_body + 131
11 libsystem_pthread.dylib 0x00007fff9b94391a _pthread_body + 0
12 libsystem_pthread.dylib 0x00007fff9b941351 thread_start + 13
)
2016-11-06 20:07:19.777 cloud_viewer[10114:307786] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1259/Misc.subproj/NSUndoManager.m:359
2016-11-06 20:07:19.778 cloud_viewer[10114:307786] An uncaught exception was raised
2016-11-06 20:07:19.778 cloud_viewer[10114:307786] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.
2016-11-06 20:07:19.778 cloud_viewer[10114:307786] (
0 CoreFoundation 0x00007fff94c89452 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff8cb8773c objc_exception_throw + 48
2 CoreFoundation 0x00007fff94c8e12a +[NSException raise:format:arguments:] + 106
3 Foundation 0x00007fff97602856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
4 Foundation 0x00007fff97587af1 +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 170
5 AppKit 0x00007fff994d9ebe -[NSApplication run] + 1000
6 libpcl_visualization.1.8.dylib 0x000000011c54bb55 _ZN3pcl13visualization13PCLVisualizer8spinOnceEib + 357
7 libpcl_visualization.1.8.dylib 0x000000011c5de769 _ZN3pcl13visualization11CloudViewer16CloudViewer_implclEv + 3129
8 libpcl_visualization.1.8.dylib 0x000000011c5dd1ec _ZN5boost6detail11thread_dataINS_17reference_wrapperIN3pcl13visualization11CloudViewer16CloudViewer_implEEEE3runEv + 28
9 libboost_thread-mt.dylib 0x000000010fa66715 _ZN5boost12_GLOBAL__N_112thread_proxyEPv + 53
10 libsystem_pthread.dylib 0x00007fff9b94399d _pthread_body + 131
11 libsystem_pthread.dylib 0x00007fff9b94391a _pthread_body + 0
12 libsystem_pthread.dylib 0x00007fff9b941351 thread_start + 13
)
2016-11-06 20:07:19.778 cloud_viewer[10114:307786] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff94c89452 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff8cb8773c objc_exception_throw + 48
2 CoreFoundation 0x00007fff94c8e12a +[NSException raise:format:arguments:] + 106
3 Foundation 0x00007fff97602856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
4 Foundation 0x00007fff97587af1 +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 170
5 AppKit 0x00007fff994d9ebe -[NSApplication run] + 1000
6 libpcl_visualization.1.8.dylib 0x000000011c54bb55 _ZN3pcl13visualization13PCLVisualizer8spinOnceEib + 357
7 libpcl_visualization.1.8.dylib 0x000000011c5de769 _ZN3pcl13visualization11CloudViewer16CloudViewer_implclEv + 3129
8 libpcl_visualization.1.8.dylib 0x000000011c5dd1ec _ZN5boost6detail11thread_dataINS_17reference_wrapperIN3pcl13visualization11CloudViewer16CloudViewer_implEEEE3runEv + 28
9 libboost_thread-mt.dylib 0x000000010fa66715 _ZN5boost12_GLOBAL__N_112thread_proxyEPv + 53
10 libsystem_pthread.dylib 0x00007fff9b94399d _pthread_body + 131
11 libsystem_pthread.dylib 0x00007fff9b94391a _pthread_body + 0
12 libsystem_pthread.dylib 0x00007fff9b941351 thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6
$
You can read this (https://github.com/PointCloudLibrary/pcl/issues/253). Use PCLVisualizer to replace the CloudViewer. My pcl version is 1.8.0 and macOS is Sierra 10.12.2. It works.
@JingeTu PCLVisualizer has the same problem when being created and/or used from a non-main thread, can you share an example of how you did that successfully?
Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs.
Use of OpenGL renders this moot, right?
Depends on what VTK uses under the hood to render on macOS these days. The issue with CloudViewer was that the render procedure was deferred to a background thread and macOS refuses to accept that.
Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs.
This is by the way still an issue. Would be nice to raise an error on macos to avoid newbies running into this.