Repository: conan-io/conan-center-index

Issue:
Boost 1.84.0 does not generate binaries for apple-clang with Conan 1.x
For now, no packages with Boost 1.84.0 with MacOS and GCC5 are being generated with Conan 1.x. The missing cppstd in the profile is causing it. GCC5 supports C++11 and uses it by default (https://gcc.gnu.org/gcc-5/changes.html), second, Apple Clang supports C++11 and later, but it uses 98 by default. We will need to adjust it, to use C++11 when not defined cppstd.

_Originally posted by @uilianries in https://github.com/conan-io/conan-center-index/issues/21747#issuecomment-1907847429_


Check the build log https://c3i.jfrog.io/c3i/misc/summary.html?json=https://c3i.jfrog.io/c3i/misc/logs/pr/21747/15/boost/1.84.0//summary.json 


Discussion:
This also (surprise!) broke older version builds.  Can we restore the old contents of the `all` folder so the older stuff works and spin up a new copy into `all-184` or something while that gets sorted out?
> This also (surprise!) broke older version builds.

@patmantru Could you please elaborate it? What do you mean by "broke", do you have a build log to share?

> Can we restore the old contents of the all folder so the older stuff works and spin up a new copy into all-184 or something while that gets sorted out?

@patmantru I'm afraid not, boost recipe is too complex to get split in two folder. What you could do for now is using Conan revision to the specific package of older versions.

I'll take a look make it compatible again. 

```
boost/1.81.0: Package '9248f1c90123a684232203646915706f0d530d46' built
boost/1.81.0: Build folder /Users/runner/.conan/data/boost/1.81.0/_/_/build/9248f1c90123a684232203646915706f0d530d46/build-release
boost/1.81.0: Generated conaninfo.txt
boost/1.81.0: Generated conanbuildinfo.txt
boost/1.81.0: Generating the package
boost/1.81.0: Package folder /Users/runner/.conan/data/boost/1.81.0/_/_/package/9248f1c90123a684232203646915706f0d530d46
boost/1.81.0: Calling package()
boost/1.81.0: Copied 1 '.txt' file: LICENSE_1_0.txt
boost/1.81.0 package(): Packaged 1 '.txt' file: LICENSE_1_0.txt
boost/1.81.0 package(): Packaged 14939 '.hpp' files
boost/1.81.0 package(): Packaged 148 '.h' files
boost/1.81.0 package(): Packaged 17 files
boost/1.81.0 package(): Packaged 341 '.ipp' files
boost/1.81.0 package(): Packaged 2 '.inc' files: strict_cpp_re.inc, cpp_re.inc
boost/1.81.0 package(): Packaged 29 '.a' files
boost/1.81.0: Package '9248f1c90123a684232203646915706f0d530d46' created
boost/1.81.0: Created package revision 840157f67f5d45b753ad2c54d35975fb
boost/1.81.0: WARN: Boost component 'fiber' is missing libraries. Try building boost with '-o boost:without_fiber'. (Option is not guaranteed to exist)
boost/1.81.0: WARN: Boost component 'fiber_numa' is missing libraries. Try building boost with '-o boost:without_fiber_numa'. (Option is not guaranteed to exist)
boost/1.81.0: WARN: Boost component 'json' is missing libraries. Try building boost with '-o boost:without_json'. (Option is not guaranteed to exist)
boost/1.81.0: WARN: Boost component 'locale' is missing libraries. Try building boost with '-o boost:without_locale'. (Option is not guaranteed to exist)
boost/1.81.0: WARN: Boost component 'math_c99' is missing libraries. Try building boost with '-o boost:without_math_c99'. (Option is not guaranteed to exist)
boost/1.81.0: WARN: Boost component 'math_c99f' is missing libraries. Try building boost with '-o boost:without_math_c99f'. (Option is not guaranteed to exist)
boost/1.81.0: WARN: Boost component 'math_c99l' is missing libraries. Try building boost with '-o boost:without_math_c99l'. (Option is not guaranteed to exist)
boost/1.81.0: WARN: Boost component 'math_tr1' is missing libraries. Try building boost with '-o boost:without_math_tr1'. (Option is not guaranteed to exist)
boost/1.81.0: WARN: Boost component 'math_tr1f' is missing libraries. Try building boost with '-o boost:without_math_tr1f'. (Option is not guaranteed to exist)
boost/1.81.0: WARN: Boost component 'math_tr1l' is missing libraries. Try building boost with '-o boost:without_math_tr1l'. (Option is not guaranteed to exist)
boost/1.81.0: WARN: Boost component 'nowide' is missing libraries. Try building boost with '-o boost:without_nowide'. (Option is not guaranteed to exist)
boost/1.81.0: WARN: Boost component 'url' is missing libraries. Try building boost with '-o boost:without_url'. (Option is not guaranteed to exist)
boost/1.81.0: WARN: Boost component 'wave' is missing libraries. Try building boost with '-o boost:without_wave'. (Option is not guaranteed to exist)
ERROR: boost/1.81.0: Error in package_info() method, line 1750
	raise ConanException(f"These libraries were expected to be built, but were not built: {non_built}")
	ConanException: These libraries were expected to be built, but were not built: {'boost_json', 'boost_url', 'boost_math_tr1f', 'boost_math_tr1', 'boost_math_c99l', 'boost_math_tr1l', 'boost_locale', 'boost_wave', 'boost_math_c99f', 'boost_math_c99', 'boost_fiber', 'boost_fiber_numa', 'boost_nowide'}
Error: Process completed with exit code 1.
```
Thanks for your help here @uilianries 
@patmantru Could you please share your Conan version and your Conan profile? 
1.5.9 (I know, I know...) and let me get a profile.  This is an M1 build if that matters.
@patmantru Is it 1.5.9 or 1.59.0? 😮 

Sorry yes, 1.59.0


```Configuration (profile_host):
[settings]
arch=armv8
arch_build=armv8
build_type=Release
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=14
os=Macos
os_build=Macos
[options]
opentdf-client:branch_version=True
[build_requires]
[env]

Configuration (profile_build):
[settings]
arch=armv8
arch_build=armv8
build_type=Release
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=14
os=Macos
os_build=Macos
[options]
[build_requires]
[env]
```
@patmantru Thank you, I have a M1 here, so it should enough to reproduce your scenario. 
Fantastic.  I very much appreciate your help here!!!


Resolving patch:
diff --git a/recipes/boost/all/conanfile.py b/recipes/boost/all/conanfile.py
--- a/recipes/boost/all/conanfile.py
+++ b/recipes/boost/all/conanfile.py
@@ -1,7 +1,7 @@
 from conan import ConanFile
 from conan.errors import ConanException, ConanInvalidConfiguration
 from conan.tools.apple import is_apple_os, to_apple_arch, XCRun
-from conan.tools.build import build_jobs, check_min_cppstd, cross_building, valid_min_cppstd
+from conan.tools.build import build_jobs, check_min_cppstd, cross_building, valid_min_cppstd, supported_cppstd
 from conan.tools.env import VirtualBuildEnv
 from conan.tools.files import (
     apply_conandata_patches, chdir, collect_libs, copy, export_conandata_patches,
@@ -163,11 +163,12 @@ def export_sources(self):
 
     @property
     def _min_compiler_version_default_cxx11(self):
-        # Minimum compiler version having c++ standard >= 11
+        """ Minimum compiler version having c++ standard >= 11
+        """
         return {
             "gcc": 6,
             "clang": 6,
-            "apple-clang": 14,
+            "apple-clang": 99,  # still uses C++98 by default. XCode does not reflect apple-clang
             "Visual Studio": 14,  # guess
             "msvc": 190,  # guess
         }.get(str(self.settings.compiler))
@@ -177,12 +178,19 @@ def _min_compiler_version_default_cxx20(self):
         return {
             "gcc": 99,
             "clang": 99,
-            # As of the end of 2023, only apple-clang >=14 use C++20 as their default C++ version.
-            "apple-clang": 14,
+            "apple-clang": 99,
             "Visual Studio": 99,
             "msvc": 999,
         }.get(str(self.settings.compiler))
 
+    def _has_cppstd_11_supported(self):
+        cppstd = self.settings.compiler.get_safe("cppstd")
+        if cppstd:
+            return valid_min_cppstd(self, 11)
+        compiler_version = self._min_compiler_version_default_cxx11
+        if compiler_version:
+            return (Version(self.settings.compiler.version) >= compiler_version) or "11" in supported_cppstd(self)
+
     @property
     def _min_compiler_version_nowide(self):
         # Nowide needs c++11 + swappable std::fstream
@@ -286,7 +294,7 @@ def config_options(self):
         else:
             version_cxx11_standard_json = self._min_compiler_version_default_cxx11
             if version_cxx11_standard_json:
-                if Version(self.settings.compiler.version) < version_cxx11_standard_json:
+                if not self._has_cppstd_11_supported:
                     self.options.without_fiber = True
                     self.options.without_json = True
                     self.options.without_nowide = True
@@ -332,7 +340,7 @@ def disable_math():
                 min_compiler_version = self._min_compiler_version_default_cxx11
                 if min_compiler_version is None:
                     self.output.warning("Assuming the compiler supports c++11 by default")
-                elif Version(self.settings.compiler.version) < min_compiler_version:
+                elif not self._has_cppstd_11_supported:
                     disable_math()
 
         if Version(self.version) >= "1.79.0":
@@ -354,7 +362,7 @@ def disable_wave():
                 min_compiler_version = self._min_compiler_version_default_cxx11
                 if min_compiler_version is None:
                     self.output.warning("Assuming the compiler supports c++11 by default")
-                elif Version(self.settings.compiler.version) < min_compiler_version:
+                elif not self._has_cppstd_11_supported:
                     disable_wave()
 
         if Version(self.version) >= "1.81.0":
@@ -376,7 +384,7 @@ def disable_locale():
                 min_compiler_version = self._min_compiler_version_default_cxx11
                 if min_compiler_version is None:
                     self.output.warning("Assuming the compiler supports c++11 by default")
-                elif Version(self.settings.compiler.version) < min_compiler_version:
+                elif not self._has_cppstd_11_supported:
                     disable_locale()
 
         if Version(self.version) >= "1.84.0":
@@ -532,8 +540,7 @@ def validate(self):
             if self.settings.compiler.get_safe("cppstd"):
                 check_min_cppstd(self, 11)
             else:
-                version_cxx11_standard = self._min_compiler_version_default_cxx11
-                if version_cxx11_standard and Version(self.settings.compiler.version) < version_cxx11_standard:
+                if not self._has_cppstd_11_supported:
                     raise ConanInvalidConfiguration(
                         f"Boost.{{{','.join(self._cxx11_boost_libraries)}}} requires a c++11 compiler "
                         "(please set compiler.cppstd or use a newer compiler)"
@@ -1095,9 +1102,14 @@ def add_defines(library):
 
         flags.append(f"toolset={self._toolset}")
 
-        if self.settings.get_safe("compiler.cppstd"):
-            cppstd_flag = AutotoolsToolchain(self).cppstd
-            flags.append(f"cxxflags={cppstd_flag}")
+        safe_cppstd = self.settings.get_safe("compiler.cppstd")
+        if safe_cppstd:
+            cppstd_version = safe_cppstd.replace("gnu", "")
+            flags.append(f"cxxstd={cppstd_version}")
+            if "gnu" in safe_cppstd:
+                flags.append("cxxstd-dialect=gnu")
+        elif self._has_cppstd_11_supported:
+            flags.append("cxxstd=11")
 
         # LDFLAGS
         link_flags = []


Test patch:
diff --git a/recipes/boost/all/test_package/CMakeLists.txt b/recipes/boost/all/test_package/CMakeLists.txt
--- a/recipes/boost/all/test_package/CMakeLists.txt
+++ b/recipes/boost/all/test_package/CMakeLists.txt
@@ -26,6 +26,7 @@ if(NOT HEADER_ONLY)
         find_package(Boost COMPONENTS regex REQUIRED)
         add_executable(regex_exe regex.cpp)
         target_link_libraries(regex_exe PRIVATE Boost::regex)
+        set_property(TARGET regex_exe PROPERTY CXX_STANDARD 11)
         add_test(NAME boost_regex COMMAND regex_exe)
     endif()
 
@@ -47,6 +48,7 @@ if(NOT HEADER_ONLY)
         find_package(Boost COMPONENTS chrono REQUIRED)
         add_executable(chrono_exe chrono.cpp)
         target_link_libraries(chrono_exe PRIVATE Boost::chrono)
+        set_property(TARGET chrono_exe PROPERTY CXX_STANDARD 11)
         add_test(NAME chrono_test COMMAND chrono_exe)
     endif()
 
@@ -78,6 +80,7 @@ if(NOT HEADER_ONLY)
         find_package(Boost COMPONENTS locale REQUIRED)
         add_executable(locale_exe locale.cpp)
         target_link_libraries(locale_exe PRIVATE Boost::locale)
+        set_property(TARGET locale_exe PROPERTY CXX_STANDARD 11)
         add_test(NAME boost_locale COMMAND locale_exe)
     endif()
 
@@ -86,6 +89,7 @@ if(NOT HEADER_ONLY)
         add_executable(stacktrace_addr2line_exe stacktrace.cpp)
         target_compile_definitions(stacktrace_addr2line_exe PRIVATE TEST_STACKTRACE_IMPL=1)
         target_link_libraries(stacktrace_addr2line_exe PRIVATE Boost::stacktrace_addr2line)
+        set_property(TARGET stacktrace_addr2line_exe PROPERTY CXX_STANDARD 11)
         add_test(NAME boost_stacktrace_addr2line COMMAND stacktrace_addr2line_exe)
     endif()
 
@@ -93,6 +97,7 @@ if(NOT HEADER_ONLY)
         add_executable(stacktrace_backtrace_exe stacktrace.cpp)
         target_compile_definitions(stacktrace_backtrace_exe PRIVATE TEST_STACKTRACE_IMPL=2)
         target_link_libraries(stacktrace_backtrace_exe PRIVATE Boost::stacktrace_backtrace)
+        set_property(TARGET stacktrace_backtrace_exe PROPERTY CXX_STANDARD 11)
         add_test(NAME boost_stacktrace_backtrace COMMAND stacktrace_backtrace_exe)
     endif()
 
@@ -102,22 +107,26 @@ if(NOT HEADER_ONLY)
         add_executable(stacktrace_noop_exe stacktrace.cpp)
         target_compile_definitions(stacktrace_noop_exe PRIVATE TEST_STACKTRACE_IMPL=4)
         target_link_libraries(stacktrace_noop_exe PRIVATE Boost::stacktrace_noop)
+        set_property(TARGET stacktrace_noop_exe PROPERTY CXX_STANDARD 11)
         add_test(NAME boost_stacktrace_noop COMMAND stacktrace_noop_exe)
 
         if(WIN32)
             add_executable(stacktrace_windbg_exe stacktrace.cpp)
             target_compile_definitions(stacktrace_windbg_exe PRIVATE TEST_STACKTRACE_IMPL=5)
             target_link_libraries(stacktrace_windbg_exe PRIVATE Boost::stacktrace_windbg)
+            set_property(TARGET stacktrace_windbg_exe PROPERTY CXX_STANDARD 11)
             add_test(NAME boost_stacktrace_windbg COMMAND stacktrace_windbg_exe)
 
             add_executable(stacktrace_windbg_cached_exe stacktrace.cpp)
             target_compile_definitions(stacktrace_windbg_cached_exe PRIVATE TEST_STACKTRACE_IMPL=6)
             target_link_libraries(stacktrace_windbg_cached_exe PRIVATE Boost::stacktrace_windbg_cached)
+            set_property(TARGET stacktrace_windbg_cached_exe PROPERTY CXX_STANDARD 11)
             add_test(NAME boost_stacktrace_windbg_cached COMMAND stacktrace_windbg_cached_exe)
         else()
             add_executable(stacktrace_basic_exe stacktrace.cpp)
             target_compile_definitions(stacktrace_basic_exe PRIVATE TEST_STACKTRACE_IMPL=3)
             target_link_libraries(stacktrace_basic_exe PRIVATE Boost::stacktrace_basic)
+            set_property(TARGET stacktrace_basic_exe PROPERTY CXX_STANDARD 11)
             add_test(NAME boost_stacktrace_basic COMMAND stacktrace_basic_exe)
         endif()
     endif()