boostorg / boostorg/bcp

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

Open
#27 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
23
Forks
38
PR merge metrics
No merged PRs in 30d

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
```bash
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`):
```cpp
// boost/assert.hpp
namespace myboost {} namespace boost = myboost; namespace myboost { ... }
```

### Library target name — NOT renamed
`.build/libs/regex/build/Jamfile.v2` still declares:
```jam
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 ` target declaration in these modular build
Jamfiles.

Contributor guide

No contributing guide indexed for this repository

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.