Boost logo

Boost :

From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2023-11-16 16:25:15


On 11/16/23 19:02, Matthijs Möhlmann via Boost wrote:
> On 16/11/2023 16:50, Andrey Semashev via Boost wrote:
>> On 11/16/23 18:43, Matthijs Möhlmann via Boost wrote:
>>> On 16/11/2023 16:32, Andrey Semashev via Boost wrote:
>>>> On 11/16/23 18:28, Andrey Semashev wrote:
>>>>> As for a workaround, I suspect the problem can be worked around by
>>>>> manually adding linking with the standard library that defines those
>>>>> missing symbols. For example, `operator delete` is defined in
>>>>> libc++abi,
>>>>> so you may fix the problem by adding `linkflags=c++abi` to `b2`
>>>>> command
>>>>> line.
>>>> Sorry, the command line option should be `linkflags=-lc++abi`.
>>>>
>>> That didn't work either. Same error.
>> Do you mean the error still lists `operator delete` and similar core
>> language symbols as unresolved?
>>
>> If so then either the compiler is terminally broken, or there must be
>> some issue with your installation. Perhaps, inconsistent libc++abi
>> version?
>>
>> BTW, we do test clang-16 in CI, and it passes:
>>
>> https://github.com/boostorg/filesystem/actions/runs/6449121898
>>
>> so I'm leaning towards some installation or configuration issue.
>
> Gotcha, when adding the flags as follows: linkflags="-lc++ -ldc++abi" it
> works
> correctly and I have every library build on my system.

I'm assuming, you meant "-lc++abi" (note the missing "d").

> Then I guess it has to do with my library path. I have clang installed
> from the
> debian repository here:https://apt.llvm.org/

Yes, but note that there are different repositories for different Debian
and Ubuntu versions, and also for different clang major releases. When
you use those repositories, make sure you specify the correct versions
in the repository line, and also specify the version in the package
names. For example, for clang-16 you need to install clang-16,
libc++-16-dev and libc++abi-16-dev - all come from apt.llvm.org.

> I have an user-config.jam in the root of my home directory and it is as
> follows:
> import toolset : using ;
> using clang : 16 : clang-16 ;
>
> option jobs : 8 ;

Our user-config.jam should look like this:

using clang : : clang++-16 ;

See here for how it's composed:

https://github.com/boostorg/filesystem/blob/53eabaeabbf85fda2915a03612323df77fbaf23d/.github/workflows/ci.yml#L455-L460

Note that the compiler executable is clang++-16, not clang-16. The
former is a C++ compiler, the latter is C. Presumably, the C compiler
doesn't add C++ standard libraries to the linker. But I would also
expect it to fail to compile C++ code, or at least display some warning,
but maybe it doesn't.

Try changing to clang++-16 and compile without explicit `-lc++ -lc++abi`
flags.

> Maybe that interferes somehow with the ability to link to the correct
> library?
>
> I am not sure where to look further to have this resolved.

One last thing I'd like to note is that those `-lc++ -lc++abi` flags, if
you specify those, should come last in the linker command line, and in
that order. If you have multiple linker flags specified in the command
line, make sure these two come after any other libraries or object files.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk