bcp Issue: `--namespace` renames the namespace but NOT the library target name

Open
#27 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
cpp
Domain
build-system

Research direction

Start with bcp's library-prefix renaming logic and the generated libs/regex/build/Jamfile.v2 from the reproduction. Check how the modular lib boost_regex target is handled when using --namespace=myboost. Done means the target becomes lib myboost_regex and the build produces the expected libmyboost_regex.* artifacts.

Written by the indexing model from the issue text.

Description

Boost version: 1.90.0 (BOOST_VERSION 109000)
Tool: bcp (from dist/bin/bcp)
Platform: Linux x86_64, gcc-14, b2

Summary

bcp --namespace=myboost is documented to rename both the C++ boost
namespace and the binary library prefix. The namespace rename works, but the
Boost.Build library target name in libs/regex/build/Jamfile.v2 is left
unchanged (lib boost_regex). Consequently the built artifact is
libboost_regex.* instead of the expected libmyboost_regex.*.

Reproduction

ROOT=/path/to/boost
"$ROOT/dist/bin/bcp" \
  --boost="$ROOT" \
  --namespace=myboost --namespace-alias --unix-lines \
  regex config build assert concept_check preprocessor static_assert \
  type_traits core throw_exception predef \
  "$ROOT/.build"

cd "$ROOT/.build" && ./bootstrap.sh && ./b2 --with-regex -j4

Observed

Namespace rename — WORKS

Headers and sources are rewritten to namespace myboost, with a boost alias
inserted (from --namespace-alias):

// boost/assert.hpp
namespace myboost {} namespace boost = myboost; namespace myboost { ... }
Library target name — NOT renamed

.build/libs/regex/build/Jamfile.v2 still declares:

lib boost_regex : ../src/$(SOURCES) icu_options ...

(identical to the original — the boost_regex target name was not rewritten to
myboost_regex.)

Produced artifacts — wrong prefix
stage/lib/libboost_regex.so.1.90.0
stage/lib/libboost_regex.so
stage/lib/libboost_regex.a

Expected: libmyboost_regex.so.1.90.0, libmyboost_regex.so, libmyboost_regex.a.

Expected behaviour

Per bcp docs ("Also renames Boost binaries to use newname rather than boost
as a prefix"), the lib boost_regex target in the modular
libs/regex/build/Jamfile.v2 should be renamed to lib myboost_regex, so the
built library is libmyboost_regex.*.

Likely cause

In the modular (1.90) layout the library target is declared in
libs/regex/build/Jamfile.v2. bcp's library-prefix renaming logic does not
appear to rewrite the lib <name> target declaration in these modular build
Jamfiles.

Dominant language
C++
Stars
23
Forks
38
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/bcp

All issues in boostorg/bcp

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.