bfgroup / b2

B2 makes it easy to build C++ projects, everywhere.
https://www.bfgroup.xyz/b2/
Boost Software License 1.0
75 stars 228 forks source link

FreeBSD builds in CI #355

Closed sdarwin closed 8 months ago

sdarwin commented 8 months ago

Make sure you completed the following tasks

Environment and version details

Brief problem description

Earlier b2 worked fine on FreeBSD. Now it's failing to build.

Steps to reproduce the issue

Running CI tests for boostorg/beast and boostorg/url.

++ ./bootstrap.sh

Building B2 engine..

++ ./b2 -d0 headers

ld-elf.so.1: /usr/local/lib/gcc10/libstdc++.so.6: version GLIBCXX_3.4.29 required by /tmp/drone-fAzFd0qULZEUQ81v/drone/boost-root/b2 not found

FreeBSD 13 is hosted in Google Cloud, previously on AWS. It has been running for over a year.

Which packages are installed on the Operating System? From https://github.com/cppalliance/ansible-dronerunner/blob/master/vars/FreeBSD-family.yml

  - htop
  - nload
  - bash
  - git
  - curl
  - icu
  - gcc
  - gcc11
  - gcc10
  - gcc9
  - gcc8
  - llvm15
  - llvm14
  - llvm13
  - llvm12
  - llvm11
  - llvm10

The error mentions libstdc++.so.6 in /usr/local/lib/gcc10/libstdc++.so.6

That is included with the existing packages. "libstc++" was not installed separately.

Job output: https://drone.cpp.al/boostorg/beast/711/6/2

Any ideas? Perhaps certain environment variables or command-line-flags need to be set now.

Thanks.

grafikrobot commented 8 months ago

Not sure I'm going to be able to help much. What I can see from the logs you linked:

Closing as I'm 99% sure it's not a b2 problem. Reopen if you find otherwise.

sdarwin commented 8 months ago

@grafikrobot

More info:

When installing gcc11 on FreeBSD it says:

To ensure binaries built with this toolchain find appropriate versions
of the necessary run-time libraries, you may want to link using

  -Wl,-rpath=/usr/local/lib/gcc11

For ports leveraging USE_GCC, USES=compiler, or USES=fortran this happens
transparently.

That's right! So, for specific CI jobs we are adding something like export B2_LINKFLAGS='-Wl,-rpath=/usr/local/lib/gcc11' and those jobs are building successfully.

What would be the best way to add similar link flags to bootstrap.sh? The problem is occurring at this stage of the process:

./bootstrap.sh
./b2 headers

In other words. it only involves b2 before getting to any specific CI jobs.

I have avoided the problem by removing the "default" gcc. In the absence of /usr/local/bin/gcc b2 compiles with /usr/bin/clang++.