Need linking help for boost::filesystem
I'd like to play with boost::filesystem, and this turns out to be the first boost library I've tried to use that requires that I build something first. I downloaded bjam, and it appears that I have successfully built filesystem libraries for the compilers I care about (VC6, VC7.1, gcc, and como), because there is a subdirectory for each of them under the libboost_filesystem.lib directory, and each subdirectory, if you push down far enough, has .obj files under both debug and release. But I can't get anything to link. I can get the sample filesystem app (simple_ls.cpp) to compile cleanly under all compilers, but nothing will link. It seems clear that I somehow need to tell the linker where to find the appropriate filesystem libraries, but I'm not sure where to point it. Help? I'm running Windows 2000. Thanks, Scott
Hi, On Dienstag, 9. Dezember 2003 20:11, Scott Meyers wrote:
if you push down far enough, has .obj files under both debug and release.
I guess there went something wrong during the build, because you should see some .lib files which are the ones to link against. HIH Uwe
On Tue, 9 Dec 2003 20:58:30 +0100, Uwe Sander wrote:
I guess there went something wrong during the build, because you should see some .lib files which are the ones to link against.
Any idea where to start debugging? If I now give this command, D:\C++\Boost\Current>..\bjam.exe "-sTOOLS=gcc" I get this output: --------------------------------------------------------------------- skipping Boost.Python library build due to missing or incorrect configuration couldn't find Python.h in "/cygwin//usr/local/pydebug/include/python2.2 /cygwin//usr/local/pydebug/include/python2.2 /cygwin//usr/include/python2 .2 /cygwin//usr/include/python2.2 /usr/local/pydebug/include/python2.2 /usr/local/pydebug/include/python2.2 /usr/include/python2.2 /usr/include/p ython2.2 /usr/include" You can configure the location of your python installation by setting: PYTHON_ROOT - currently "/usr" PYTHON_VERSION - The 2-part python Major.Minor version number (e.g. "2.2", NOT "2.2.1") - currently "2.2" The following are automatically configured from PYTHON_ROOT if not otherwise set: PYTHON_LIB_PATH - path to Python library object; currently "/usr/libs" For detailed configuration of Boost.Python for Cygwin GCC under Windows NT please see http://www.boost.org/libs/python/doc/building.html --------------------------------------------------------------------- ...found 2012 targets... Notice that it doesn't seem to actually build anything. I assume that this is because it's detecting that everything is already built, but I don't know. Thanks, Scott
Scott Meyers
Any idea where to start debugging? If I now give this command,
D:\C++\Boost\Current>..\bjam.exe "-sTOOLS=gcc"
1. The release version doesn't seem to have proper support for building DLLs according to http://sourceforge.net/tracker/index.php?func=detail&aid=852942&group_id=7586&atid=207586, and it's not clear from Beman's comment that it supports GCC on windows Date: 2003-12-02 20:21 Sender: beman_dawes Logged In: YES user_id=51042 Are you running one of the release versions, or from the CVS? The release versions link OK with VC++ 6.0, 7.0, and 7.1, but had no declspec support. The CVS version should be more flexible, but the changes are recent so make sure you are up to date. You might try a CVS snapshot (http://www.boost-consulting.com/boost.tar.bz2) if that's what you want. 2. Try going into the libs/filesystem/test subdirectory of your Boost tree and invoking bjam -d+2 -sTOOLS=<whatever> there. If tests build and run you'll know that things are working; the "-d+2" part will also show you the commands that were used to link to the FS library so you can replicate them yourself as neccessary. HTH, -- Dave Abrahams Boost Consulting www.boost-consulting.com
On Tuesday 09 December 2003 04:04 pm, David Abrahams wrote: Beman>The CVS version should be more flexible, but the changes are recent Beman> so make sure you are up to date. This point should really be amplified: John Maddock contributed an excellent system to make linking against Boost libraries much easier. If you're using CVS, you need only add the Boost stage library directory to your linking paths and most of the Wintel compilers will pick up the right library automatically. Doug
At 02:11 PM 12/9/2003, Scott Meyers wrote:
I'd like to play with boost::filesystem, and this turns out to be the first boost library I've tried to use that requires that I build something first. I downloaded bjam, and it appears that I have successfully built filesystem libraries for the compilers I care about (VC6, VC7.1, gcc, and como), because there is a subdirectory for each of them under the libboost_filesystem.lib directory, and each subdirectory, if you push down far enough, has .obj files under both debug and release.
But I can't get anything to link. I can get the sample filesystem app (simple_ls.cpp) to compile cleanly under all compilers, but nothing will link. It seems clear that I somehow need to tell the linker where to find the appropriate filesystem libraries, but I'm not sure where to point it. Help?
I'm running Windows 2000.
Here is a gcc command that works for me (after the libraries have been built): g++ -Wall -ftemplate-depth-100 -g -O0 -fno-inline -I "C:\boost\site" -o simple_ls.exe C:/boost/site/libs/filesystem/example/simple_ls.cpp d:\boost-regr\bin\boost\libs\filesystem\build\libboost_filesystem.lib\gcc\debug\libboost_filesystem-gcc-d-1_31.lib This is based on my machine's paths, and the latest Boost CVS. You may have to adjust paths or library name according to your machine and which release you have. If you are just fooling around, it is also easy just to include each of the boost-root/libs/filesystem/src .cpp files in your compile. On a modern machine, it doesn't take long. Or create an IDE workspace/solution/project to build the library, and then make it a dependency of your program. HTH, --Beman
On Tue, 09 Dec 2003 18:59:40 -0500, Beman Dawes wrote:
Here is a gcc command that works for me (after the libraries have been built):
Thanks for the help. The following works for me:
set BOOST_FILESYSTEM_LIB=D:\C++\Boost\Current\libs\filesystem\build\bin\libboost_filesystem.lib
\gcc\debug\runtime-link-dynamic\libboost_filesystem.lib
g++ -Id:\C++\Boost\Current -o simple_ls.exe simple_ls.cpp %BOOST_FILESYSTEM_LIB%
Unfortunately, I haven't been able to find a way to make it work for VC7.1.
This is my most recent effort:
set BOOST_FILESYSTEM_LIB=D:\C++\Boost\Current\libs\filesystem\build\bin\libboost_filesystem.lib
\vc7\debug\runtime-link-dynamic\libboost_filesystem.lib
cl /TP /W4 /WL /GX /GR -ID:\C++\Boost\Current simple_ls.cpp /link /defaultlib:%
BOOST_FILESYSTEM_LIB%
This elicits multiply-defined symbols errors:
simple_ls.cpp
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
/out:simple_ls.exe
/defaultlib:D:\C++\Boost\Current\libs\filesystem\build\bin\libboost_filesystem.lib\vc7\debug
\runtime-link-dynamic\libboost_filesystem.lib
simple_ls.obj
msvcprtd.lib(MSVCP71D.dll) : error LNK2005: "public: char const & __thiscall std::basic_string
Hello, as i had some similar problems where to find built libraries, but on Unix/Linux/Cygwin, i used the attached Makefile-patch with version 1.30.2 to get all built libraries into a better-defined location, as some of the libs already get there: libs/<name>/build/bin-stage/libboost_<name>.* for the normal libs, libs/<name>/build/bin-stage/libboost_<name>_debug.* for the debug-libs. Then, i put some softlinks into my /usr/local/lib using just simple ln -s <boost>/libs/*/build/bin-stage/libboost_* /usr/local/lib/ and i got the headers known to the compiler with ln -s <boost>/boost /usr/local/include/ Actually i don't know why the location of some of the built libs were already put into its build/bin-stage, and others were not, nor which location would be the right one. However, as i've seen you're not really happy with jam, just to mention: have you ever seen confix.sourceforge.net ? Thanks, haubi Scott Meyers wrote:
On Tue, 09 Dec 2003 18:59:40 -0500, Beman Dawes wrote:
Here is a gcc command that works for me (after the libraries have been built):
Thanks for the help. The following works for me:
set BOOST_FILESYSTEM_LIB=D:\C++\Boost\Current\libs\filesystem\build\bin\libboost_filesystem.lib \gcc\debug\runtime-link-dynamic\libboost_filesystem.lib g++ -Id:\C++\Boost\Current -o simple_ls.exe simple_ls.cpp %BOOST_FILESYSTEM_LIB%
Unfortunately, I haven't been able to find a way to make it work for VC7.1. This is my most recent effort:
set BOOST_FILESYSTEM_LIB=D:\C++\Boost\Current\libs\filesystem\build\bin\libboost_filesystem.lib \vc7\debug\runtime-link-dynamic\libboost_filesystem.lib cl /TP /W4 /WL /GX /GR -ID:\C++\Boost\Current simple_ls.cpp /link /defaultlib:% BOOST_FILESYSTEM_LIB%
This elicits multiply-defined symbols errors:
simple_ls.cpp Microsoft (R) Incremental Linker Version 7.10.3077 Copyright (C) Microsoft Corporation. All rights reserved.
/out:simple_ls.exe /defaultlib:D:\C++\Boost\Current\libs\filesystem\build\bin\libboost_filesystem.lib\vc7\debug \runtime-link-dynamic\libboost_filesystem.lib simple_ls.obj msvcprtd.lib(MSVCP71D.dll) : error LNK2005: "public: char const & __thiscall std::basic_string
::operator[](unsigned int)const " (??A?$basic_string@DU?$char_traits@D@std@@V? $allocator@D@2@@std@@QBEABDI@Z) already defined in sim ple_ls.obj ... [Many more LNK2005 errors removed] ... LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library simple_ls.exe : fatal error LNK1169: one or more multiply defined symbols found I expect that I can figure out the LNK4098 warning myself, but I'm not sure what to do about the LNK2005s. For that matter, I'm not sure if I've formed the command line correctly for what I want to do. My attempts to decipher the documentation for the command line compiler and linker and interactions thereof have been in vain. Does anybody happen to know what the right invocation is? If not, that's fine, I can post elsewhere, as this is really an MSVC question, not a Boost question.
Thanks,
Scott
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Michael Haubenwallner SALOMON Automation GmbH Forschung & Entwicklung A-8114 Friesach bei Graz T +43 3127 200 308 F +43 3127 200 22 mailto:michael.haubenwallner@salomon.at http://www.salomon.at diff -ru boost-1.30.2/libs/date_time/build/Jamfile boost-1.30.2-sa1/libs/date_time/build/Jamfile --- boost-1.30.2/libs/date_time/build/Jamfile Sun Jan 19 23:31:56 2003 +++ boost-1.30.2-sa1/libs/date_time/build/Jamfile Wed Sep 24 13:05:46 2003 @@ -36,3 +36,12 @@ : debug release ; +stage bin-stage : <lib>boost_date_time <dll>boost_date_time + : + <tag><debug>"_debug" + : + debug release + ; + + + diff -ru boost-1.30.2/libs/filesystem/build/Jamfile boost-1.30.2-sa1/libs/filesystem/build/Jamfile --- boost-1.30.2/libs/filesystem/build/Jamfile Mon Mar 17 16:30:30 2003 +++ boost-1.30.2-sa1/libs/filesystem/build/Jamfile Wed Sep 24 13:05:41 2003 @@ -7,4 +7,14 @@ lib boost_filesystem : ../src/$(SOURCES).cpp : <include>$(BOOST_ROOT) <sysinclude>$(BOOST_ROOT) : debug release - ; \ No newline at end of file + ; + +stage bin-stage : <lib>boost_filesystem + : + <tag><debug>"_debug" + : + debug release + ; + + + diff -ru boost-1.30.2/libs/graph/build/Jamfile boost-1.30.2-sa1/libs/graph/build/Jamfile --- boost-1.30.2/libs/graph/build/Jamfile Tue May 21 18:22:36 2002 +++ boost-1.30.2-sa1/libs/graph/build/Jamfile Wed Sep 24 13:06:15 2003 @@ -8,3 +8,13 @@ : <sysinclude>$(BOOST_ROOT) : debug <inlining>on #inlining prevents linker name clashes due to truncation! ; + +stage bin-stage : <lib>libbgl-viz + : + <tag><debug>"_debug" + : + debug release + ; + + + diff -ru boost-1.30.2/libs/signals/build/Jamfile boost-1.30.2-sa1/libs/signals/build/Jamfile --- boost-1.30.2/libs/signals/build/Jamfile Fri Feb 14 18:31:04 2003 +++ boost-1.30.2-sa1/libs/signals/build/Jamfile Wed Sep 24 13:04:39 2003 @@ -22,3 +22,13 @@ : <sysinclude>$(BOOST_ROOT) <define>BOOST_SIGNALS_STATIC_LINK : debug release ; + +stage bin-stage : <lib>boost_signals <dll>boost_signals + : + <tag><debug>"_debug" + : + debug release + ; + + + diff -ru boost-1.30.2/libs/thread/build/Jamfile boost-1.30.2-sa1/libs/thread/build/Jamfile --- boost-1.30.2/libs/thread/build/Jamfile Fri Jan 24 00:23:07 2003 +++ boost-1.30.2-sa1/libs/thread/build/Jamfile Wed Sep 24 13:07:12 2003 @@ -47,7 +47,7 @@ stage bin-stage : <dll>boost_thread : #<tag><runtime-link-static>"s" - <tag><debug>"d" + <tag><debug>"_debug" : debug release ; }
At 10:48 PM 12/9/2003, Scott Meyers wrote:
Unfortunately, I haven't been able to find a way to make it work for VC7.1. This is my most recent effort:
set BOOST_FILESYSTEM_LIB=D:\C++\Boost\Current\libs\filesystem\build\bin\libboost _filesystem.lib \vc7\debug\runtime-link-dynamic\libboost_filesystem.lib cl /TP /W4 /WL /GX /GR -ID:\C++\Boost\Current simple_ls.cpp /link /defaultlib:% BOOST_FILESYSTEM_LIB%
Try a slight variation: cl /TP /W4 /WL /GX /GR -ID:\C++\Boost\Current simple_ls.cpp %BOOST_FILESYSTEM_LIB% (That's all on the same line, of course.) Please note that we are close to release 1.31.0, and it will have much improved library auto-linking for VC++ and some other Win32 compilers. The library names for all compilers will change, however, so don't cast anything in concrete that depends on the current names. --Beman
Try a slight variation:
cl /TP /W4 /WL /GX /GR -ID:\C++\Boost\Current simple_ls.cpp %BOOST_FILESYSTEM_LIB%
Alas, that doesn't help. I still get multiply defined symbols. This is with 1.30.2. Is there any reason to expect that the problem will magically go away if the get the CVS version?
Please note that we are close to release 1.31.0, and it will have much improved library auto-linking for VC++ and some other Win32 compilers. The library names for all compilers will change, however, so don't cast anything in concrete that depends on the current names.
Thanks for the heads-up. Scott
At 02:13 PM 12/10/2003, Scott Meyers wrote:
Try a slight variation:
cl /TP /W4 /WL /GX /GR -ID:\C++\Boost\Current simple_ls.cpp %BOOST_FILESYSTEM_LIB%
Alas, that doesn't help. I still get multiply defined symbols. This is with 1.30.2. Is there any reason to expect that the problem will magically go away if the get the CVS version?
Hard to say - I've never seen the problem before. The usual foul-ups produce undefined symbols rather than multiply defined symbols. There are real advantages to the CVS version of Boost in general and Filesystem in particular: lots of improvements and bug fixes, plus better "getting started" documentation and procedures. Also, since the CVS version is what most Boost developers have installed on their machines, answers to questions might be more on target. --Beman
There are real advantages to the CVS version of Boost in general and Filesystem in particular: lots of improvements and bug fixes, plus better "getting started" documentation and procedures.
I'd like to give the CVS version a try, but I'm not sure how to do it. I was hoping I could just download a zip or tar file or something, but that seems not to be the case. Boost mentions access via CVS client or web browser. Because I'm lazy and don't feel like learning more new software right now (i.e., a CVS client), I tried the web browser approach, but I don't know what to do once I get to http://cvs.sourceforge.net/viewcvs.py/boost/boost/ to download the libraries. Am I just overlooking something really obvious? Thanks, Scott
On Thursday 11 December 2003 11:50 pm, Scott Meyers wrote:
There are real advantages to the CVS version of Boost in general and Filesystem in particular: lots of improvements and bug fixes, plus better "getting started" documentation and procedures.
I'd like to give the CVS version a try, but I'm not sure how to do it. I was hoping I could just download a zip or tar file or something, but that seems not to be the case. Boost mentions access via CVS client or web browser. Because I'm lazy and don't feel like learning more new software right now (i.e., a CVS client), I tried the web browser approach, but I don't know what to do once I get to http://cvs.sourceforge.net/viewcvs.py/boost/boost/ to download the libraries. Am I just overlooking something really obvious?
There's a tarball of Boost CVS here (built hourly, I think): http://www.boost-consulting.com/boost.tar.bz2 Doug
Douglas Gregor wrote:
On Thursday 11 December 2003 11:50 pm, Scott Meyers wrote:
There are real advantages to the CVS version of Boost in general and Filesystem in particular: lots of improvements and bug fixes, plus better "getting started" documentation and procedures.
I'd like to give the CVS version a try, but I'm not sure how to do it. ... Am I just overlooking something really obvious?
There's a tarball of Boost CVS here (built hourly, I think): http://www.boost-consulting.com/boost.tar.bz2
Although cvs is a bit daunting at first, you don't really need to learn much. And it's worth having on your computer if you want to try cutting edge code from open or free source projects. If you're on Windows and have cygwin installed, cvs is one of the optional packages that you can install. Otherwise, you can just download the command-line version from http://ftp.cvshome.org/release/binary/win32/ and follow the instructions on http://www.boost.org/more/download.html I'm not sure what the status of the official CVS repository is, but I've always had better luck using the boost-consulting.com mirror. Also, although I also like using the CVS version, because it has all the latest improvements that I desperately want, it does occasionally fall into a temporary state of disrepair, which can be a bit aggravating.
Scott, Karl Fogel was kind enough to make the CVS parts of his book "Open Source Development with CVS" (http://cvsbook.red-bean.com/cvsbook.html) available on the web. It is quite good, though I have found a few mistakes. The Cederqvist manual (http://www.cvshome.org/docs/manual/) is also available. -d Deane Yang wrote:
Douglas Gregor wrote:
On Thursday 11 December 2003 11:50 pm, Scott Meyers wrote:
There are real advantages to the CVS version of Boost in general and Filesystem in particular: lots of improvements and bug fixes, plus better "getting started" documentation and procedures.
I'd like to give the CVS version a try, but I'm not sure how to do it.
...
Am I just overlooking something really obvious?
There's a tarball of Boost CVS here (built hourly, I think): http://www.boost-consulting.com/boost.tar.bz2
Although cvs is a bit daunting at first, you don't really need to learn much. And it's worth having on your computer if you want to try cutting edge code from open or free source projects.
If you're on Windows and have cygwin installed, cvs is one of the optional packages that you can install. Otherwise, you can just download the command-line version from http://ftp.cvshome.org/release/binary/win32/ and follow the instructions on http://www.boost.org/more/download.html
I'm not sure what the status of the official CVS repository is, but I've always had better luck using the boost-consulting.com mirror.
Also, although I also like using the CVS version, because it has all the latest improvements that I desperately want, it does occasionally fall into a temporary state of disrepair, which can be a bit aggravating.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Alas, that doesn't help. I still get multiply defined symbols. This is with 1.30.2. Is there any reason to expect that the problem will magically go away if the get the CVS version?
What symbols? If these are C runtime symbols then it's because the lib build variant you are linking against in binary incompatible with your build options (you're mixing two different runtimes). John.
participants (10)
-
Beman Dawes
-
David Abrahams
-
David Ohlemacher
-
Deane Yang
-
Douglas Gregor
-
John Maddock
-
Michael Haubenwallner
-
Scott Meyers
-
Scott Meyers
-
Uwe Sander