[osg-users] Statically linking everything.

169 views
Skip to first unread message

Scott Duensing

unread,
Feb 15, 2016, 4:34:28 PM2/15/16
to osg-...@lists.openscenegraph.org
I've been searching the forums and web and can't figure out how to statically link OSG with my code.

I've managed to build OSG statically but not OpenThreads. There is no DYNAMIC_OPENTHREADS option as mentioned in several places.

I can't find documentation on the various USE_* macros for enabling static linked libraries either.

What I have so far complains a lot about undefined references to osg::ComputeBoundsVisitor, osg::Billboard, osgText, and about 450 other things.

Could someone please help? I'm using Linux. Thanks.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=66293#66293





_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Scott Duensing

unread,
Feb 15, 2016, 5:24:49 PM2/15/16
to osg-...@lists.openscenegraph.org
Ok, so after "fixing" things, I'm up to 8010 linker errors. Obviously I don't understand this!

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=66294#66294

Scott Duensing

unread,
Feb 15, 2016, 8:46:47 PM2/15/16
to osg-...@lists.openscenegraph.org
Okay, after more tinkering I have it linking. I'm still not entirely sure what all the macros should be. If I use USE_DOTOSGWRAPPER_LIBRARY() for anything, I get link errors again.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=66296#66296

Sebastian Messerschmidt

unread,
Feb 16, 2016, 3:22:03 AM2/16/16
to osg-...@lists.openscenegraph.org
Hi Scott
> I've been searching the forums and web and can't figure out how to statically link OSG with my code.
>
> I've managed to build OSG statically but not OpenThreads. There is no DYNAMIC_OPENTHREADS option as mentioned in several places.
In the CMake simply uncheck DYNAMIC_OPENSCENEGRAPH and
DYNAMIC_OPENTHREADS... I've just checked for the 3.4.0 and those options
are there.
I don't quite recall, but in order to link the plugins you'll have to
put the USE_OSGPLUGIN(%pluginname%) in the code.
And IIRC the USE_DOTOSGWRAPPER_LIBRARY is for serializing into the old
.osg format.

>
> I can't find documentation on the various USE_* macros for enabling static linked libraries either.
>
> What I have so far complains a lot about undefined references to osg::ComputeBoundsVisitor, osg::Billboard, osgText, and about 450 other things.
>
> Could someone please help? I'm using Linux. Thanks.
Cheers
Sebastian

Robert Osfield

unread,
Feb 16, 2016, 4:37:42 AM2/16/16
to OpenSceneGraph Users
HI Scott,

On 16 February 2016 at 01:51, Scott Duensing <sc...@duensing.com> wrote:
> Okay, after more tinkering I have it linking. I'm still not entirely sure what all the macros should be. If I use USE_DOTOSGWRAPPER_LIBRARY() for anything, I get link errors again.

The build should be as simple as changing the CMake options
DYNAMIC_OPENSCENEGRAPH and DYNAMIC_OPENTHREADS to OFF.

When compiling + linking applications you have to explictly link to
the plugins and any wrappers. The osgstaticviewer example
(examples/osgstaticviewer) illustrates how.

Robert.

Scott Duensing

unread,
Feb 16, 2016, 9:43:27 AM2/16/16
to osg-...@lists.openscenegraph.org
Thanks. I found the OpenThreads setting after digging more into how the build actually works. I had only loaded the OSG CMakeLists before.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=66304#66304
Reply all
Reply to author
Forward
0 new messages