Errors when using target references to boost libraries

View: New views
8 Messages — Rating Filter:   Alert me  

Errors when using target references to boost libraries

by Bob Walters-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm having difficulty referring to targets in the boost library, and
would appreciate any pointers or help on what I may be doing wrong.

I have an stand-alone project which is dependent on boost.  I set up
this project with its own Jamroot, which is relatively small.  I'm
trying to use the directory//target syntax to refer to libraries in
the boost project.  My goal is that using those targets avoids any
need to try to

<File 'Jamroot':>

import common ;
import os ;

local BOOST_ROOT = [ os.environ BOOST_ROOT ] ;

alias libboost_serialization :
$(BOOST_ROOT)/libs/serialization/build//boost_serialization ;
alias libboost_thread : $(BOOST_ROOT)/libs/thread/build//boost_thread ;
alias libboost_filesystem :
$(BOOST_ROOT)/libs/filesystem/build//boost_filesystem ;
alias libboost_system : $(BOOST_ROOT)/libs/system/build//boost_system ;
alias libboost_date_time : $(BOOST_ROOT)/libs/date_time/build//boost_date_time ;

lib stldb
        : src/logging.cpp
          src/trace.cpp
          src/time_tracked.cpp
          src/timer.cpp
          src/bounded_interprocess_mutex.cpp
          src/db_file_util.cpp
          src/log_reader.cpp
          libboost_filesystem
          libboost_system
          libboost_date_time
        : <include>$(BOOST_ROOT)
          <include>.
          <toolset>msvc:<define>NO_STDINT_H
          <toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
          <define>STLDB_TRACING
        ;
<EOF>

When I've tried doing this on MacOSX, it works - the dependencies
resolve and the library builds.  Under windows, with MSVC 9.0, I'm
getting an error during the processing of the jam file.  The error log
is somewhat long, but the most suggestive bit is:

*** argument error
* rule project.find ( name : current-location )
* called with: ( boost_serialization :  )
* missing argument current-location
C:/c++/boost_1_39_0/tools/build/v2/build\project.jam:145:see
definition of rule 'find' being called
C:/c++/boost_1_39_0/tools/build/v2/build\targets.jam:428: in
object(project-target)@411.find
C:/c++/boost_1_39_0/tools/build/v2/build\targets.jam:366: in find-really
C:/c++/boost_1_39_0/tools/build/v2/build\targets.jam:428: in
object(project-target)@51.find
C:/c++/boost_1_39_0/tools/build/v2/build\targets.jam:794: in resolve-reference
C:/c++/boost_1_39_0/tools/build/v2/build\targets.jam:811: in
targets.generate-from-reference
C:/c++/boost_1_39_0/tools/build/v2/build\targets.jam:1174: in
generate-dependencies
C:/c++/boost_1_39_0/tools/build/v2/build\targets.jam:1224: in
object(alias-target-class)@53.generate
C:/c++/boost_1_39_0/tools/build/v2/build\targets.jam:710: in generate-really
C:/c++/boost_1_39_0/tools/build/v2/build\targets.jam:682: in
object(main-target)@67.generate
C:/c++/boost_1_39_0/tools/build/v2/build\targets.jam:258: in
object(project-target)@51.generate
C:/c++/boost_1_39_0/tools/build/v2\build-system.jam:700: in load
C:\\c++\boost_1_39_0\tools/build/v2/kernel\modules.jam:283: in import
C:\\c++\boost_1_39_0\tools/build/v2/kernel/bootstrap.jam:138: in boost-build
C:\\c++\boost_1_39_0\boost-build.jam:16: in module scope

(The above is not the entire output.)

To build I am:
setting BOOST_ROOT in the env to point to my boost_1_39_0 directory.
Likewise BOOST_BUILD_PATH
bjam --debug-building -q toolset=msvc variant=debug link=static

If I abandon the approach of trying to use the target references,
instead providing explicit <file> values for the libraries, then the
build succeeds.  So the issue appears to have something to do with the
process of resolving the targets.

I've tried using a boost installation which I built myself using a
pre-built bjam binary
and also tried using the pre-built boost distribution from BoostPro
consulting (with the bjam included therein.)
In both cases, the error that results is the same.

Any help / pointers / alternative techniques are much appreciated.
Thanks,

- Bob Walters
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: Errors when using target references to boost libraries

by Johan Nilsson-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bob Walters wrote:
> I'm having difficulty referring to targets in the boost library, and
> would appreciate any pointers or help on what I may be doing wrong.
>
> I have an stand-alone project which is dependent on boost.  I set up
> this project with its own Jamroot, which is relatively small.  I'm
> trying to use the directory//target syntax to refer to libraries in
> the boost project.  My goal is that using those targets avoids any
> need to try to

Try to ... what?

>
> <File 'Jamroot':>
>
> import common ;
> import os ;
>
> local BOOST_ROOT = [ os.environ BOOST_ROOT ] ;
>
> alias libboost_serialization :
> $(BOOST_ROOT)/libs/serialization/build//boost_serialization ;
> alias libboost_thread : $(BOOST_ROOT)/libs/thread/build//boost_thread
> ;
> alias libboost_filesystem :
> $(BOOST_ROOT)/libs/filesystem/build//boost_filesystem ;
> alias libboost_system : $(BOOST_ROOT)/libs/system/build//boost_system
> ;
> alias libboost_date_time :
> $(BOOST_ROOT)/libs/date_time/build//boost_date_time ;

Not sure what's happening here, but you could try a slightly different way
of definining the targets:

import common ;
import os ;

path-constant BOOST_ROOT : [ os.environ BOOST_ROOT ] ;
use-project /boost : $(BOOST_ROOT) ;

alias libboost_serialization : /boost//serialization ;
... etc ...

HTH / Johan


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Parent Message unknown Re: Errors when using target references to boost libraries

by Bob Walters-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Johan Nilsson wrote:
> > My goal is that using those targets avoids any
> > need to try to
>
> Try to ... what?

Sorry: Another victim of loss-of-focus.  I'm trying to avoid putting
any specific library
names in the Jamfile in order to keep it OS/variant/architecture neutral.

I've tried the approach you suggested, on windows.  I'm still getting
an odd problem - apparently
with finding the aliases. (filesystem was the first alias in the
library list when I ran this bjam):

*** argument error
* rule project.find ( name : current-location )
* called with: ( filesystem :  )
* missing argument current-location
C:/c++/boost_1_39_0/tools/build/v2/build\project.jam:145:see
definition of rule 'find' being called
C:/c++/boost_1_39_0/tools/build/v2/build\targets.jam:428: in
object(project-target)@128.find
C:/c++/boost_1_39_0/tools/build/v2/build\targets.jam:366: in find-really
C:/c++/boost_1_39_0/tools/build/v2/build\targets.jam:428: in
object(project-target)@51.find
C:/c++/boost_1_39_0/tools/build/v2/build\targets.jam:794: in resolve-reference
C:/c++/boost_1_39_0/tools/build/v2/build\targets.jam:811: in
targets.generate-from-reference
C:/c++/boost_1_39_0/tools/build/v2/build\targets.jam:1174: in
generate-dependencies
C:/c++/boost_1_39_0/tools/build/v2/build\targets.jam:1224: in
object(alias-target-class)@53.generate
C:/c++/boost_1_39_0/tools/build/v2/build\targets.jam:710: in generate-really
C:/c++/boost_1_39_0/tools/build/v2/build\targets.jam:682: in
object(main-target)@117.generate
C:/c++/boost_1_39_0/tools/build/v2/build\targets.jam:258: in
object(project-target)@51.generate
C:/c++/boost_1_39_0/tools/build/v2\build-system.jam:700: in load
C:\\c++\\boost_1_39_0\tools/build/v2/kernel\modules.jam:283: in import
C:\\c++\\boost_1_39_0\tools/build/v2/kernel/bootstrap.jam:138: in boost-build
C:\\c++\\boost_1_39_0\boost-build.jam:16: in module scope
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: Errors when using target references to boost libraries

by Michael Caisse-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bob Walters wrote:

> Johan Nilsson wrote:
>  
>>> My goal is that using those targets avoids any
>>> need to try to
>>>      
>> Try to ... what?
>>    
>
> Sorry: Another victim of loss-of-focus.  I'm trying to avoid putting
> any specific library
> names in the Jamfile in order to keep it OS/variant/architecture neutral.
>
> I've tried the approach you suggested, on windows.  I'm still getting
> an odd problem - apparently
> with finding the aliases. (filesystem was the first alias in the
> library list when I ran this bjam):
>  

Somebody was trying to do this same thing on IRC this week. I've not thought
of trying to do something like that with aliases so I can't tell you the exact
reason it doesn't work for you.... however, I can tell you what does work and
what I think is the "recommended" (though I'm not sure why I think that (o;  )
way of doing this.

In your Jamroot do something like this:

------ Jamroot -------

...

use-project /vendor/boost : d:/boost/boost_1_38_0 ;

...

-----------------------


In your Jamfile, just refer to the boost library you want and bingo! It does
the right thing.


------ Jamfile -------

exe attribute_test
        : ../test/attribute_test.cpp
          omdxml
          /vendor/boost//headers
          /vendor/boost//thread
        ;

-----------------------


Hope this helps. The use-project in Jamroot creates a very powerful tool.

Michael


--

----------------------------------
Michael Caisse
Object Modeling Designs
www.objectmodelingdesigns.com


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: Errors when using target references to boostlibraries

by Johan Nilsson-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bob Walters wrote:

> Johan Nilsson wrote:
>>> My goal is that using those targets avoids any
>>> need to try to
>>
>> Try to ... what?
>
> Sorry: Another victim of loss-of-focus.  I'm trying to avoid putting
> any specific library
> names in the Jamfile in order to keep it OS/variant/architecture
> neutral.
>
> I've tried the approach you suggested, on windows.  I'm still getting
> an odd problem - apparently
> with finding the aliases. (filesystem was the first alias in the
> library list when I ran this bjam):
>

[snip]

Strange. The following "nonsense project" works for me verbatim using
msvc-8.0 with Boost/Boost.Build/Boost.Jam combo from both 1.34.1 and current
trunk:

-- Jamroot --
import os ;

path-constant BOOST_ROOT : [ os.environ BOOST_ROOT ] ;
use-project /boost : $(BOOST_ROOT) ;

alias boost_thread : /boost//thread ;
alias boost_date_time : /boost//date_time ;

project bar
 :
 requirements
 <include>$(BOOST_ROOT)
 <link>static
 ;

lib foo
 :
 foo.cpp
 boost_thread
 boost_date_time
 ;

exe bar
 :
 main.cpp
 foo
 ;

-- foo.cpp --
#include <boost/thread/thread.hpp>
#include <boost/lambda/lambda.hpp>

extern int foo()
{
 int result = 0;

 boost::thread t(boost::lambda::var(result) = 1);

 t.join();

 return result;
}

-- main.cpp --
int foo();

int main(int, char*[])
{
 return foo();
}
--------------------

What is the actual value of BOOST_ROOT in environment?

/ Johan


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: Errors when using target references to boost libraries

by Vladimir Prus :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday 04 September 2009 Bob Walters wrote:

> Johan Nilsson wrote:
> > > My goal is that using those targets avoids any
> > > need to try to
> >
> > Try to ... what?
>
> Sorry: Another victim of loss-of-focus.  I'm trying to avoid putting
> any specific library
> names in the Jamfile in order to keep it OS/variant/architecture neutral.
>
> I've tried the approach you suggested, on windows.  I'm still getting
> an odd problem - apparently
> with finding the aliases. (filesystem was the first alias in the
> library list when I ran this bjam):
>
> *** argument error
> * rule project.find ( name : current-location )
> * called with: ( filesystem :  )

Hi Bob,

can you post a minimal Jamfile reproducing the problem? Please
also post output with "--debug-loading" command line option, and
tell the absolute path where your Jamroot is located.

Thanks,
Volodya
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: Errors when using target references to boost libraries

by Bob Walters-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Sep 14, 2009 at 5:21 AM, Vladimir Prus <ghost@...> wrote:
> can you post a minimal Jamfile reproducing the problem? Please
> also post output with "--debug-loading" command line option, and
> tell the absolute path where your Jamroot is located.

I think this may have been a false alarm.  I've been kicking off bjam
from the eclipse CDT as my configured build step.  After trying this
from a raw windows cmd shell, the problem went away.  I don't
understand why yet, probably some unexpected interaction with cygwin,
but this obviously not a problem for this group.

Thanks to everyone who responded.
- Bob
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: Errors when using target references to boostlibraries

by Johan Nilsson-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bob Walters wrote:

> On Mon, Sep 14, 2009 at 5:21 AM, Vladimir Prus <ghost@...>
> wrote:
>> can you post a minimal Jamfile reproducing the problem? Please
>> also post output with "--debug-loading" command line option, and
>> tell the absolute path where your Jamroot is located.
>
> I think this may have been a false alarm.  I've been kicking off bjam
> from the eclipse CDT as my configured build step.  After trying this
> from a raw windows cmd shell, the problem went away.  I don't
> understand why yet, probably some unexpected interaction with cygwin,
> but this obviously not a problem for this group.

Ahh, didn't see this before replying to your other post.

Could it then have been the "C:\c++" vs "C:\C++" difference that I mentioned
in my other reply?

/ Johan


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build