Boost logo

Boost-Build :

Subject: Re: [Boost-build] Bug in searched libraries / target-os dependend names for searched libraries
From: Moritz Hassert (mhassert_at_[hidden])
Date: 2011-09-14 11:06:03


Hi Meindert,

Am Mittwoch, 14. September 2011, 13:20:36 schrieb Meindert Oldenburger:
> Suggestion: consider making different site-config files for each target-os.

Generally, that is an option, but not for me, as I
a) need a solution that works for corss-compiling too, and
b) I want to rely as little as possible on system-wide configurations

btw:
The work-around in my previous post is broken: It doesn't work either.
I came up with another solution which is, to my opinion, as obvious and
elegant as my original one, but a bit longer.
I defined two target alternatives, one for each target-os:

explicit libGL ;
lib libGL
    :
    : <name>GL
      <target-os>linux
    ;

lib libGL
    :
    : <name>opengl32
      <target-os>windows
    ;

explicit libGLU ;
lib libGLU
    : libGL
    : <name>GLU
      <target-os>linux
    ;

lib libGLU
    : libGL
    : <name>glu32
      <target-os>windows
    ;

Note the "explicit" lines. Without them boost-build complains that there is no
best alternative for the targets. (Don't kown why)

Yet, I still think the problem in my previous post is a bug.

Greetings,
Moritz

>
> 2011/9/14 Moritz Hassert <mhassert_at_[hidden]>
>
> > Hi all,
> >
> > I'm facing a problem with external/searched libraries and conditional
> > properties, which I think is a bug. I'm using newest boost-build from svn
> > trunk.
> >
> > I have a project with opengl on linux. So I need to link my binary
> > against libGL.so and libGLU.so on linux. I defined two lib targets and
> > used them in my
> > exe target:
> >
> > lib libGL : : <name>GL ;
> > lib libGLU : libGL : <name>GLU ;
> > exe foo : libGL libGLU ...
> >
> > Now I want to build the project on windows too, where the dlls are called
> > opengl32.dll and glu32.dll. My straight-forward approach was to make the
> > <name> property conditional on <target-os> :
> >
> > lib libGL : :
> > <target-os>linux:<name>GL
> > <target-os>windows:<name>opengl32 ;
> >
> > lib libGLU : libGL :
> > <target-os>linux:<name>GLU
> > <target-os>windows:<name>glu32 ;
> >
> > exe foo : libGL libGLU ...
> >
> > However, this results in an error:
> >
> > [...]/boost-build/kernel/class.jam:88: in new
> > *** argument error
> > * rule object(searched-lib-target)@667.__init__ ( name : project : shared
> > ?
> >
> > search * : action )
> > * called with: ( GL libGL : object(project-target)@112 : true : :
> > object(null-action)@666 : : : : )
> > * extra argument libGL
> > [...]/boost-build/tools/builtin.jam:406:see definition of rule '__init__'
> > being
> > called
> > [...]/boost-build/tools/builtin.jam:574: in searched-lib-generator.run
> > [...]/boost-build/tools/unix.jam:113: in object(unix-searched-lib-
> > generator)@24.run
> > [...]/boost-build/build/generators.jam:1004: in try-one-generator-really
> > [...]/boost-build/build/generators.jam:1066: in try-one-generator
> > [...]/boost-build/build/generators.jam:1282: in construct-really
> > [...]/boost-build/build/generators.jam:1366: in generators.construct
> > [...]/boost-build/tools/builtin.jam:477: in object(lib-generator)@5.run
> > [...]/boost-build/build/generators.jam:1004: in try-one-generator-really
> > [...]/boost-build/build/generators.jam:1066: in try-one-generator
> > [...]/boost-build/build/generators.jam:1282: in construct-really
> > [...]/boost-build/build/generators.jam:1366: in generators.construct
> > [...]/boost-build/build/targets.jam:1495: in construct
> > [...]/boost-build/build/targets.jam:1297: in
> > object(typed-target)@116.generate
> > [...]/boost-build/build/targets.jam:732: in generate-really
> > [...]/boost-build/build/targets.jam:704: in
> > object(main-target)@653.generate
> > [...]/boost-build/build/targets.jam:258: in object(project-
> > target)@112.generate
> > [...]/boost-build/build-system.jam:736: in load
> > [...]/boost-build/kernel/modules.jam:283: in import
> > [...]/boost-build/kernel/bootstrap.jam:142: in boost-build
> > [...]/boost-build/boost-build.jam:8: in module scope
> >
> > It seems like both the value of <name> and the lib target name are used.
> > Perhaps the piece of code, that uses the target name as default when no
> > <name>
> > is given gets somehow confused by the conditional property.
> >
> > As a workaround I now use this:
> >
> > lib libGLLinux : : <name>GL ;
> > lib libGLWindows : : <name>opengl32 ;
> >
> > alias libGL : :
> > <target-os>linux:<library>libGLLinux
> > <target-os>windows:<library>libGLWindows ;
> >
> > lib libGLU
> >
> > : libGL # depends on libGL
> > : <target-os>linux:<name>GLU
> > :
> > <target-os>windows:<name>glu32 ;
> >
> > Suprisingly, I get no error for libGLU. But if I remove the dependency on
> > libGL, I get the above error for libGLU target, too.
> >
> >
> > Could someone please tell me whether I'm doing something wrong here or
> > confirm
> > this is a bug? In the latter case I will file an separate bug report.
> >
> > Thanks,
> > Moritz
> >
> > --
> > --
> > AB+M GmbH
> > Haid-und-Neu-Straße 7
> > 76131 Karlsruhe
> > Telefon: (0721) 66488-0
> > Telefax: (0721) 66488-18
> >
> >
> > Geschaeftsfuehrer: Dipl.-Inform. Christopher Asp
> > Amtsgericht Mannheim HRB 105845
> >
> > Geschaeftsfuehrer: Dipl.-Inform. Christopher Asp
> > Amtsgericht Mannheim HRB 105845
> > _______________________________________________
> > Unsubscribe & other changes:
> > http://lists.boost.org/mailman/listinfo.cgi/boost-build

-- 
--
AB+M GmbH 
Haid-und-Neu-Straße 7
76131 Karlsruhe
Telefon: (0721) 66488-0
Telefax: (0721) 66488-18
Geschaeftsfuehrer: Dipl.-Inform. Christopher Asp
Amtsgericht Mannheim HRB 105845
Geschaeftsfuehrer: Dipl.-Inform. Christopher Asp
Amtsgericht Mannheim HRB 105845

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk