Closed mborland closed 1 month ago
Can you try adding
-L"$(brew --prefix llvm)/lib/c++" -L"$(brew --prefix llvm)/lib" -lunwind
to cxxflags
when building to see if it helps?
Can you try adding
-L"$(brew --prefix llvm)/lib/c++" -L"$(brew --prefix llvm)/lib" -lunwind
to
cxxflags
when building to see if it helps?
With those flags added to linkflags
the libraries successfully build. Full command is now:
./b2 cxxstd=20 toolset=clang --stage linkflags="-L"$(brew --prefix llvm)/lib/c++" -L"$(brew --prefix llvm)/lib" -lunwind"
Good to know, thanks. Do you consider this issue resolved?
The solution isn't ideal, but making it better could prove a little painful for some other users...
Good to know, thanks. Do you consider this issue resolved?
The solution isn't ideal, but making it better could prove a little painful for some other users...
Do you expect this to be a temporary or permanent workaround? Previous versions of homebrew LLVM worked fine out of the box and there's now a few other issues elsewhere pointing to this one.
Previous versions of homebrew LLVM worked fine out of the box
Just noting that similar issues could have (and did) happen with previous LLVM versions depending on how old the version of Xcode's LLVM was. The root cause is mixing of different LLVM headers and libraries is not officially supported.
LLVM 18 specifically introduced changes to std::make_exception_ptr
so any code that uses it hits the failure when linking to Xcode's libc++
.
A prior situation was LLVM 15/16 introducing verbose abort feature (which impacted Monterey and older), e.g. https://github.com/llvm/llvm-project/issues/87590
Yes, the issue seems to be that LLVM prioritises use of its included C++ headers when it has no guarantee that it will be linking with a compatible libc++
. For a long time this didn't cause anyone problems. I'm not sure if this was by chance, or if there's been a policy change upstream.
brew gist-logs <formula>
link ORbrew config
ANDbrew doctor
outputVerification
brew doctor
output saysYour system is ready to brew.
and am still able to reproduce my issue.brew update
and am still able to reproduce my issue.brew doctor
and that did not fix my problem.What were you trying to do (and why)?
I am trying to build the boost 1.86 beta release candidate. The tar ball can be found: https://archives.boost.io/beta/1.86.0.beta1/source/. I am trying to build it since I am a boost maintainer, and am testing the build as part of the upcoming release cycle.
What happened (include all command output)?
I received a linker error for std::exception pointer:
Searching LLVMs logs lead me to:
https://github.com/llvm/llvm-project/issues/86077
which is linked to:
https://github.com/llvm/llvm-project/issues/77653
A homebrew maintainer states here there is a patch already applied to homebrew:
https://github.com/llvm/llvm-project/issues/77653#issuecomment-2138514529
Full output:
``` ./b2 cxxstd=20 toolset=clang --stage Performing configuration checks - default address-model : 64-bit (cached) [1] - default architecture : arm (cached) [1] Building the Boost C++ Libraries. - cxx11_static_assert : yes (cached) [2] - cxx11_variadic_templates : yes (cached) [2] - cxx11_decltype : yes (cached) [2] - GCC libquadmath and __float128 support : no (cached) [2] - cxx11_hdr_ratio : yes (cached) [2] - cxx11_template_aliases : yes (cached) [2] - cxx11_char16_t : yes (cached) [2] - cxx11_char32_t : yes (cached) [2] - cxx20_hdr_concepts : yes (cached) [2] - cpp_lib_memory_resource : yes (cached) [2] warning: non-free usage requirementslibboost_log.dylib for lack oflibboost_log.dylib...
...skipped libboost_log_setup.dylib for lack of libboost_log.dylib...
...skipped
libboost_log_setup.dylib for lack oflibboost_log_setup.dylib...
...skipped stage/boost_log_setup-config.cmake for lack of libboost_log_setup.dylib...
...skipped
boost_log_setup-config.cmake for lack ofstage/boost_log_setup-config.cmake...
...skipped stage/boost_log_setup-config-version.cmake for lack of libboost_log_setup.dylib...
...skipped
boost_log_setup-config-version.cmake for lack ofstage/boost_log_setup-config-version.cmake...
...skipped libboost_log_setup-variant-shared.cmake for lack of libboost_log_setup.dylib...
...skipped
libboost_log_setup-variant-shared.cmake for lack oflibboost_log_setup-variant-shared.cmake...
...skipped stage/boost_log-config.cmake for lack of libboost_log.dylib...
...skipped
boost_log-config.cmake for lack ofstage/boost_log-config.cmake...
...skipped stage/boost_log-config-version.cmake for lack of libboost_log.dylib...
...skipped
boost_log-config-version.cmake for lack ofstage/boost_log-config-version.cmake...
...skipped libboost_log-variant-shared.cmake for lack of libboost_log.dylib...
...skipped
libboost_log-variant-shared.cmake for lack oflibboost_log-variant-shared.cmake...
...skipped
libboost_cobalt.dylib for lack oflibboost_cobalt.dylib...
...skipped stage/boost_cobalt-config.cmake for lack of libboost_cobalt.dylib...
...skipped
boost_cobalt-config.cmake for lack ofstage/boost_cobalt-config.cmake...
...skipped stage/boost_cobalt-config-version.cmake for lack of libboost_cobalt.dylib...
...skipped
boost_cobalt-config-version.cmake for lack ofstage/boost_cobalt-config-version.cmake...
...skipped libboost_cobalt-variant-shared.cmake for lack of libboost_cobalt.dylib...
...skipped
libboost_cobalt-variant-shared.cmake for lack oflibboost_cobalt-variant-shared.cmake...
...skipped 22 targets...
boost_cobalt-config-version.cmake
boost_cobalt-config.cmake
libboost_cobalt-variant-shared.cmake
boost_log-config-version.cmake
boost_log-config.cmake
libboost_log-variant-shared.cmake
boost_log_setup-config-version.cmake
boost_log_setup-config.cmake
libboost_log_setup-variant-shared.cmake
libboost_cobalt.dylib
libboost_log.dylib
libboost_log_setup.dyliblibboost_cobalt-variant-shared.cmake
stage/boost_cobalt-config-version.cmake
stage/boost_cobalt-config.cmake
libboost_log-variant-shared.cmake
libboost_log_setup-variant-shared.cmake
libboost_log_setup.dylib
stage/boost_log-config-version.cmake
stage/boost_log-config.cmake
stage/boost_log_setup-config-version.cmake
stage/boost_log_setup-config.cmake
...failed updating 2 targets...
clang-darwin.link.dll bin.v2/libs/cobalt/build/clang-darwin-18/release/arm_64/cxxstd-20-iso/threading-multi/visibility-hidden/libboost_cobalt.dylib
clang-darwin.link.dll bin.v2/libs/log/build/clang-darwin-18/release/arm_64/cxxstd-20-iso/threading-multi/visibility-hidden/libboost_log.dylib
```
What did you expect to happen?
I expected the libraries to build fine without the linker error. Building using homebrew GCC14 (toolset=gcc-14) or Xcode provided clang (toolset=darwin) successfully builds the libraries.
Step-by-step reproduction instructions (by running
brew
commands)