[osg-users] need help compiling statically

OpenSceneGraph Users osg-users at lists.openscenegraph.org
Fri May 15 00:57:52 PDT 2020


Hi!

My program is working fine in my own machine. I want to test it in a 
different machine now (both using Debian 10), so I want to compile it 
statically. For dynamic compiling, I use:

g++ terreno1.cpp -losg -losgDB -losgGA -losgSim -losgText -losgUtil 
-losgViewer -o terreno1

For static, I learned here <https://stackoverflow.com/a/52000944/1086511> 
that I need to use -Wl,-Bstatic at the beginning of the library list, and 
-Wl,-Bdynamic at the end. Before that (with only the beginning part), I was 
getting:

/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status

Now I get that long list of "undefined reference" through many of OSG 
source files (can paste it here, if you need). I've read somewhere that the 
order of libraries are important, so I've tried them in the order given by 
"make":

g++ terreno1.cpp -Wl,-Bstatic -lOpenThreads -losg -losgUtil -losgDB -losgGA 
-losgText -losgViewer -losgSim -Wl,-Bdynamic -o terreno1

and also in the reversed order:

g++ terreno1.cpp -Wl,-Bstatic -losgSim -losgViewer -losgText -losgGA 
-losgDB -losgUtil -losg -lOpenThreads -Wl,-Bdynamic -o terreno1

both with and without -lOpenThreads (which is not required for dynamic 
compiling). Nothing worked so far.

Can anyone please tell me what am I doing wrong? My source code can be seen 
here <https://github.com/eco-info/osgCookbook/tree/master/outros/terreno1>.

Thanks,

Rodrigo.

-- 
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-users+unsubscribe at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/eddf2bc1-6a25-4b10-8d1b-3f0e801166ca%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200515/a0bcf04f/attachment.html>


More information about the osg-users mailing list