mingw-cross-env-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Mingw-cross-env-list] [PATCH] Add OpenSceneGraph


From: Martin Lambers
Subject: Re: [Mingw-cross-env-list] [PATCH] Add OpenSceneGraph
Date: Wed, 13 Jan 2010 20:02:50 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

On Tue, 12. Jan 2010, 20:52:57 +0100, Volker Grabsch wrote:
> > > I think that your comments are great, although a bit verbose.
> > > Can't the long compiler line be reduced to something like this?
> > > 
> > >     i686-pc-mingw32-g++ `pkg-config osc --cflags` `pkg-config osc --libs` 
> > > ...
> > 
> > Unfortunately not, for the following reasons:
> > - 'i686-pc-mingw32-pkg-config --libs openscenegraph' lists all base OSG 
> > libs,
> >   but in the wrong order, so that linking fails.
> 
> This is a bug in the openscenegraph package and should be fixed,
> either via a patch (which should also be presented to upstream),
> or via some $(SED) actions.
> 
> > - The plugin library directory (lib/osgPlugins-2.8.2) is not added with -L, 
> > and
> >   no plugin libraries are reported by pkg-config. This is because OSG is
> >   designed to load dynamic plugins at runtime itself.
> 
> Nevertheless, the additional -L... option wouldn't harm. If
> upstream refuses that addition, consider adding it conditionally,
> i.e. only when openscenegraph was built for static linking.
> 
> If you need any help with that, please let me know.

The pkg-config problem is a little bit more complicated than I would
like. Here is a summary:

OpenSceneGraph is changing their pkg-config file approach. Instead of
the single old openscenegraph.pc file, they now use special files for
each individual base library. Each of these files has a 'Requires:'
field that may list other base libraries, so that pkg-config can
determine the dependencies and get the right order for the --libs
option.

See also <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=528229> and
<http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/packaging/pkgconfig>.

However, the new approach, like the old one, only works for dynamic
libraries. None of the .pc files contains the 'Libs.private:' field
that should list external dependencies, needed for static linking and
reported by "pkg-config --static". Examples for such dependencies in
mingw-cross-env would be -lopengl32, -lgu32, and -lgdi32.

But listing external dependencies would not be enough, because the
plugins are still missing. Without them, OSG cannot even perform basic
tasks such as reading/writing its own file format, so every nontrivial
OSG program will require the plugins.

Therefore, I think there should be an additional
openscenegraph-plugins.pc file. It would leave the 'Libs:' field blank,
so that no additional libraries are used when linking dynamically
(because OSG then handles plugins at runtime). But it would put the
plugin directory and all built plugins along with their external
dependencies into the 'Libs.private:' field. An application using static
linking would then be linked with all of those plugin libraries that it
explicitly referenced with USE_PLUGIN(). This additonal .pc file should
have openscenegraph-osgDB in its 'Requires:' field, to get the library
order right.

All of the information about external libraries and the subset of
plugins that get build is available in CMAKE, but unfortunately I cannot
find a way to extract it and write it into the .pc files.

For mingw-cross-env, I see three options:

1) Find a CMAKE wizard who solves the problems listed above and proposes
   a patch to upstream.
2) Build pkg-config files (either a single file or multiple files) that
   provide the correct information for mingw-cross-env. This would need
   tweaking for every new OSG release, and also when additional packages in
   mingw-cross-env enable additional OSG plugins (for example, dcmtk for
   the DICOM plugin).
3) Accept that OSG currently does not support static linking hints with
   pkg-config, and require applications to do their static linking
   themselves.

Due to lack of time, I would go with option 3 for now, but I could
understand if you want this issue solved before letting openscenegraph
into mingw-cross-env.

Martin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]