conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
945 stars 1.72k forks source link

[package] boost/1.85.0: GCC on macOS fails to compile from_exception.cpp #23877

Closed randomphrase closed 4 months ago

randomphrase commented 4 months ago

Description

Building boost 1.85.0 on macOS with GCC, we get a compilation error as follows:

libs/stacktrace/build/../src/from_exception.cpp:29:2: error: #error On this platform memory leaks are possible if capturing stacktrace from exceptions is enabled and exceptions are thrown concurrently and libc++ runtime is used. Define `BOOST_STACKTRACE_LIBCXX_RUNTIME_MAY_CAUSE_MEMORY_LEAK` to suppress this error if the library would not be used with libc++ runtime (for example, it would be only used with GCC runtime). Otherwise, disable the boost_stacktrace_from_exception library build (for example by `./b2 boost.stacktrace.from_exception=off` option).
   29 | #error On this platform memory leaks are possible if capturing stacktrace from \
      |  ^~~~~
...failed updating 1 target...

Note that the Conan recipe will define this symbol, according to the following logic in the recipe:

if self._stacktrace_from_exception_available and is_apple_os(self) and str(self.settings.compiler.libcxx) == "libc++":

To me this seems backwards: the memory leak exists only in the libc++ runtime, hence if anything we should define the symbol (and hence allow compilation) only if we are not using that runtime. As it stands we can only compile against the problematic runtime.

Package and Environment Details

Conan profile

[settings] arch=armv8 build_type=Release compiler=gcc compiler.cppstd=23 compiler.libcxx=libstdc++11 compiler.version=13.2 os=Macos [buildenv] CC=/opt/homebrew/bin/gcc-13 CXX=/opt/homebrew/bin/g++-13

Steps to reproduce

conan install . --output-folder=build.dbg --build=missing --profile gcc13

Logs

Click to expand log ``` alastair@Alastairs-MBP ~/h/instru> conan install . --output-folder=build.dbg --build=missing --profile gcc13 main!? ======== Input profiles ======== Profile host: [settings] arch=armv8 build_type=Release compiler=gcc compiler.cppstd=23 compiler.libcxx=libstdc++11 compiler.version=13.2 os=Macos [buildenv] CC=/opt/homebrew/bin/gcc-13 CXX=/opt/homebrew/bin/g++-13 Profile build: [settings] arch=armv8 build_type=Release compiler=apple-clang compiler.cppstd=gnu98 compiler.libcxx=libc++ compiler.version=14 os=Macos ======== Computing dependency graph ======== boost/1.85.0: Not found in local cache, looking in remotes... boost/1.85.0: Checking remote: conancenter boost/1.85.0: Downloaded recipe revision 14265ec82b25d91305bbb3b30d3357f8 Graph root conanfile.txt: /Users/alastair/hack/instru/conanfile.txt Requirements boost/1.85.0#14265ec82b25d91305bbb3b30d3357f8 - Downloaded (conancenter) bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4 - Cache fmt/10.2.1#9199a7a0611866dea5c8849a77467b25 - Cache libbacktrace/cci.20210118#ec1aa63bbc10145c6a299e68e711670c - Cache libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd - Cache zlib/1.2.11#ffa77daf83a57094149707928bdce823 - Cache Build requirements b2/4.10.1#a41eecb267963ddf518e3c177eae60e1 - Cache Resolved version ranges zlib/[>=1.2.11 <2]: zlib/1.2.11 ======== Computing necessary packages ======== boost/1.85.0: Checking 7 compatible configurations boost/1.85.0: Compatible configurations not found in cache, checking servers boost/1.85.0: '6c44415c04624beb77358a994e3b610f705dba29': compiler.cppstd=14 boost/1.85.0: '7519fba830f908915b53fa0095283586e981b30a': compiler.cppstd=gnu14 boost/1.85.0: '900219c7140413985f8d97de5f33e2f751525318': compiler.cppstd=17 boost/1.85.0: '0a560c3f3d2092b9e24f538ed65a0945cdd1d197': compiler.cppstd=gnu17 boost/1.85.0: 'ea7e47fe3f2437aa22e683b7a2d903c6c0805d11': compiler.cppstd=20 boost/1.85.0: 'e041c9e24f7dc3051d045a0bfa93526fb848edee': compiler.cppstd=gnu20 boost/1.85.0: 'cd2df2714a55433a8985684b08d123f9306158d0': compiler.cppstd=gnu23 Requirements boost/1.85.0#14265ec82b25d91305bbb3b30d3357f8:de08c5993c7efbb1095cecb2eb62217158cf8e97 - Build bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4:41e400a6004e9dc630aa4516fa67fc2fff3868b1#36051151b68d53b7ef131c12dde41da2 - Cache fmt/10.2.1#9199a7a0611866dea5c8849a77467b25:1800c08c5ff16dcba4bf4e494a9341ca82ea630b#72a813b9f19aada4a905b801c6204568 - Cache libbacktrace/cci.20210118#ec1aa63bbc10145c6a299e68e711670c:36b0287c08dbeb6d80d3ccef68e9d84d12418a4e#cad455dac83db10ebca5bf60356cb847 - Cache libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd:36b0287c08dbeb6d80d3ccef68e9d84d12418a4e#24aba7639b661a4bf965245d03e8e2cb - Cache zlib/1.2.11#ffa77daf83a57094149707928bdce823:36b0287c08dbeb6d80d3ccef68e9d84d12418a4e#199e1bf9b43a05f5ec0bb843e8b5bdb8 - Cache Build requirements b2/4.10.1#a41eecb267963ddf518e3c177eae60e1:ef52fcb08b72f88cd87dade69f7b5e49a93b591a#80caca9407086ca720e34846ed71bf51 - Cache ======== Installing packages ======== b2/4.10.1: Already installed! (1 of 7) bzip2/1.0.8: Already installed! (2 of 7) fmt/10.2.1: Already installed! (3 of 7) libbacktrace/cci.20210118: Already installed! (4 of 7) libiconv/1.17: Already installed! (5 of 7) zlib/1.2.11: Already installed! (6 of 7) boost/1.85.0: Sources downloaded from 'conancenter' boost/1.85.0: Calling source() in /Users/alastair/.conan2/p/boost77e71cb2729fd/s/src boost/1.85.0: Downloading 124.0MB boost_1_85_0.tar.bz2 boost/1.85.0: Downloaded 48.7MB 39% boost_1_85_0.tar.bz2 boost/1.85.0: Downloaded 83.6MB 67% boost_1_85_0.tar.bz2 boost/1.85.0: Downloaded 121.2MB 97% boost_1_85_0.tar.bz2 boost/1.85.0: Apply patch (conan): Optional flag to specify iconv from either libc of libiconv -------- Installing package boost/1.85.0 (7 of 7) -------- boost/1.85.0: Building from source boost/1.85.0: Package boost/1.85.0:de08c5993c7efbb1095cecb2eb62217158cf8e97 boost/1.85.0: Building your package in /Users/alastair/.conan2/p/b/boost1fab7c85a2cf6/b boost/1.85.0: Calling generate() boost/1.85.0: Generators folder: /Users/alastair/.conan2/p/b/boost1fab7c85a2cf6/b/build-release/conan boost/1.85.0: Generating aggregated env files boost/1.85.0: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh'] boost/1.85.0: Calling build() boost/1.85.0: WARN: replace_in_file didn't find pattern '/* thread_local */' in '/Users/alastair/.conan2/p/boost77e71cb2729fd/s/src/boost/stacktrace/detail/libbacktrace_impls.hpp' file. boost/1.85.0: WARN: replace_in_file didn't find pattern '/* static __thread */' in '/Users/alastair/.conan2/p/boost77e71cb2729fd/s/src/boost/stacktrace/detail/libbacktrace_impls.hpp' file. boost/1.85.0: WARN: replace_in_file didn't find pattern 'local generic-os = [ set.difference $(all-os) : aix darwin vxworks solaris osf hpux ] ;' in '/Users/alastair/.conan2/p/boost77e71cb2729fd/s/src/tools/build/src/tools/gcc.jam' file. boost/1.85.0: WARN: replace_in_file didn't find pattern 'local no-threading = android beos haiku sgi darwin vxworks ;' in '/Users/alastair/.conan2/p/boost77e71cb2729fd/s/src/tools/build/src/tools/gcc.jam' file. boost/1.85.0: WARN: Patching user-config.jam boost/1.85.0: WARN: using zlib : 1.2.11 : "/Users/alastair/.conan2/p/b/zlib851bcb48a3c11/p/include" "/Users/alastair/.conan2/p/b/zlib851bcb48a3c11/p/lib" z ; using bzip2 : 1.0.8 : "/Users/alastair/.conan2/p/b/bzip2a29a17ced7de3/p/include" "/Users/alastair/.conan2/p/b/bzip2a29a17ced7de3/p/lib" bz2 ; using "darwin" : : "/opt/homebrew/bin/g++-13" -arch arm64 : "-I/Users/alastair/.conan2/p/b/libba1f88a4833c169/p/include" "-L/Users/alastair/.conan2/p/b/libba1f88a4833c169/p/lib" ; boost/1.85.0: WARN: b2 -q numa=on target-os=darwin architecture=arm address-model=64 binary-format=mach-o abi=aapcs --layout=system --user-config=/Users/alastair/.conan2/p/boost77e71cb2729fd/s/src/tools/build/user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.icu=off --disable-icu boost.locale.iconv=on boost.locale.iconv.lib=libiconv threading=multi visibility=hidden link=static variant=release --with-atomic --with-charconv --with-chrono --with-cobalt --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-fiber --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-url --with-wave toolset=darwin cxxstd=2b define=_GLIBCXX_USE_CXX11_ABI=1 pch=on -sLIBBACKTRACE_PATH=/Users/alastair/.conan2/p/b/libba1f88a4833c169/p -sICONV_PATH=/Users/alastair/.conan2/p/b/libic364ffe1832ae9/p linkflags="" cxxflags="-fPIC -DBOOST_STACKTRACE_ADDR2LINE_LOCATION=/usr/bin/addr2line" install --prefix=/Users/alastair/.conan2/p/b/boost1fab7c85a2cf6/p -j12 --abbreviate-paths -d0 --debug-configuration --build-dir="/Users/alastair/.conan2/p/b/boost1fab7c85a2cf6/b/build-release" boost/1.85.0: RUN: b2 -q numa=on target-os=darwin architecture=arm address-model=64 binary-format=mach-o abi=aapcs --layout=system --user-config=/Users/alastair/.conan2/p/boost77e71cb2729fd/s/src/tools/build/user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.icu=off --disable-icu boost.locale.iconv=on boost.locale.iconv.lib=libiconv threading=multi visibility=hidden link=static variant=release --with-atomic --with-charconv --with-chrono --with-cobalt --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-fiber --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-url --with-wave toolset=darwin cxxstd=2b define=_GLIBCXX_USE_CXX11_ABI=1 pch=on -sLIBBACKTRACE_PATH=/Users/alastair/.conan2/p/b/libba1f88a4833c169/p -sICONV_PATH=/Users/alastair/.conan2/p/b/libic364ffe1832ae9/p linkflags="" cxxflags="-fPIC -DBOOST_STACKTRACE_ADDR2LINE_LOCATION=/usr/bin/addr2line" install --prefix=/Users/alastair/.conan2/p/b/boost1fab7c85a2cf6/p -j12 --abbreviate-paths -d0 --debug-configuration --build-dir="/Users/alastair/.conan2/p/b/boost1fab7c85a2cf6/b/build-release" notice: found boost-build.jam at /Users/alastair/.conan2/p/boost77e71cb2729fd/s/src/boost-build.jam notice: loading B2 from /Users/alastair/.conan2/p/b20567c2e64ba50/p/bin/.b2/kernel/bootstrap.jam notice: Searching '/etc' '/Users/alastair' '/Users/alastair/.conan2/p/b20567c2e64ba50/p/bin/.b2/kernel' '/Users/alastair/.conan2/p/b20567c2e64ba50/p/bin/.b2/util' '/Users/alastair/.conan2/p/b20567c2e64ba50/p/bin/.b2/build' '/Users/alastair/.conan2/p/b20567c2e64ba50/p/bin/.b2/tools' '/Users/alastair/.conan2/p/b20567c2e64ba50/p/bin/.b2/contrib' '/Users/alastair/.conan2/p/b20567c2e64ba50/p/bin/.b2/.' for site-config configuration file 'site-config.jam'. notice: Configuration file 'site-config.jam' not found in '/etc' '/Users/alastair' '/Users/alastair/.conan2/p/b20567c2e64ba50/p/bin/.b2/kernel' '/Users/alastair/.conan2/p/b20567c2e64ba50/p/bin/.b2/util' '/Users/alastair/.conan2/p/b20567c2e64ba50/p/bin/.b2/build' '/Users/alastair/.conan2/p/b20567c2e64ba50/p/bin/.b2/tools' '/Users/alastair/.conan2/p/b20567c2e64ba50/p/bin/.b2/contrib' '/Users/alastair/.conan2/p/b20567c2e64ba50/p/bin/.b2/.'. notice: Loading explicitly specified user configuration file: /Users/alastair/.conan2/p/boost77e71cb2729fd/s/src/tools/build/user-config.jam notice: Searching '/Users/alastair/.conan2/p/boost77e71cb2729fd/s/src/tools/build' for user-config configuration file 'user-config.jam'. notice: Loading user-config configuration file 'user-config.jam' from '/Users/alastair/.conan2/p/boost77e71cb2729fd/s/src/tools/build'. notice: [zlib] Using pre-installed library notice: [zlib] Condition notice: [bzip2] Using pre-installed library notice: [bzip2] Condition notice: OSX version on this machine is 14.4.1 notice: will use '/opt/homebrew/bin/g++-13' '-arch' 'arm64' for darwin, condition darwin-13 notice: using strip for darwin-13 at strip notice: using archiver for darwin-13 at libtool notice: [zlib] zlib is already configured notice: [bzip2] bzip is already configured notice: iostreams: not using lzma compression notice: iostreams: not using zstd compression notice: [python-cfg] Configuring python... notice: [python-cfg] Checking interpreter command "python"... notice: [python-cfg] running command 'python -c "from sys import *; print('version=%d.%d\nplatform=%s\nprefix=%s\nexec_prefix=%s\nexecutable=%s' % (version_info[0],version_info[1],platform,prefix,exec_prefix,executable))" 2>&1' notice: [python-cfg] ...does not invoke a working interpreter notice: [python-cfg] Python headers and libraries not found. Performing configuration checks - default address-model : 64-bit [1] - default architecture : arm [1] - cxx11_static_assert : yes [2] - cxx11_variadic_templates : yes [2] - cxx11_decltype : yes [2] - GCC libquadmath and __float128 support : no [2] - cxx11_hdr_ratio : yes [2] - cxx11_template_aliases : yes [2] - cxx11_char16_t : yes [2] - cxx11_char32_t : yes [2] - cxx20_hdr_concepts : yes [2] - cpp_lib_memory_resource : yes [2] warning: non-free usage requirements std ignored warning: in main-target boost_cobalt at libs/cobalt/build/Jamfile:73 - has std::atomic_ref : yes [2] - has statx : no [2] - has statx syscall : no [2] - cxx11_rvalue_references : yes [2] - cxx11_scoped_enums : yes [2] - cxx11_noexcept : yes [2] - cxx11_nullptr : yes [2] - cxx11_defaulted_functions : yes [2] - cxx11_defaulted_moves : yes [2] - cxx11_deleted_functions : yes [2] - cxx11_function_template_default_args : yes [2] - cxx11_final : yes [2] - cxx11_override : yes [2] - has init_priority attribute : yes [2] - has stat::st_blksize : no [2] - has stat::st_mtim : no [2] - has stat::st_mtimensec : no [2] - has stat::st_mtimespec : yes [2] - has stat::st_birthtim : no [2] - has stat::st_birthtimensec : no [2] - has stat::st_birthtimespec : yes [2] - has fdopendir(O_NOFOLLOW) : yes [2] - has dirent::d_type : yes [2] - has POSIX *at APIs : no [2] - has fallocate : no [2] - cxx11_auto_declarations : yes [2] - cxx11_constexpr : yes [2] - cxx11_hdr_mutex : yes [2] - cxx11_hdr_tuple : yes [2] - cxx11_lambdas : yes [2] - cxx11_thread_local : yes [2] - has_icu builds : no [2] - zlib : yes [3] - bzip2 : yes [3] - cxx11_basic_alignas : yes [2] - iconv (libc) : no [2] - iconv (separate) : yes [2] - cxx11_hdr_functional : yes [2] - cxx11_hdr_type_traits : yes [2] - cxx11_range_based_for : yes [2] - cxx11_smart_ptr : yes [2] - native atomic int32 supported : yes [2] - native syslog supported : yes [2] - pthread supports robust mutexes : no [2] - Boost.Regex is header-only : yes [2] - lockfree boost::atomic_flag : yes [2] - gcc visibility : yes [2] - sfinae_expr : yes [2] - cxx11_unified_initialization_syntax : yes [2] - cxx11_hdr_initializer_list : yes [2] - cxx11_hdr_chrono : yes [2] - cxx11_numeric_limits : yes [2] - cxx11_hdr_array : yes [2] - cxx11_hdr_atomic : yes [2] - cxx11_allocator : yes [2] - cxx11_explicit_conversion_operators : yes [2] - cxx14_decltype_auto : yes [2] - cxx14_generic_lambdas : yes [2] - cxx14_return_type_deduction : yes [2] - cxx14_variable_templates : yes [2] - long double support : yes [2] - Has Large File Support : yes [2] - Has attribute init_priority : yes [2] - std_wstreambuf builds : yes [2] - std_wstreambuf : yes [2] - libbacktrace builds : yes [2] - addr2line builds : yes [2] - WinDbg builds : no [2] - cxx11_rvalue_references : yes [4] - WinDbg builds : no [4] - WinDbgCached builds : no [2] - WinDbgCached builds : no [4] - BOOST_COMP_GNUC >= 4.3.0 : yes [2] - cxx11_hdr_thread : yes [2] - cxx11_hdr_regex : yes [2] [1] drwn-13 [2] drwn-13/rls/bst.l-lbcnv/bst.l-on/bst.l-off/cxstd-2b-iso/lnk-sttc/nm-on/thrd-mlt/vsblt-hdn [3] lnk-sttc [4] drwn-13/rls/bst.l-lbcnv/bst.l-on/bst.l-off/bld-no/cxstd-2b-iso/lnk-sttc/nm-on/thrd-mlt/vsblt-hdn Component configuration: - atomic : building - charconv : building - chrono : building - cobalt : building - container : building - context : building - contract : building - coroutine : building - date_time : building - exception : building - fiber : building - filesystem : building - graph : building - graph_parallel : not building - headers : not building - iostreams : building - json : building - locale : building - log : building - math : building - mpi : not building - nowide : building - program_options : building - python : not building - random : building - regex : building - serialization : building - stacktrace : building - system : building - test : building - thread : building - timer : building - type_erasure : building - url : building - wave : building libs/stacktrace/build/../src/from_exception.cpp:29:2: error: #error On this platform memory leaks are possible if capturing stacktrace from exceptions is enabled and exceptions are thrown concurrently and libc++ runtime is used. Define `BOOST_STACKTRACE_LIBCXX_RUNTIME_MAY_CAUSE_MEMORY_LEAK` to suppress this error if the library would not be used with libc++ runtime (for example, it would be only used with GCC runtime). Otherwise, disable the boost_stacktrace_from_exception library build (for example by `./b2 boost.stacktrace.from_exception=off` option). 29 | #error On this platform memory leaks are possible if capturing stacktrace from \ | ^~~~~ ...failed updating 1 target... boost/1.85.0: ERROR: Package 'de08c5993c7efbb1095cecb2eb62217158cf8e97' build failed boost/1.85.0: WARN: Build folder /Users/alastair/.conan2/p/b/boost1fab7c85a2cf6/b/build-release ERROR: boost/1.85.0: Error in build() method, line 1076 self.run(full_command) ConanException: Error 1 while executing ```
uilianries commented 4 months ago

It may be related to https://github.com/boostorg/stacktrace/issues/163

I'll send a hotfix to always set BOOST_STACKTRACE_LIBCXX_RUNTIME_MAY_CAUSE_MEMORY_LEAK

Users still can disable stacktrace.from_exception