[osg-users] Building OSG on Mac OS X 10.11.5

Wietse Jacobs wietse.j at gmail.com
Sun Jun 12 14:27:30 PDT 2016


Hello,

I'm new to OSG and to this list, so I'm not sure how appropriate this post
is, but I'm hoping somebody will find it useful. Following are some notes
about the process I went through to build OSG on my new Macbook Pro.

Mac OS X 10.11.5
CMake 3.5.2
Xcode 7.3.1
OSG git clone, "git rev-parse HEAD" returns
157ee3dd7d080e7b16b133dabab9f8dce2f83941

When configuring with cmake I get the following warning:
-----------------------------------------------------------------------------
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
  --help-policy CMP0042" for policy details.  Use the cmake_policy command
to
  set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:

   OpenThreads
   osg
   osgAnimation
   osgDB
   osgFX
   osgGA
   osgManipulator
   osgParticle
   osgPresentation
   osgShadow
   osgSim
   osgTerrain
   osgText
   osgUI
   osgUtil
   osgViewer
   osgVolume
   osgWidget
-----------------------------------------------------------------------------
(I'm not installing to a default path)

When running make I get the following errors:
-----------------------------------------------------------------------------
Scanning dependencies of target osg
[  0%] Building CXX object src/osg/CMakeFiles/osg.dir/AlphaFunc.cpp.o
In file included from /Users/wja/projects/
gitbub.com/OpenSceneGraph/src/osg/AlphaFunc.cpp:14:
In file included from /Users/wja/projects/
gitbub.com/OpenSceneGraph/include/osg/AlphaFunc:17:
In file included from /Users/wja/projects/
gitbub.com/OpenSceneGraph/include/osg/StateAttribute:18:
In file included from /Users/wja/projects/
gitbub.com/OpenSceneGraph/include/osg/Object:19:
/Users/wja/projects/gitbub.com/OpenSceneGraph/include/osg/ref_ptr:99:42:
error: implicit instantiation of
      undefined template 'std::__1::basic_string<char,
std::__1::char_traits<char>,
      std::__1::allocator<char> >'
                throw std::runtime_error(std::string("could not dereference
invalid osg pointer ") ...
                                         ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:193:33:
note:
      template is declared here
    class _LIBCPP_TYPE_VIS_ONLY basic_string;
                                ^
In file included from /Users/wja/projects/
gitbub.com/OpenSceneGraph/src/osg/AlphaFunc.cpp:14:
In file included from /Users/wja/projects/
gitbub.com/OpenSceneGraph/include/osg/AlphaFunc:17:
In file included from /Users/wja/projects/
gitbub.com/OpenSceneGraph/include/osg/StateAttribute:18:
In file included from /Users/wja/projects/
gitbub.com/OpenSceneGraph/include/osg/Object:19:
/Users/wja/projects/gitbub.com/OpenSceneGraph/include/osg/ref_ptr:109:42:
error: implicit instantiation of
      undefined template 'std::__1::basic_string<char,
std::__1::char_traits<char>,
      std::__1::allocator<char> >'
                throw std::runtime_error(std::string("could not call
invalid osg pointer ") + std::s...
                                         ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:193:33:
note:
      template is declared here
    class _LIBCPP_TYPE_VIS_ONLY basic_string;
                                ^
2 errors generated.
make[2]: *** [src/osg/CMakeFiles/osg.dir/AlphaFunc.cpp.o] Error 1
make[1]: *** [src/osg/CMakeFiles/osg.dir/all] Error 2
make: *** [all] Error 2
-----------------------------------------------------------------------------

Changing "OpenSceneGraph/include/osg/ref_ptr" by adding "#include <string>"
seems to solve this.
Next run builds OSG, but with following warnings:
-----------------------------------------------------------------------------
...
[ 20%] Building CXX object
src/osgViewer/CMakeFiles/osgViewer.dir/GraphicsWindowCocoa.mm.o
/Users/wja/projects/
gitbub.com/OpenSceneGraph/src/osgViewer/GraphicsWindowCocoa.mm:1726:29:
warning:
      incompatible pointer types sending 'CocoaAppDelegate *' to parameter
of type
      'id<NSFileManagerDelegate> _Nullable' [-Wincompatible-pointer-types]
        [NSApp setDelegate: [[CocoaAppDelegate alloc] init] ];
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/objc/NSObject.h:60:1:
note:
      instance method 'init' is assumed to return an instance of its
receiver type ('CocoaAppDelegate *')
- (instancetype)init
^
1 warning generated.
[ 20%] Building CXX object
src/osgViewer/CMakeFiles/osgViewer.dir/DarwinUtils.mm.o
[ 20%] Building CXX object
src/osgViewer/CMakeFiles/osgViewer.dir/PixelBufferCocoa.mm.o
/Users/wja/projects/
gitbub.com/OpenSceneGraph/src/osgViewer/PixelBufferCocoa.mm:59:17: warning:
      'NSOpenGLPFAPixelBuffer' is deprecated: first deprecated in OS X 10.7
[-Wdeprecated-declarations]
    attr[i++] = NSOpenGLPFAPixelBuffer; // for pbuffer usage
                ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOpenGL.h:88:2:
note:
      'NSOpenGLPFAPixelBuffer' has been explicitly marked deprecated here
        NSOpenGLPFAPixelBuffer NS_ENUM_DEPRECATED_MAC(10_3, 10_7)      =
 90,
        ^
/Users/wja/projects/
gitbub.com/OpenSceneGraph/src/osgViewer/PixelBufferCocoa.mm:75:5: warning:
      'NSOpenGLPixelBuffer' is deprecated: first deprecated in OS X 10.7 -
Use GL_EXT_framebuffer_object
      instead [-Wdeprecated-declarations]
    NSOpenGLPixelBuffer* pbuffer = [[NSOpenGLPixelBuffer alloc]
initWithTextureTarget: _traits->targ...
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOpenGL.h:139:12:
note:
      'NSOpenGLPixelBuffer' has been explicitly marked deprecated here
@interface NSOpenGLPixelBuffer : NSObject
           ^
/Users/wja/projects/
gitbub.com/OpenSceneGraph/src/osgViewer/PixelBufferCocoa.mm:75:38: warning:
      'NSOpenGLPixelBuffer' is deprecated: first deprecated in OS X 10.7 -
Use GL_EXT_framebuffer_object
      instead [-Wdeprecated-declarations]
    NSOpenGLPixelBuffer* pbuffer = [[NSOpenGLPixelBuffer alloc]
initWithTextureTarget: _traits->targ...
                                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOpenGL.h:139:12:
note:
      'NSOpenGLPixelBuffer' has been explicitly marked deprecated here
@interface NSOpenGLPixelBuffer : NSObject
           ^
/Users/wja/projects/
gitbub.com/OpenSceneGraph/src/osgViewer/PixelBufferCocoa.mm:75:65: warning:

'initWithTextureTarget:textureInternalFormat:textureMaxMipMapLevel:pixelsWide:pixelsHigh:'
is
      deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
    NSOpenGLPixelBuffer* pbuffer = [[NSOpenGLPixelBuffer alloc]
initWithTextureTarget: _traits->targ...
                                                                ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOpenGL.h:155:1:
note:

'initWithTextureTarget:textureInternalFormat:textureMaxMipMapLevel:pixelsWide:pixelsHigh:'
has been
      explicitly marked deprecated here
- (nullable instancetype)initWithTextureTarget:(GLenum)target
textureInternalFormat:(GLenum)format t...
^
/Users/wja/projects/
gitbub.com/OpenSceneGraph/src/osgViewer/PixelBufferCocoa.mm:77:15: warning:
      'setPixelBuffer:cubeMapFace:mipMapLevel:currentVirtualScreen:' is
deprecated: first deprecated in OS X
      10.7 [-Wdeprecated-declarations]
    [_context setPixelBuffer: pbuffer cubeMapFace: _traits->face
mipMapLevel:_traits->level currentV...
              ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOpenGL.h:259:1:
note:
      'setPixelBuffer:cubeMapFace:mipMapLevel:currentVirtualScreen:' has
been explicitly marked deprecated
      here
- (void)setPixelBuffer:(NSOpenGLPixelBuffer *)pixelBuffer
cubeMapFace:(GLenum)face mipMapLevel:(GLin...
^
5 warnings generated.
...
[ 86%] Building CXX object
src/osgPlugins/3ds/CMakeFiles/osgdb_3ds.dir/lib3ds/lib3ds_io.c.o
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior
is deprecated
...
[ 87%] Linking CXX shared module ../../../lib/osgPlugins-3.5.4/osgdb_3ds.so
ld: warning: ld: warning: object file
(CMakeFiles/osgdb_3ds.dir/lib3ds/lib3ds_atmosphere.c.o) was built for newer
OSX version (10.11) than being linked (10.8)object file
(CMakeFiles/osgdb_3ds.dir/lib3ds/lib3ds_background.c.o) was built for newer
OSX version (10.11) than being linked (10.8)

ld: warning: object file
(CMakeFiles/osgdb_3ds.dir/lib3ds/lib3ds_camera.c.o) was built for newer OSX
version (10.11) than being linked (10.8)
ld: warning: object file (CMakeFiles/osgdb_3ds.dir/lib3ds/lib3ds_chunk.c.o)
was built for newer OSX version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_3ds.dir/lib3ds/lib3ds_chunktable.c.o) was built for newer
OSX version (10.11) than being linked (10.8)ld: warning:
object file (CMakeFiles/osgdb_3ds.dir/lib3ds/lib3ds_file.c.o) was built for
newer OSX version (10.11) than being linked (10.8)
ld: warning: object file (CMakeFiles/osgdb_3ds.dir/lib3ds/lib3ds_light.c.o)
was built for newer OSX version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_3ds.dir/lib3ds/lib3ds_material.c.o) was built for newer
OSX version (10.11) than being linked (10.8)
ld: warning: object file (CMakeFiles/osgdb_3ds.dir/lib3ds/lib3ds_math.c.o)
was built for newer OSX version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_3ds.dir/lib3ds/lib3ds_matrix.c.o) was built for newer OSX
version (10.11) than being linked (10.8)
ld: warning: object file (CMakeFiles/osgdb_3ds.dir/lib3ds/lib3ds_mesh.c.o)
was built for newer OSX version (10.11) than being linked (10.8)
ld: warning: object file (CMakeFiles/osgdb_3ds.dir/lib3ds/lib3ds_node.c.o)
was built for newer OSX version (10.11) than being linked (10.8)
ld: warning: object file (CMakeFiles/osgdb_3ds.dir/lib3ds/lib3ds_quat.c.o)
was built for newer OSX version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_3ds.dir/lib3ds/lib3ds_shadow.c.o) was built for newer OSX
version (10.11) than being linked (10.8)ld: warning:
object file (CMakeFiles/osgdb_3ds.dir/lib3ds/lib3ds_track.c.o) was built
for newer OSX version (10.11) than being linked (10.8)
ld: warning: object file (CMakeFiles/osgdb_3ds.dir/lib3ds/lib3ds_util.c.o)
was built for newer OSX version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_3ds.dir/lib3ds/lib3ds_vector.c.o) was built for newer OSX
version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_3ds.dir/lib3ds/lib3ds_viewport.c.o) was built for newer
OSX version (10.11) than being linked (10.8)
[ 87%] Built target osgdb_3ds
...
Scanning dependencies of target osgdb_zip
[ 95%] Building CXX object
src/osgPlugins/zip/CMakeFiles/osgdb_zip.dir/unzip.cpp.o
/Users/wja/projects/
gitbub.com/OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:1812:3: warning:
'register'
      storage class specifier is deprecated [-Wdeprecated-register]
  register uInt i;              // counter, current code
  ^~~~~~~~~
/Users/wja/projects/
gitbub.com/OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:1813:3: warning:
'register'
      storage class specifier is deprecated [-Wdeprecated-register]
  register uInt j;              // counter
  ^~~~~~~~~
/Users/wja/projects/
gitbub.com/OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:1814:3: warning:
'register'
      storage class specifier is deprecated [-Wdeprecated-register]
  register int k;               // number of bits in current code
  ^~~~~~~~~
/Users/wja/projects/
gitbub.com/OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:1817:3: warning:
'register'
      storage class specifier is deprecated [-Wdeprecated-register]
  register uInt *p;            // pointer into c[], b[], or v[]
  ^~~~~~~~~
/Users/wja/projects/
gitbub.com/OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:1821:3: warning:
'register'
      storage class specifier is deprecated [-Wdeprecated-register]
  register int w;               // bits before this table == (l * h)
  ^~~~~~~~~
5 warnings generated.
...
[ 97%] Building CXX object
src/osgPlugins/osc/CMakeFiles/osgdb_osc.dir/osc/OscPrintReceivedElements.cpp.o
/Users/wja/projects/
gitbub.com/OpenSceneGraph/src/osgPlugins/osc/osc/OscPrintReceivedElements.cpp:127:17:
warning:
      'delete' applied to a pointer that was allocated with 'new[]'; did
you mean 'delete[]'?
      [-Wmismatched-new-delete]
                delete s;
                ^
                      []
/Users/wja/projects/
gitbub.com/OpenSceneGraph/src/osgPlugins/osc/osc/OscPrintReceivedElements.cpp:120:27:
note:
      allocated with 'new[]' here
                char *s = new char[ len + 1 ];
                          ^
1 warning generated.
...
[ 99%] Linking CXX shared module ../../../lib/osgPlugins-3.5.4/osgdb_lua.so
ld: warning: object file (CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/lapi.c.o)
was built for newer OSX version (10.11) than being linked (10.8)
ld: warning: object file (CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/lcode.c.o)
was built for newer OSX version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/lctype.c.o) was built for newer OSX
version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/ldebug.c.o) was built for newer OSX
version (10.11) than being linked (10.8)
ld: warning: object file (CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/ldo.c.o)
was built for newer OSX version (10.11) than being linked (10.8)
ld: warning: object file (CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/ldump.c.o)
was built for newer OSX version (10.11) than being linked (10.8)
ld: warning: object file (CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/lfunc.c.o)
was built for newer OSX version (10.11) than being linked (10.8)
ld: warning: object file (CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/lgc.c.o)
was built for newer OSX version (10.11) than being linked (10.8)
ld: warning: object file (CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/llex.c.o)
was built for newer OSX version (10.11) than being linked (10.8)
ld: warning: object file (CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/lmem.c.o)
was built for newer OSX version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/lobject.c.o) was built for newer
OSX version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/lopcodes.c.o) was built for newer
OSX version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/lparser.c.o) was built for newer
OSX version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/lstate.c.o) was built for newer OSX
version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/lstring.c.o) was built for newer
OSX version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/ltable.c.o) was built for newer OSX
version (10.11) than being linked (10.8)
ld: warning: object file (CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/ltm.c.o)
was built for newer OSX version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/lundump.c.o) was built for newer
OSX version (10.11) than being linked (10.8)
ld: warning: object file (CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/lvm.c.o)
was built for newer OSX version (10.11) than being linked (10.8)
ld: warning: object file (CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/lzio.c.o)
was built for newer OSX version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/lauxlib.c.o) was built for newer
OSX version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/lbaselib.c.o) was built for newer
OSX version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/lbitlib.c.o) was built for newer
OSX version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/lcorolib.c.o) was built for newer
OSX version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/ldblib.c.o) was built for newer OSX
version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/liolib.c.o) was built for newer OSX
version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/lmathlib.c.o) was built for newer
OSX version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/loslib.c.o) was built for newer OSX
version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/lstrlib.c.o) was built for newer
OSX version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/ltablib.c.o) was built for newer
OSX version (10.11) than being linked (10.8)
ld: warning: object file
(CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/loadlib.c.o) was built for newer
OSX version (10.11) than being linked (10.8)
ld: warning: object file (CMakeFiles/osgdb_lua.dir/lua-5.2.3/src/linit.c.o)
was built for newer OSX version (10.11) than being linked (10.8)
[ 99%] Built target osgdb_lua
...
-----------------------------------------------------------------------------
Built successfully!

"make install" gave me some trouble because I didn't know that cmake
doesn't expand "~", but that was easily solved.

Next I had to do: "export
DYLD_FALLBACK_LIBRARY_PATH=/Users/wja/projects/bin/osg/lib".
And now I can see a shiny silver cow with "osgviewer"!

I suppose that the DYLD_FALLBACK_LIBRARY_PATH hack can be avoided with a
better configuration in CMakeCache.txt, but I haven't taken time to figure
that out yet.

If anybody can point out what I did wrong to have to include <string> in
the file ref_ptr I would be grateful.

And now I can't wait to get started with OSG!

--
--Wietse
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160612/d9e97283/attachment-0002.htm>


More information about the osg-users mailing list