|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
Using boost libraries on Ubuntu through Boost.BuildI have installed all Boost 1.34.1 packages on an Ubuntu system,
including bjam and Boost.Build (2.0m11). Getting the most simple example from http://boost.org/boost-build2/doc/html/bbv2/tutorial.html#bbv2.tutorial.hello to work is a no-brainer. But now I want this example to use for example the Boost.Filesystem library. What is the proper way to do this on a system like Ubuntu where there is no Boost root but instead just installed headers and libraries? Can anyone show a minimal Jamroot that depends on a boost library? Sorry for the noob questions but the lack of documentation for Boost.Build makes it really difficult to do these trivial things. S. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build |
|
|
Re: Using boost libraries on Ubuntu through Boost.Build Hi Stefan.
> I have installed all Boost 1.34.1 packages on an Ubuntu system, > including bjam and Boost.Build (2.0m11). Pretty much an ancient version by now. I'd suggest getting at m12 (or the trunk directly from SVN), but that one should work with what you're trying to do. > But now I want this example to use for example the Boost.Filesystem library. > > What is the proper way to do this on a system like Ubuntu where there > is no Boost root but instead just installed headers and libraries? Sorry, do not have the time to construct an explicit example for you now... If you have the Boost Filesystem build set up using Boost Build then you can connect your project to that one (use-project or use or some rule like that - do not remember exactly but is documented) and then simply reference targets from that project using the project//target syntax. If all you have are pre-built headers and libraries then you can simply add the header location to your include path (e.g as a re requirement in your project rule) and you can declare your own library targets (using the lib rule - without any sources specified, just name of the file) representing pre-built Boost Filesystem libraries. There are examples for both of this the docs. Examples: Setting up the include path: project MyProject : requirements <include>$(PROJECT_SOURCES) <include>$(BOOST_BASE)/$(BOOST_VERSION) ; Declaring a per-built library target: lib eaylib_static_rtlStatic : : <file>$(OPENSSL_LIBS)/libcrypto.a ; Hope this helps. Best regards, Jurko Gospodnetić _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build |
|
|
Re: Using boost libraries on Ubuntu through Boost.BuildHi Stefan,
On 06/02/2008, Stefan Arentz <stefan.arentz@...> wrote:
... Have a look at the bottom of this post, I think it shows what you're looking for. It's not specific to Ubuntu, but I use it there without any problems. -- Darren _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build |
|
|
Re: Using boost libraries on Ubuntu through Boost.BuildOn 08/02/2008, Darren Garvey <darren.garvey@...> wrote: Hi Stefan, Oops, forgot to add the link: http://tinyurl.com/yvkor4 !!
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build |
|
|
Re: Using boost libraries on Ubuntu through Boost.BuildOn Feb 8, 2008 3:01 PM, Darren Garvey <darren.garvey@...> wrote:
> Hi Stefan, > > On 06/02/2008, Stefan Arentz <stefan.arentz@...> wrote: > > ... > > > > But now I want this example to use for example the Boost.Filesystem > library. > > > > What is the proper way to do this on a system like Ubuntu where there > > is no Boost root but instead just installed headers and libraries? > > > > Can anyone show a minimal Jamroot that depends on a boost library? > > Have a look at the bottom of this post, I think it shows what you're looking > for. It's not specific to Ubuntu, but I use it there without any problems. Thanks Darren and Jurko. This works, but I wonder if it is the best way to go for me now. The problem is that I want to build this project on both OS X and Linux and the libraries are in different locations and even have slightly different names I think. If my app is just dependent on Boost stuff, would it make more sense to stop using the distribution-provided packages and instead just build Boost manually? Or even include it's source in my project? Am I correct that I can simply reference boost as a dependent project and that bjam will build the parts that I need as part of building my app? I guess that is more elegant. Is it good practice to go that route? S. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build |
|
|
Re: Using boost libraries on Ubuntu through Boost.Build Hi Stefan.
> This works, but I wonder if it is the best way to go for me now. The > problem is that I want to build this project on both OS X and Linux > and the libraries are in different locations and even have slightly > different names I think. There is no problem with configuring Boost Build to look for different library names based on different OSs or based on any other feature for that matter. Here's an example: lib acessllib_static_rtlStatic : : <name>ACE_SSL <toolset>gcc <search>$(ACE_ROOT)/lib ; lib acessllib_static_rtlStatic : : <name>ACE_SSLsd <toolset>msvc <variant>debug <search>$(ACE_ROOT)/lib ; lib acessllib_static_rtlStatic : : <name>ACE_SSLs <toolset>msvc <variant>release <search>$(ACE_ROOT)/lib ; lib acessllib_static_rtlStatic : : <name>ACE_SSLs <toolset>msvc <variant>releaseWithAssert <search>$(ACE_ROOT)/lib ; It'll most likely come out split into multiple lines, but you should get the idea. This example specifies which exact library file to link to in case you want to link to the ACE SSL networking library built for static linking and with static runtime based on the current <toolset> and <variant> feature values. You can easily modify (specialize) it to work differently based on the <os> feature. > If my app is just dependent on Boost stuff, would it make more sense > to stop using the distribution-provided packages and instead just > build Boost manually? Or even include it's source in my project? It is your choice but using Boost Build to automate your project's build should have absolutely no impact on that decision. Whichever way you decide to go, Boost Build can be configured to go with you. :-) My 'generic' suggestion would be not to include Boost sources in your project and to use a pre-built boost distribution if possible. If you need the Boost library's build system customized you can easily build Boost from its sources yourself and that should make no difference to your project's build system other than possibly causing you to redirect it to a different place to take Boost libraries/sources from. > Am I correct that I can simply reference boost as a dependent project > and that bjam will build the parts that I need as part of building my > app? > > I guess that is more elegant. Is it good practice to go that route? If you build the Boost library from its sources you can also make your project's build use the Boost library's Boost Build targets but I would not recommend this as your first choice. This becomes useful when you want to tweak the Boost library code but it also couples you to the Boost library's build system and gets you more opportunity for things breaking with the next Boost library release. On a related note, Boost libraries provide auto-linking features which work great on platforms on which they are available, e.g. msvc (unfortunately, gcc is not one of them :-(). When you use them you do not have to specify explicitly which Boost library (based for example on whether you are building a debug or release variant of your project or whether you are using statically or dynamically linked run-time library) to link to as it already knows which one it needs and all you need to do is provide it with the folder in which to search for the libraries it needs. Hope this helps. Best regards, Jurko Gospodnetić _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build |
|
|
Re: Using boost libraries on Ubuntu through Boost.Build
Hi Stefan,
Wha we usualy do is the following: - add a reference to the boost root in your projects root after that you can refer to anything in boost in your own project. example: a directory structure: $HOME/test /src /boost_1_34_1 1) the test dir will have 3 files: project-root.jam, boost-build.jam and jamfile jamfile - you can use it to define all kinds of shared settings, in it you will see something like: use-project /boost : $(ROOT)/boost_1_34_1 ; project test : requirements <use>/boost # all your defines & stuff for the platforms you need : default-build debug <link>shared <threading>multi <runtime-debugging>on <runtime-link>shared ; project-root.jam - used to set your $ROOT (and possibly other globals/constants): path-constant ROOT : . ; boost-build.jam - where the boost-build engine stuff lives (compiler settings, tools etc): if $(JAM_VERSION:J="") < 030114 { ECHO "error: Boost.Jam 3.1.14 or later required" ; EXIT ; } else { JAMFILE = [Jj]amfile ; boost-build boost_1_34_1/tools/build/v2 ; } probably this could be done simpeler, but it always worked so far so I never bothered :) 2) the src dir will also have a file called 'jamfile' and in it you can now refer to anything in boost: project src : source-location . : requirements : usage-requirements <include>. ; lib my_test : my_test.cpp /boost/filesystem ; run my_unit_test.cpp my_test /boost/test//boost_unit_test_framework ; this implies you install the source yourself on your own system (I never tried the packaged versions - they're ususally behind in release anyway); and by installing I mean, unzip/tar it somewhere, building is done autmatically when you refer from your own project (this works for any 3rd party stuff you need) we even put boost in our projects svn (direct or by svn:exernal) - so we control the version we work with, not the packagers :) it all kind of models a mount point with $ROOT as '/' - you can move/copy the whole test-dir anywhere on any platform (boost.build supports many) and building it will 'just work ... if you like it, I could send you a zip with a working setup? Dirk Stefan Arentz wrote: I have installed all Boost 1.34.1 packages on an Ubuntu system, including bjam and Boost.Build (2.0m11). Getting the most simple example from http://boost.org/boost-build2/doc/html/bbv2/tutorial.html#bbv2.tutorial.hello to work is a no-brainer. But now I want this example to use for example the Boost.Filesystem library. What is the proper way to do this on a system like Ubuntu where there is no Boost root but instead just installed headers and libraries? Can anyone show a minimal Jamroot that depends on a boost library? Sorry for the noob questions but the lack of documentation for Boost.Build makes it really difficult to do these trivial things. S. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build -- CodeShop BV www.code-shop.com +31 6 411 92 024 _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build |
| Free embeddable forum powered by Nabble | Forum Help |