Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Name Conflict when Building Boost libraries with Cygwin/GCC

I'm in the process of migrating a C++ application from VC++ to GCC (running on Windows using Cygwin). My first problem now is that I cannot build the Boost libraries.

For example to build Boost.Exception with VC++ I would write:

b2 --with-exception variant=debug,release link=static runtime-link=static

and I would get the files libboost_exception-vc100-mt-s-1_51.lib and libboost_exception-vc100-mt-sgd-1_51.lib in my stage\lib directory.

However when I try the same using GCC form a Cygwin terminal I get errors. I found out that building only debug (or only release) like this works:

./b2 --with-exception variant=debug link=static runtime-link=static

It creates libboost_exception.a in my stage\lib directory for both cases (debug and release). So there seems to be a name conflict (same name for debug and release variant). Is this a bug in the boost build system or am I doing something wrong?


Edit:

The output of

./b2 --with-exception variant=debug,release link=static runtime-link=static

is:

Building the Boost C++ Libraries.

/cygdrive/c/boost_1_51_0/tools/build/v2/build/virtual-target.jam:1079: in virtual-target.register-actual-name from module virtual-target

error: Duplicate name of actual target: libboost_exception.a

error: previous virtual target { common%common.copy-libboost_exception.a.STATIC_LIB { gcc%gcc.archive-libboost_exception.a.STATIC_LIB { gcc%gcc.compile.c++-clone_current_exception_non_intrusive.o.OBJ { clone_current_exception_non_intrusive.cpp.CPP } } } }

error: created from ./stage-proper error: another virtual target { common%common.copy-libboost_exception.a.STATIC_LIB { gcc%gcc.archive-libboost_exception.a.STATIC_LIB { gcc%gcc.compile.c++-clone_current_exception_non_intrusive.o.OBJ { clone_current_exception_non_intrusive.cpp.CPP } } } }

error: created from ./stage-proper

error: added properties: off NDEBUG full speed off release

error: removed properties: on off off on debug

/cygdrive/c/boost_1_51_0/tools/build/v2/build/virtual-target.jam:490: in actualize-no-scanner from module object(file-target)@1014

/cygdrive/c/boost_1_51_0/tools/build/v2/build/virtual-target.jam:135: in object(file-target)@1014.actualize from module object(file-target)@1014

/cygdrive/c/boost_1_51_0/tools/build/v2/build-system.jam:749: in load from module build-system

/cygdrive/c/boost_1_51_0/tools/build/v2/kernel/modules.jam:283: in import from module modules

/cygdrive/c/boost_1_51_0/tools/build/v2/kernel/bootstrap.jam:142: in boost-build from module

/cygdrive/c/boost_1_51_0/boost-build.jam:17: in module scope from module

like image 746
Robert Hegner Avatar asked Aug 28 '12 14:08

Robert Hegner


1 Answers

Although the error message is not perfect, this is operator error. By default, the build uses system naming of library -- the naming you would have on your typical Unix system. So, yea, if you try to build both debug and release variant, you get naming clash.

If you add --layout=tagged or --layout=versioned to your command line, things should work. You can run "./b2 --help" from the top directory to get some explanation for these mean.

like image 200
Vladimir Prus Avatar answered Sep 22 '22 21:09

Vladimir Prus