|
Boost-Build : |
From: Vadim Mikhailov (bjam_at_[hidden])
Date: 2007-02-08 20:25:34
Hi, fellow boost builders!
I using bjam v. 3.1.13 NT, boost.build v. 2.0-m11, msvc-8.0 sp1.
I need to do something like this and can't seem to figure out how:
lib library : library.cpp debug.cpp ;
exe program : program.cpp debug.cpp library ;
In other words, I have DLL called "library" which exports few
functions, but also compiles in some service module (debug.cpp in this
case). Another "program" needs to use functions exported by "library",
but also needs to compile in copy of its own debug.cpp.
(making debug.cpp to export its functions via library.DLL is not
acceptable for many reasons). Unfortunately, this always gives me
duplicate target errors - when I try to build it using bjam, I get this:
C:/Boost/boost-build/build\virtual-target.jam:976: in
virtual-target.register-actual-name from module virtual-target
error: Duplicate name of actual target: <pbin\msvc-8.0\debug>debug.obj
error: previous virtual target { msvc%msvc.compile.c++-debug.obj.OBJ {
debug.cpp.CPP } }
error: created from ./library
error: another virtual target { msvc%msvc.compile.c++-debug.obj.OBJ {
debug.cpp.CPP } }
error: created from ./program
error: added properties: <dll-path>/C:/test/bin/msvc-8.0/debug
<main-target-type>EXE <xdll-path>/C:/test/bin/msvc-8.0/debug
error: removed properties: <main-target-type>LIB
C:/Boost/boost-build/build\virtual-target.jam:450: in
actualize-no-scanner from module object(file-target)@70
C:/Boost/boost-build/build\virtual-target.jam:110: in
object(file-target)@70.actualize from module object(file-target)@70
C:/Boost/boost-build/build\virtual-target.jam:723: in
actualize-source-type from module object(action)@71
C:/Boost/boost-build/build\virtual-target.jam:744: in actualize-sources
from module object(action)@71
C:/Boost/boost-build/build\virtual-target.jam:689: in
object(action)@71.actualize from module object(action)@71
C:/Boost/boost-build/build\virtual-target.jam:273: in actualize-action
from module object(file-target)@72
C:/Boost/boost-build/build\virtual-target.jam:458: in
actualize-no-scanner from module object(file-target)@72
C:/Boost/boost-build/build\virtual-target.jam:110: in
object(file-target)@72.actualize from module object(file-target)@72
C:/Boost/boost-build\build-system.jam:372: in load from module build-system
C:\Boost\boost-build/kernel\modules.jam:261: in import from module modules
C:\Boost\boost-build/kernel/bootstrap.jam:132: in boost-build from module
C:\Boost\boost-build\boost-build.jam:1: in module scope from module
I am aware of this FAQ item:
http://www.boost.org/doc/html/bbv2/faq.html#id2861593, but it only talks
about two executables partially derived from the same source files.
My trouble is that my target types are different - one is DLL, another
is EXE.
I tried to play with making object file local to main target (solution
3), but I just couldn't make it work.
Actually, in reality I need more than one extra file to be compiled
multiple times, but I guess I should make it work one first.
Does anyone know how to get past this? It is really a big bummer for me :-(
I have created small testcase which shows the problem
(inline here and also as an attachment):
// debug.cpp contents:
#include <stdio.h>
void debug(char* string) {
printf(string);
}
// debug.h contents:
void debug(char* string);
#// Jamroot contents:
lib library : library.cpp debug.cpp ;
exe program : program.cpp library ;
// library.cpp contents:
#include "debug.h"
_declspec(dllexport) int __stdcall libfoo() {
debug("In libfoo\n");
return 100;
}
// library.h contents:
_declspec(dllexport) int __stdcall libfoo();
// program.cpp contents:
#include "library.h"
#include "debug.h"
int main() {
debug("In main\n");
libfoo();
return 0;
}
Vadim.
C:/Boost/boost-build/build\virtual-target.jam:976: in virtual-target.register-actual-name from module virtual-target
error: Duplicate name of actual target: <pbin\msvc-8.0\debug>debug.obj
error: previous virtual target { msvc%msvc.compile.c++-debug.obj.OBJ { debug.cpp.CPP } }
error: created from ./library
error: another virtual target { msvc%msvc.compile.c++-debug.obj.OBJ { debug.cpp.CPP } }
error: created from ./program
error: added properties: <dll-path>/C:/test/bin/msvc-8.0/debug <main-target-type>EXE <xdll-path>/C:/test/bin/msvc-8.0/debug
error: removed properties: <main-target-type>LIB
C:/Boost/boost-build/build\virtual-target.jam:450: in actualize-no-scanner from module object(file-target)@70
C:/Boost/boost-build/build\virtual-target.jam:110: in object(file-target)@70.actualize from module object(file-target)@70
C:/Boost/boost-build/build\virtual-target.jam:723: in actualize-source-type from module object(action)@71
C:/Boost/boost-build/build\virtual-target.jam:744: in actualize-sources from module object(action)@71
C:/Boost/boost-build/build\virtual-target.jam:689: in object(action)@71.actualize from module object(action)@71
C:/Boost/boost-build/build\virtual-target.jam:273: in actualize-action from module object(file-target)@72
C:/Boost/boost-build/build\virtual-target.jam:458: in actualize-no-scanner from module object(file-target)@72
C:/Boost/boost-build/build\virtual-target.jam:110: in object(file-target)@72.actualize from module object(file-target)@72
C:/Boost/boost-build\build-system.jam:372: in load from module build-system
C:\Boost\boost-build/kernel\modules.jam:261: in import from module modules
C:\Boost\boost-build/kernel/bootstrap.jam:132: in boost-build from module
C:\Boost\boost-build\boost-build.jam:1: in module scope from module
// debug.cpp:
#include <stdio.h>
void debug(char* string) {
printf(string);
}
// debug.h:
void debug(char* string);
#// Jamroot:
lib library : library.cpp debug.cpp ;
exe program : program.cpp debug.cpp library ;
// library.cpp:
#include "debug.h"
_declspec(dllexport) int __stdcall
libfoo() {
debug("In libfoo\n");
return 100;
}
// library.h:
_declspec(dllexport) int __stdcall libfoo();
// program.cpp:
#include "library.h"
#include "debug.h"
int main() {
debug("In main\n");
libfoo();
return 0;
}
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