diff mbox series

[v1,2/3] package/log4cxx: fix boost-fallback (only check for boost if really needed)

Message ID 20220128124538.31789-2-ps.report@gmx.net
State Accepted
Headers show
Series [v1,1/3] package/log4cxx: change download URL to https | expand

Commit Message

Peter Seiderer Jan. 28, 2022, 12:45 p.m. UTC
- add patch 0002-boost-fallback-only-check-for-boost-if-really-needed.patch
  to check for boost if really needed (in case of legacy c++ standard < c++17)

Fixes:

  - http://autobuild.buildroot.net/results/8d49ab7cd9952f6a13bdd330e875012d0601f1d2

  -- Found Boost: .../host/x86_64-buildroot-linux-uclibc/sysroot/usr/include (found version "1.78.0") found components: thread chrono missing components: date_time atomic
  CMake Error at .../build/log4cxx-0.12.0/boost-fallback-compile-tests/CMakeFiles/CMakeTmp/CMakeLists.txt:19 (add_executable):
    Target "cmTC_aac37" links to target "Boost::date_time" but the target was
    not found.  Perhaps a find_package() call is missing for an IMPORTED
    target, or an ALIAS target is missing?

  CMake Error at .../build/log4cxx-0.12.0/boost-fallback-compile-tests/CMakeFiles/CMakeTmp/CMakeLists.txt:19 (add_executable):
    Target "cmTC_aac37" links to target "Boost::atomic" but the target was not
    found.  Perhaps a find_package() call is missing for an IMPORTED target, or
    an ALIAS target is missing?

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
 ...nly-check-for-boost-if-really-needed.patch | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 package/log4cxx/0002-boost-fallback-only-check-for-boost-if-really-needed.patch

Comments

Peter Seiderer Jan. 28, 2022, 1:40 p.m. UTC | #1
On Fri, 28 Jan 2022 13:45:37 +0100, Peter Seiderer <ps.report@gmx.net> wrote:

> - add patch 0002-boost-fallback-only-check-for-boost-if-really-needed.patch
>   to check for boost if really needed (in case of legacy c++ standard < c++17)
>
> Fixes:
>
>   - http://autobuild.buildroot.net/results/8d49ab7cd9952f6a13bdd330e875012d0601f1d2
>
>   -- Found Boost: .../host/x86_64-buildroot-linux-uclibc/sysroot/usr/include (found version "1.78.0") found components: thread chrono missing components: date_time atomic
>   CMake Error at .../build/log4cxx-0.12.0/boost-fallback-compile-tests/CMakeFiles/CMakeTmp/CMakeLists.txt:19 (add_executable):
>     Target "cmTC_aac37" links to target "Boost::date_time" but the target was
>     not found.  Perhaps a find_package() call is missing for an IMPORTED
>     target, or an ALIAS target is missing?
>
>   CMake Error at .../build/log4cxx-0.12.0/boost-fallback-compile-tests/CMakeFiles/CMakeTmp/CMakeLists.txt:19 (add_executable):
>     Target "cmTC_aac37" links to target "Boost::atomic" but the target was not
>     found.  Perhaps a find_package() call is missing for an IMPORTED target, or
>     an ALIAS target is missing?
>
> Signed-off-by: Peter Seiderer <ps.report@gmx.net>
> ---
>  ...nly-check-for-boost-if-really-needed.patch | 36 +++++++++++++++++++
>  1 file changed, 36 insertions(+)
>  create mode 100644 package/log4cxx/0002-boost-fallback-only-check-for-boost-if-really-needed.patch
>
> diff --git a/package/log4cxx/0002-boost-fallback-only-check-for-boost-if-really-needed.patch b/package/log4cxx/0002-boost-fallback-only-check-for-boost-if-really-needed.patch
> new file mode 100644
> index 0000000000..7df29ea120
> --- /dev/null
> +++ b/package/log4cxx/0002-boost-fallback-only-check-for-boost-if-really-needed.patch
> @@ -0,0 +1,36 @@
> +From 24e7adc8d67b3c8f7d275b4f9a7e70a61b73fcd4 Mon Sep 17 00:00:00 2001
> +From: Peter Seiderer <ps.report@gmx.net>
> +Date: Fri, 28 Jan 2022 13:11:01 +0100
> +Subject: [PATCH] boost-fallback: only check for boost if really needed
> +
> +- only check for boost if really needed (in case of legacy c++ standard < c++17)
> +
> +Signed-off-by: Peter Seiderer <ps.report@gmx.net>

Upstream: https://github.com/apache/logging-log4cxx/pull/107

And https://patchwork.ozlabs.org/project/buildroot/patch/20211119175553.2413433-2-fontaine.fabrice@gmail.com/
for previous attempt to fix a similar/same failure...

Regards,
Peter

> +---
> + src/cmake/boost-fallback/boost-fallback.cmake | 3 +++
> + 1 file changed, 3 insertions(+)
> +
> +diff --git a/src/cmake/boost-fallback/boost-fallback.cmake b/src/cmake/boost-fallback/boost-fallback.cmake
> +index 8285b0b9..0ecf8c6c 100644
> +--- a/src/cmake/boost-fallback/boost-fallback.cmake
> ++++ b/src/cmake/boost-fallback/boost-fallback.cmake
> +@@ -55,6 +55,8 @@ try_compile(STD_SHARED_PTR_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tes
> + try_compile(STD_ATOMIC_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
> +     "${CMAKE_CURRENT_LIST_DIR}/test-stdatomic.cpp")
> +
> ++# search for boost only in case needed for legacy c++ standard < c++17
> ++if(NOT ${STD_THREAD_FOUND} OR NOT ${STD_MUTEX_FOUND} OR NOT ${STD_SHARED_MUTEX_FOUND} OR NOT ${STD_SHARED_PTR_FOUND} OR NOT ${STD_ATOMIC_FOUND})
> + find_package(Boost COMPONENTS thread)
> + if( ${Boost_FOUND} )
> +     try_compile(Boost_SHARED_PTR_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
> +@@ -67,6 +69,7 @@ if( ${Boost_FOUND} )
> +     try_compile(Boost_ATOMIC_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
> +         "${CMAKE_CURRENT_LIST_DIR}/test-boostatomic.cpp")
> + endif( ${Boost_FOUND} )
> ++endif()
> +
> + # Link the target with the appropriate boost libraries(if required)
> + function(boostfallback_link target)
> +--
> +2.34.1
> +
Thomas Petazzoni Jan. 30, 2022, 10:40 p.m. UTC | #2
On Fri, 28 Jan 2022 13:45:37 +0100
Peter Seiderer <ps.report@gmx.net> wrote:

> - add patch 0002-boost-fallback-only-check-for-boost-if-really-needed.patch
>   to check for boost if really needed (in case of legacy c++ standard < c++17)
> 
> Fixes:
> 
>   - http://autobuild.buildroot.net/results/8d49ab7cd9952f6a13bdd330e875012d0601f1d2
> 
>   -- Found Boost: .../host/x86_64-buildroot-linux-uclibc/sysroot/usr/include (found version "1.78.0") found components: thread chrono missing components: date_time atomic
>   CMake Error at .../build/log4cxx-0.12.0/boost-fallback-compile-tests/CMakeFiles/CMakeTmp/CMakeLists.txt:19 (add_executable):
>     Target "cmTC_aac37" links to target "Boost::date_time" but the target was
>     not found.  Perhaps a find_package() call is missing for an IMPORTED
>     target, or an ALIAS target is missing?
> 
>   CMake Error at .../build/log4cxx-0.12.0/boost-fallback-compile-tests/CMakeFiles/CMakeTmp/CMakeLists.txt:19 (add_executable):
>     Target "cmTC_aac37" links to target "Boost::atomic" but the target was not
>     found.  Perhaps a find_package() call is missing for an IMPORTED target, or
>     an ALIAS target is missing?
> 
> Signed-off-by: Peter Seiderer <ps.report@gmx.net>
> ---
>  ...nly-check-for-boost-if-really-needed.patch | 36 +++++++++++++++++++
>  1 file changed, 36 insertions(+)
>  create mode 100644 package/log4cxx/0002-boost-fallback-only-check-for-boost-if-really-needed.patch

Took me a while to understand what was going on here, but I think I got it:

 * If we have gcc < 7.x, then log4cxx needs boost, and makes sure boost
   is built with the date-time support.

 * If we have gcc >= 7.x, then log4cxx does not need boost, but the
   CMake logic in src/cmake/boost-fallback/boost-fallback.cmake kicks
   in anyway, and tests if date-time is provided, which fails.

So what your patch does is to only conditionally do the Boost checks in
src/cmake/boost-fallback/boost-fallback.cmake if Boost is really needed.

Looks good to me: applied!

Thanks a lot!

Thomas
Peter Korsgaard Feb. 6, 2022, 3:34 p.m. UTC | #3
>>>>> "Peter" == Peter Seiderer <ps.report@gmx.net> writes:

 > - add patch 0002-boost-fallback-only-check-for-boost-if-really-needed.patch
 >   to check for boost if really needed (in case of legacy c++ standard < c++17)

 > Fixes:

 >   - http://autobuild.buildroot.net/results/8d49ab7cd9952f6a13bdd330e875012d0601f1d2

 >   -- Found Boost: .../host/x86_64-buildroot-linux-uclibc/sysroot/usr/include (found version "1.78.0") found components: thread chrono missing components: date_time atomic
 >   CMake Error at .../build/log4cxx-0.12.0/boost-fallback-compile-tests/CMakeFiles/CMakeTmp/CMakeLists.txt:19 (add_executable):
 >     Target "cmTC_aac37" links to target "Boost::date_time" but the target was
 >     not found.  Perhaps a find_package() call is missing for an IMPORTED
 >     target, or an ALIAS target is missing?

 >   CMake Error at .../build/log4cxx-0.12.0/boost-fallback-compile-tests/CMakeFiles/CMakeTmp/CMakeLists.txt:19 (add_executable):
 >     Target "cmTC_aac37" links to target "Boost::atomic" but the target was not
 >     found.  Perhaps a find_package() call is missing for an IMPORTED target, or
 >     an ALIAS target is missing?

 > Signed-off-by: Peter Seiderer <ps.report@gmx.net>

Committed to 2021.11.x, thanks.
diff mbox series

Patch

diff --git a/package/log4cxx/0002-boost-fallback-only-check-for-boost-if-really-needed.patch b/package/log4cxx/0002-boost-fallback-only-check-for-boost-if-really-needed.patch
new file mode 100644
index 0000000000..7df29ea120
--- /dev/null
+++ b/package/log4cxx/0002-boost-fallback-only-check-for-boost-if-really-needed.patch
@@ -0,0 +1,36 @@ 
+From 24e7adc8d67b3c8f7d275b4f9a7e70a61b73fcd4 Mon Sep 17 00:00:00 2001
+From: Peter Seiderer <ps.report@gmx.net>
+Date: Fri, 28 Jan 2022 13:11:01 +0100
+Subject: [PATCH] boost-fallback: only check for boost if really needed
+
+- only check for boost if really needed (in case of legacy c++ standard < c++17)
+
+Signed-off-by: Peter Seiderer <ps.report@gmx.net>
+---
+ src/cmake/boost-fallback/boost-fallback.cmake | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/cmake/boost-fallback/boost-fallback.cmake b/src/cmake/boost-fallback/boost-fallback.cmake
+index 8285b0b9..0ecf8c6c 100644
+--- a/src/cmake/boost-fallback/boost-fallback.cmake
++++ b/src/cmake/boost-fallback/boost-fallback.cmake
+@@ -55,6 +55,8 @@ try_compile(STD_SHARED_PTR_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tes
+ try_compile(STD_ATOMIC_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
+     "${CMAKE_CURRENT_LIST_DIR}/test-stdatomic.cpp")
+ 
++# search for boost only in case needed for legacy c++ standard < c++17
++if(NOT ${STD_THREAD_FOUND} OR NOT ${STD_MUTEX_FOUND} OR NOT ${STD_SHARED_MUTEX_FOUND} OR NOT ${STD_SHARED_PTR_FOUND} OR NOT ${STD_ATOMIC_FOUND})
+ find_package(Boost COMPONENTS thread)
+ if( ${Boost_FOUND} )
+     try_compile(Boost_SHARED_PTR_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
+@@ -67,6 +69,7 @@ if( ${Boost_FOUND} )
+     try_compile(Boost_ATOMIC_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
+         "${CMAKE_CURRENT_LIST_DIR}/test-boostatomic.cpp")
+ endif( ${Boost_FOUND} )
++endif()
+ 
+ # Link the target with the appropriate boost libraries(if required)
+ function(boostfallback_link target)
+-- 
+2.34.1
+