I am trying to build https://github.com/wallix/redemption, which uses bjam
. I don't really know bjam
(and I think, given that I already don't really know make
and cmake
, I don't really have that much space left in in my head for yet another build system language).
More specifically, I want to build projects/qtclient in there, as part of the main project; so that when I run tools/packager.py (which repeats the bjam
build process from scratch), i also get the qtclient
executable in the generated .deb
.
Note that, when I'm the root directory of the repository, for the main build, I can do:
redemption.git$ bjam exe libs
warning: No toolsets are configured.
warning: Configuring default toolset "gcc".
warning: If the default is wrong, your build may not work correctly.
warning: Use the "toolset=xxxxx" option to override our guess.
warning: For more configuration options, please consult
warning: http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html
...patience...
...found 2502 targets...
...updating 267 targets...
gcc.compile.c++ bin/gcc-9/debug/log.o
...
... and it works. If I try to build the projects/qtclient
from the same directory location, it fails:
redemption.git$ bjam projects/qtclient/
warning: No toolsets are configured.
warning: Configuring default toolset "gcc".
warning: If the default is wrong, your build may not work correctly.
warning: Use the "toolset=xxxxx" option to override our guess.
warning: For more configuration options, please consult
warning: http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html
redemption-src: /home/USER
/home/USER/jam/redemption-config.jam: No such file or directory
/home/USER/jam/defines.jam: No such file or directory
Assume Qt5. (bjam -s qt5)
projects/qtclient/Jamroot:48: in modules.load
ERROR: rule "setvar" unknown in module "Jamfile</home/USER/src/redemption_git/projects/qtclient>".
/usr/share/boost-build/src/build/project.jam:372: in load-jamfile
/usr/share/boost-build/src/build/project.jam:64: in load
/usr/share/boost-build/src/build/project.jam:142: in project.find
/usr/share/boost-build/src/build/targets.jam:453: in find-really
/usr/share/boost-build/src/build/targets.jam:475: in class@project-target.find
/usr/share/boost-build/src/build-system.jam:724: in load
/usr/share/boost-build/src/kernel/modules.jam:295: in import
/usr/share/boost-build/src/kernel/bootstrap.jam:139: in boost-build
/usr/share/boost-build/boost-build.jam:8: in module scope
... but if I change directory to projects/qtclient
first, and call bjam qtclient
(or just bjam
) there, it works:
demption.git/projects/qtclient$ bjam qtclient
redemption-src: /home/USER/src/redemption_git
Assume Qt5. (bjam -s qt5)
warning: No toolsets are configured.
warning: Configuring default toolset "gcc".
warning: If the default is wrong, your build may not work correctly.
warning: Use the "toolset=xxxxx" option to override our guess.
warning: For more configuration options, please consult
warning: http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html
warning: non-free usage requirements <threading>multi ignored
warning: in main-target QtCore at Jamroot:146
...patience...
...found 2454 targets...
...updating 107 targets...
qt5.moc bin/gcc-9/release/src/qt_input_output_api/moc_qt_input_output_clipboard.cpp
...
gcc.link bin/gcc-9/release/qt5client
...updated 107 targets...
Right - so this shows me, that the error 'ERROR: rule "setvar" unknown in module "Jamfile</home/USER/src/redemption_git/projects/qtclient>".' is due to bjam
running in the "project root" directory, and not in the projects/qtclient
subdirectory.
So, now I try to integrate the build of projects/qtclient
inside the main Jamroot; I've tried adding qtclient
at end of alias exe
line (before the semicolon):
alias exe : rdpproxy rdpclient rdpinichecker qtclient;
Result: build does not even start:
redemption.git$ bjam libs exe
error: Unable to find file or target named
error: 'qtclient'
error: referred to from project at
error: '.'
And I've tried adding projects/qtclient
at end of alias exe
line :
alias exe : rdpproxy rdpclient rdpinichecker projects/qtclient;
Result: build starts, but fails as bjam
does not run in the project subdirectory (same error: 'ERROR: rule "setvar" unknown in module'):
redemption_git$ bjam libs exe
warning: No toolsets are configured.
...
/home/USER/jam/redemption-config.jam: No such file or directory
/home/USER/jam/defines.jam: No such file or directory
Assume Qt5. (bjam -s qt5)
projects/qtclient/Jamroot:48: in modules.load
ERROR: rule "setvar" unknown in module "Jamfile</home/USER/src/redemption_git/projects/qtclient>".
/usr/share/boost-build/src/build/project.jam:372: in load-jamfile
/usr/share/boost-build/src/build/project.jam:64: in load
...
As per Boost-build - dependency on subproject target I also tried modifying the code so it has this, while restoring the original alias exe
line:
import feature ;
feature.feature qtclient : : dependency free ;
project redemption
: requirements
$(REDEMPTION_CXXFLAGS)
$(REDEMPTION_FFMPEG_FLAGS)
$(REDEMPTION_BOOST_STACKTRACE_FLAGS)
$(GCOV)
<cxxflags>-fno-rtti
<toolset>gcc:<cxxflags>-pipe
# <cxx-lto-default>on
# <cxx-stack-protector-default>on # strong, all
# <cxxflags>-fpie
<qtclient>projects/qtclient//qtclient
: default-build release
;
...
alias exe : rdpproxy rdpclient rdpinichecker ;
... and again, build starts, but fails as bjam
does not run in the project subdirectory (same error: 'ERROR: rule "setvar" unknown in module'):
$ bjam libs exe
warning: No toolsets are configured.
...
redemption-src: /home/USER
/home/USER/jam/redemption-config.jam: No such file or directory
/home/USER/jam/defines.jam: No such file or directory
Assume Qt5. (bjam -s qt5)
/home/USER/src/redemption_git/projects/qtclient/Jamroot:48: in modules.load
ERROR: rule "setvar" unknown in module "Jamfile</home/USER/src/redemption_git/projects/qtclient>".
/usr/share/boost-build/src/build/project.jam:372: in load-jamfile
...
Also, as per How to build multiple targets with Boost and Jamroot? I've tried adding reference to projects/qtclient/Jamroot
at end of alias exe
line:
alias exe : rdpproxy rdpclient rdpinichecker projects/qtclient/Jamroot;
This actually runs and build completes without errors - however there is no mention of "qtclient" anywhere in the build log, and the corresponding executable does not get generated.
The same happens for build-project
that I got from bjam - how to always execute shell script before building a target?:
build-project projects/qtclient//qtclient ;
... or for
build-project projects/qtclient ;
I also tried to cheat and just call from the shell:
Echo [ SHELL "cd projects/qtclient; bjam release qtclient" ] ;
... this indeed builds qtclient - but then erases the build folder, before starting to build the main project :(
So - how do I have bjam
compile an extra project in a subfolder, as part of the main project, correctly (meaning that bjam
would change the current working directory to the subfolder, before attempting to build the extra project)?