cpp-pm / hunter

CMake driven cross-platform package manager for C/C++.
BSD 2-Clause "Simplified" License
589 stars 178 forks source link

Static boost libraries cannot be found after compilation in ppc64le architecture #351

Closed viniciusferrao closed 1 year ago

viniciusferrao commented 3 years ago

cmake_minimum_required(VERSION 3.5)

include(cmake/cable/bootstrap.cmake)

include(CableBuildInfo) include(CableBuildType) include(CableToolchains) include(HunterGate)

include(defaults/HunterCacheServers)

cable_configure_toolchain(DEFAULT cxx11)

set(HUNTER_CONFIGURATION_TYPES Release CACHE STRING "Build type of Hunter packages") set(HUNTER_JOBS_NUMBER 6 CACHE STRING "Number of parallel builds used by Hunter") HunterGate( URL "https://github.com/cpp-pm/hunter/archive/v0.23.291.tar.gz" SHA1 "4f57243b24a02b9c7ec5ea02c09d5c77c6a97cba" LOCAL )

project(foo)

cable_set_build_type(DEFAULT Release CONFIGURATION_TYPES Release RelWithDebInfo)

hunter_add_package(Boost COMPONENTS system filesystem thread) find_package(Boost CONFIG REQUIRED COMPONENTS system filesystem thread)

hunter_add_package(jsoncpp) find_package(jsoncpp CONFIG REQUIRED)

hunter_add_package(ethash) find_package(ethash CONFIG REQUIRED)


Here is the log until first error reported by Hunter, option `HUNTER_STATUS_DEBUG` is `ON`:
* https://pastebin.com/6DvFUn3c

<!--- Check this document: https://hunter.readthedocs.io/en/latest/reference/errors/error.external.build.failed.html -->
<!--- If you got `external.build.failed` -->
I've checked that the first error in logs **IS NOT** `external.build.failed`. **Yes**

<!--- Info about environment -->
* I'm building on Linux (RHEL 8.3)
* I'm using CMake from snapd (snapcraft.io)
* CMake version: 3.19.3

<!--- What toolchain you're using if any -->
* I'm not using toolchain (I think...)

I'm using the next command line on generate step:

cmake .. -DHUNTER_STATUS_DEBUG=ON -DHUNTER_NO_TOOLCHAIN_ID_RECALCULATION=OFF



---

I've found this while trying to compile `nsfminer` and first reported the issue there: https://github.com/no-fee-ethereum-mining/nsfminer/issues/30

But after some testing I think this may be a Hunter issue.

If there's something additional to be made please let me know. I've done the best to report this correctly. In the paste there's also the output of `CMakeOutput.log`.

Thanks!
rbsheth commented 3 years ago

Interesting, I never tried compiling on ppc but the whole point is for Hunter to not care about the architecture it is compiling for. Thanks for the bug report! We'll have to investigate.

@Bjoe any ideas, since you were recently in the Boost Hunter files?

Bjoe commented 3 years ago

It's using the FindBoost from hunter see .hunter/_Base/Download/Hunter/0.23.291/4f57243/Unpacked/cmake/find/FindBoost.cmake. This FindBoost is outdated as I said. See also my comment in issue #141

Can you please try with enabled: USE_CONFIG_FROM_BOOST=ON See Boost-filesystem-useBoostConfig in git -> https://github.com/cpp-pm/hunter/tree/master/examples/Boost-filesystem-useBoostConfig or see in the hunter doc: https://hunter.readthedocs.io/en/latest/packages/pkg/Boost.html#cmake-options

Btw. If you are using USE_CONFIG_FROM_BOOST=ON and you didn't need system and thread in your project, you can remove it. USE_CONFIG_FROM_BOOST=ON is build and add automatically the dependencies.

viniciusferrao commented 3 years ago

Hi @Bjoe thanks for the tip. I tried what you've said but It was a no go. Please correct me if I've done something wrong:

Added the following do CMakeLists.txt:

HunterGate(
    URL "https://github.com/cpp-pm/hunter/archive/v0.23.293.tar.gz"
    SHA1 "e8e5470652db77149d9b38656db2a6c0b7642693"
    LOCAL
)
set(Boost_USE_STATIC_LIBS ON)

And invoked cmake with: cmake .. -DUSE_CONFIG_FROM_BOOST=ON -DHUNTER_STATUS_DEBUG=ON -DHUNTER_NO_TOOLCHAIN_ID_RECALCULATION=OFF

Same error was generated.

Bjoe commented 3 years ago

@viniciusferrao No, sorry this is wrong how you add this configuration. You must set this Boost_USE_STATIC_LIBS=ON on hunter_config(), like this example:

hunter_config(Boost
    VERSION ${HUNTER_Boost_VERSION}
    CMAKE_ARGS USE_CONFIG_FROM_BOOST=ON
)

See documentation about hunter_config() here https://hunter.readthedocs.io/en/latest/reference/user-modules/hunter_config.html

viniciusferrao commented 3 years ago

Hi @Bjoe thanks again, but I'm too amateurish with CMake and Hunter.

The example on the pointed reference is a broken link, the Wiki page appears to be removed: https://github.com/ruslo/hunter/wiki/example.custom.config.id; I tried to find this page but I was unsuccessful.

I've trying adding the setting on CMakeFiles.txt but that was stupid.

After I've tried to add the settings to: ./cmake/Hunter/config.cmake:

[root@rhvpower nsfminer]# cat ./cmake/Hunter/config.cmake
hunter_config(CURL VERSION ${HUNTER_CURL_VERSION} CMAKE_ARGS HTTP_ONLY=ON CMAKE_USE_OPENSSL=OFF CMAKE_USE_LIBSSH2=OFF CURL_CA_PATH=none)
hunter_config(Boost
    VERSION ${HUNTER_Boost_VERSION}
    CMAKE_ARGS USE_CONFIG_FROM_BOOST=ON
)

But it seems to have no effect at all. The issue persisted. Is there anything else missing?

rbsheth commented 3 years ago

https://github.com/cpp-pm/gate#usage-custom-config

viniciusferrao commented 3 years ago

Alright guys. It worked.

After reading the page shared by @rbsheth I've done the following:

hunter_config(CURL VERSION ${HUNTER_CURL_VERSION} CMAKE_ARGS HTTP_ONLY=ON CMAKE_USE_OPENSSL=OFF CMAKE_USE_LIBSSH2=OFF CURL_CA_PATH=none)
hunter_config(Boost
    VERSION ${HUNTER_Boost_VERSION}
    CMAKE_ARGS USE_CONFIG_FROM_BOOST=ON
)
HunterGate(
    URL "https://github.com/cpp-pm/hunter/archive/v0.23.293.tar.gz"
    SHA1 "e8e5470652db77149d9b38656db2a6c0b7642693"
    LOCAL
)

Accordingly to the documentation the LOCAL keyword searches for ${CMAKE_CURRENT_LIST_DIR}/cmake/Hunter/config.cmake; which is where I've done the changes.

So this is solved now.

The remaining questions now are:

Thanks!

Bjoe commented 3 years ago

@rbsheth As you see again.... we should use as default the boost config from boost ....

rbsheth commented 3 years ago

@Bjoe should we add that to the boost hunter.cmake?

Bjoe commented 3 years ago

@rbsheth I tried and it works, but read my https://github.com/cpp-pm/hunter/pull/316#issuecomment-757888431 ... My next idea/try is, set the cmake policy in the BoostConfig.cmake in boost .... so need to patch boost sources again and if this works, then I will bug report this to the boost project.

Hopefully I found some time for this .... I'm very busy and unfortunately there are still pull request open #122 #168 #173 from me where I like to work on and finishing this ...

viniciusferrao commented 3 years ago

Hi guys, just as a curiosity. What will be the approach here? As today I have to keep a separate branch for a software that I use that relies on Hunter because the PR wasn't accepted.

I know that's my problem :)

Thanks all.

rbsheth commented 3 years ago

Which PR are you talking about? #154 was merged a while ago.

viniciusferrao commented 3 years ago

The PR I was referencing was on the software that I use that consumes Hunter. Sorry for the mess.

That's why I'm asking which approach will be done in this issue. If the option USE_CONFIG_FROM_BOOST=ON will be standard directly on Hunter or if this In fact should be done on the software consuming Hunter.

Thanks.

Bjoe commented 3 years ago

@viniciusferrao I would like to have as default USE_CONFIG_FROM_BOOST=ON in Hunter. But unfortunately it will break for example BoostProcess because it uses boost as depend library but the project is set cmake_minimum_version(3.0) see https://github.com/alamaison/boost-process/blob/f1a4eafbedfa277b9890c6bc01a44356f53acd7b/CMakeLists.txt#L6 and then the build got an IN_LIST error. This feature is used in the boost config module.

My idea, set the policy for IN_LIST in the boost config module (and maybe also create a bug report in boost). Maybe I will find somehow some time to do this....

kapoor7997 commented 3 years ago

@viniciusferrao Hi,

I am using the latest hunter library v0.23.300 and getting this issue. I am getting the following error during the cmake process (I am using latest cmake 3.20.2)

-----------------------------Start of Error---------------------------------------- CMake Error at src/jsonrpccpp/CMakeLists.txt:144 (add_library): Target "client" links to target "intsizeof::intsizeof" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?

-- Generating done CMake Generate step failed. Build files cannot be regenerated correctly. CMakeFiles/libjson-rpc-cpp-Release.dir/build.make:94: recipe for target 'libjson-rpc-cpp-Release-prefix/src/libjson-rpc-cpp-Release-stamp/libjson-rpc-cpp-Release-configure' failed make[2]: [libjson-rpc-cpp-Release-prefix/src/libjson-rpc-cpp-Release-stamp/libjson-rpc-cpp-Release-configure] Error 1 make[2]: Leaving directory '/home/s2600bottom/.hunter/_Base/1151d53/53fea1f/4646e4e/Build/libjson-rpc-cpp/Build' CMakeFiles/Makefile2:85: recipe for target 'CMakeFiles/libjson-rpc-cpp-Release.dir/all' failed make[1]: [CMakeFiles/libjson-rpc-cpp-Release.dir/all] Error 2 make[1]: Leaving directory '/home/s2600bottom/.hunter/_Base/1151d53/53fea1f/4646e4e/Build/libjson-rpc-cpp/Build' Makefile:93: recipe for target 'all' failed make: *** [all] Error 2

[hunter FATAL ERROR ] Build step failed (dir: /home/s2600bottom/.hunter/_Base/1151d53/53fea1f/4646e4e/Build/libjson-rpc-cpp [hunter FATAL ERROR ] [Directory:/home/s2600bottom/.hunter/_Base/Download/Hunter/0.23.300/1151d53/Unpacked/cmake/projects/libjson-rpc-cpp]

------------------------------ ERROR ----------------------------- https://hunter.readthedocs.io/en/latest/reference/errors/error.external.build.failed.html

CMake Error at /home/s2600bottom/.hunter/_Base/Download/Hunter/0.23.300/1151d53/Unpacked/cmake/modules/hunter_error_page.cmake:12 (message): Call Stack (most recent call first): /home/s2600bottom/.hunter/_Base/Download/Hunter/0.23.300/1151d53/Unpacked/cmake/modules/hunter_fatal_error.cmake:20 (hunter_error_page) /home/s2600bottom/.hunter/_Base/Download/Hunter/0.23.300/1151d53/Unpacked/cmake/modules/hunter_download.cmake:623 (hunter_fatal_error) /home/s2600bottom/.hunter/_Base/Download/Hunter/0.23.300/1151d53/Unpacked/cmake/projects/libjson-rpc-cpp/hunter.cmake:61 (hunter_download) /home/s2600bottom/.hunter/_Base/Download/Hunter/0.23.300/1151d53/Unpacked/cmake/modules/hunter_add_package.cmake:62 (include) CMakeLists.txt:68 (hunter_add_package)

-- Configuring incomplete, errors occurred! See also "/opt/pkg/hostSide/ethminer-fpga/CMakeFiles/CMakeOutput.log".

--------------------------------End of error---------------------------------------------

Did you resolve this issue? Any solutions!!!!!!!!!!!!!!!!!!!

viniciusferrao commented 3 years ago

@viniciusferrao Hi,

I am using the latest hunter library v0.23.300 and getting this issue. I am getting the following error during the cmake process (I am using latest cmake 3.20.2)

-----------------------------Start of Error---------------------------------------- CMake Error at src/jsonrpccpp/CMakeLists.txt:144 (add_library): Target "client" links to target "intsizeof::intsizeof" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?

-- Generating done CMake Generate step failed. Build files cannot be regenerated correctly. CMakeFiles/libjson-rpc-cpp-Release.dir/build.make:94: recipe for target 'libjson-rpc-cpp-Release-prefix/src/libjson-rpc-cpp-Release-stamp/libjson-rpc-cpp-Release-configure' failed make[2]: [libjson-rpc-cpp-Release-prefix/src/libjson-rpc-cpp-Release-stamp/libjson-rpc-cpp-Release-configure] Error 1 make[2]: Leaving directory '/home/s2600bottom/.hunter/_Base/1151d53/53fea1f/4646e4e/Build/libjson-rpc-cpp/Build' CMakeFiles/Makefile2:85: recipe for target 'CMakeFiles/libjson-rpc-cpp-Release.dir/all' failed make[1]: [CMakeFiles/libjson-rpc-cpp-Release.dir/all] Error 2 make[1]: Leaving directory '/home/s2600bottom/.hunter/_Base/1151d53/53fea1f/4646e4e/Build/libjson-rpc-cpp/Build' Makefile:93: recipe for target 'all' failed make: *** [all] Error 2

[hunter FATAL ERROR ] Build step failed (dir: /home/s2600bottom/.hunter/_Base/1151d53/53fea1f/4646e4e/Build/libjson-rpc-cpp [hunter FATAL ERROR ] [Directory:/home/s2600bottom/.hunter/_Base/Download/Hunter/0.23.300/1151d53/Unpacked/cmake/projects/libjson-rpc-cpp]

------------------------------ ERROR -----------------------------

https://hunter.readthedocs.io/en/latest/reference/errors/error.external.build.failed.html CMake Error at /home/s2600bottom/.hunter/_Base/Download/Hunter/0.23.300/1151d53/Unpacked/cmake/modules/hunter_error_page.cmake:12 (message): Call Stack (most recent call first): /home/s2600bottom/.hunter/_Base/Download/Hunter/0.23.300/1151d53/Unpacked/cmake/modules/hunter_fatal_error.cmake:20 (hunter_error_page) /home/s2600bottom/.hunter/_Base/Download/Hunter/0.23.300/1151d53/Unpacked/cmake/modules/hunter_download.cmake:623 (hunter_fatal_error) /home/s2600bottom/.hunter/_Base/Download/Hunter/0.23.300/1151d53/Unpacked/cmake/projects/libjson-rpc-cpp/hunter.cmake:61 (hunter_download) /home/s2600bottom/.hunter/_Base/Download/Hunter/0.23.300/1151d53/Unpacked/cmake/modules/hunter_add_package.cmake:62 (include) CMakeLists.txt:68 (hunter_add_package)

-- Configuring incomplete, errors occurred! See also "/opt/pkg/hostSide/ethminer-fpga/CMakeFiles/CMakeOutput.log".

--------------------------------End of error---------------------------------------------

Did you resolve this issue? Any solutions!!!!!!!!!!!!!!!!!!!

The solution was posted seven messages behind: https://github.com/cpp-pm/hunter/issues/351#issuecomment-772103794

Unfortunately the PR wasn't merged.

kapoor7997 commented 3 years ago

@viniciusferrao

Thanks for the repply. I already have LOCAL after the SHA1. But I still get these errors. I was using a hunter v0.23.6 before. As soon as I change it to hunter v0.23.300 which is the latest (I had to change as V0.23.6 was using bintray for boost library and bintray.com is shut down for good). So I switched to hunter v0.23.300. And then I get this issue when I try to build.

You mentioned this in the #351 (comment) reply

Keep the modifications on ./cmake/Hunter/config.cmake: hunter_config(CURL VERSION ${HUNTER_CURL_VERSION} CMAKE_ARGS HTTP_ONLY=ON CMAKE_USE_OPENSSL=OFF CMAKE_USE_LIBSSH2=OFF CURL_CA_PATH=none) hunter_config(Boost VERSION ${HUNTER_Boost_VERSION} CMAKE_ARGS USE_CONFIG_FROM_BOOST=ON )

Where is the ./cmake/Hunter/config.cmake? Do I have to enter these changes?

NeroBurner commented 1 year ago

is this issue still valid with the latest Hunter? If so, what would be needed to resolve the open issue?

viniciusferrao commented 1 year ago

is this issue still valid with the latest Hunter? If so, what would be needed to resolve the open issue?

Nero I must check this. But I'm on vacation right now. I can check this on the next week.

Thanks.

viniciusferrao commented 1 year ago

I no longer have the same exactly source code, but I was able to still reproduce the issue (I think).

[root@rhvpower build]# cmake ..
-- [cable] Cable 0.1.4 initialized
-- [hunter] Initializing Hunter workspace (908ddcb223f25fa155315baae64ce0ab48a38bf7)
-- [hunter]   https://github.com/cpp-pm/hunter/archive/v0.24.7.tar.gz
-- [hunter]   -> /root/.hunter/_Base/Download/Hunter/0.24.7/908ddcb
-- [cable] Build type: Release
-- [hunter] Calculating Toolchain-SHA1
-- [hunter] Calculating Config-SHA1
-- [hunter] HUNTER_ROOT: /root/.hunter
-- [hunter] [ Hunter-ID: 908ddcb | Toolchain-ID: ebf07e1 | Config-ID: 3038148 ]
-- [hunter] BOOST_ROOT: /root/.hunter/_Base/908ddcb/ebf07e1/3038148/Install (ver.: 1.79.0)
-- [hunter] Building Boost
loading initial cache file /root/.hunter/_Base/908ddcb/ebf07e1/3038148/cache.cmake
loading initial cache file /root/.hunter/_Base/908ddcb/ebf07e1/3038148/Build/Boost/args.cmake
-- The C compiler identification is GNU 8.5.0
-- The CXX compiler identification is GNU 8.5.0
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /root/.hunter/_Base/908ddcb/ebf07e1/3038148/Build/Boost/Build
[ 12%] Creating directories for 'Boost'
[ 25%] Performing download step (download, verify and extract) for 'Boost'
-- Downloading...
   dst='/root/.hunter/_Base/Download/Boost/1.79.0/31209dc/boost_1_79_0.tar.bz2'
   timeout='none'
   inactivity timeout='none'
-- Using src='https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.bz2'
-- [download 0% complete]
-- [download 1% complete]
-- [download 2% complete]
-- [download 3% complete]
-- [download 4% complete]
-- [download 5% complete]
-- [download 6% complete]
-- [download 7% complete]
-- [download 8% complete]
-- [download 9% complete]
-- [download 10% complete]
-- [download 11% complete]
-- [download 12% complete]
-- [download 13% complete]
-- [download 14% complete]
-- [download 15% complete]
-- [download 16% complete]
-- [download 17% complete]
-- [download 18% complete]
-- [download 19% complete]
-- [download 20% complete]
-- [download 21% complete]
-- [download 22% complete]
-- [download 23% complete]
-- [download 24% complete]
-- [download 25% complete]
-- [download 26% complete]
-- [download 27% complete]
-- [download 28% complete]
-- [download 29% complete]
-- [download 30% complete]
-- [download 31% complete]
-- [download 32% complete]
-- [download 33% complete]
-- [download 34% complete]
-- [download 35% complete]
-- [download 36% complete]
-- [download 37% complete]
-- [download 38% complete]
-- [download 39% complete]
-- [download 40% complete]
-- [download 41% complete]
-- [download 42% complete]
-- [download 43% complete]
-- [download 44% complete]
-- [download 45% complete]
-- [download 46% complete]
-- [download 47% complete]
-- [download 48% complete]
-- [download 49% complete]
-- [download 50% complete]
-- [download 51% complete]
-- [download 52% complete]
-- [download 53% complete]
-- [download 54% complete]
-- [download 55% complete]
-- [download 56% complete]
-- [download 57% complete]
-- [download 58% complete]
-- [download 59% complete]
-- [download 60% complete]
-- [download 61% complete]
-- [download 62% complete]
-- [download 63% complete]
-- [download 64% complete]
-- [download 65% complete]
-- [download 66% complete]
-- [download 67% complete]
-- [download 68% complete]
-- [download 69% complete]
-- [download 70% complete]
-- [download 71% complete]
-- [download 72% complete]
-- [download 73% complete]
-- [download 74% complete]
-- [download 75% complete]
-- [download 76% complete]
-- [download 77% complete]
-- [download 78% complete]
-- [download 79% complete]
-- [download 80% complete]
-- [download 81% complete]
-- [download 82% complete]
-- [download 83% complete]
-- [download 84% complete]
-- [download 85% complete]
-- [download 86% complete]
-- [download 87% complete]
-- [download 88% complete]
-- [download 89% complete]
-- [download 90% complete]
-- [download 91% complete]
-- [download 92% complete]
-- [download 93% complete]
-- [download 94% complete]
-- [download 95% complete]
-- [download 96% complete]
-- [download 97% complete]
-- [download 98% complete]
-- [download 99% complete]
-- [download 100% complete]
-- verifying file...
       file='/root/.hunter/_Base/Download/Boost/1.79.0/31209dc/boost_1_79_0.tar.bz2'
-- Downloading... done
-- extracting...
     src='/root/.hunter/_Base/Download/Boost/1.79.0/31209dc/boost_1_79_0.tar.bz2'
     dst='/root/.hunter/_Base/908ddcb/ebf07e1/3038148/Build/Boost/Source'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[ 37%] Performing update step for 'Boost'
[ 50%] No patch step for 'Boost'
[ 62%] Performing configure step for 'Boost'
Dummy patch command
Building B2 engine..

###
###
### Using 'gcc' toolset.
###
###

g++ (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

###
###

> g++ -x c++ -std=c++11 -O2 -s -DNDEBUG builtins.cpp class.cpp command.cpp compile.cpp constants.cpp cwd.cpp debug.cpp debugger.cpp execcmd.cpp execnt.cpp execunix.cpp filesys.cpp filent.cpp fileunix.cpp frames.cpp function.cpp glob.cpp hash.cpp hcache.cpp hdrmacro.cpp headers.cpp jam_strings.cpp jam.cpp jamgram.cpp lists.cpp make.cpp make1.cpp md5.cpp mem.cpp modules.cpp native.cpp object.cpp option.cpp output.cpp parse.cpp pathnt.cpp pathsys.cpp pathunix.cpp regexp.cpp rules.cpp scan.cpp search.cpp startup.cpp subst.cpp sysinfo.cpp timestamp.cpp variable.cpp w32_getreg.cpp modules/order.cpp modules/path.cpp modules/property-set.cpp modules/regex.cpp modules/sequence.cpp modules/set.cpp -o b2
> cp b2 bjam
tools/build/src/engine/b2
Unicode/ICU support for Boost.Regex?... /usr
Generating B2 configuration in project-config.jam for gcc...

Bootstrapping is done. To build, run:

    ./b2

To generate header files, run:

    ./b2 headers

The configuration generated uses gcc to build by default. If that is
unintended either use the --with-toolset option or adjust configuration, by
editing 'project-config.jam'.

Further information:

   - Command line help:
     ./b2 --help

   - Getting started guide: 
     http://www.boost.org/more/getting_started/unix-variants.html

   - B2 documentation:
     http://www.boost.org/build/

[ 75%] No build step for 'Boost'
[ 87%] Performing install step for 'Boost'
Performing configuration checks

    - default address-model    : 64-bit [1]
    - default architecture     : power [1]

[1] gcc-8

Component configuration:

    - atomic                   : not building
    - chrono                   : not building
    - container                : not building
    - context                  : not building
    - contract                 : not building
    - coroutine                : not building
    - date_time                : not building
    - exception                : not building
    - fiber                    : not building
    - filesystem               : not building
    - graph                    : not building
    - graph_parallel           : not building
    - headers                  : building
    - iostreams                : not building
    - json                     : not building
    - locale                   : not building
    - log                      : not building
    - math                     : not building
    - mpi                      : not building
    - nowide                   : not building
    - program_options          : not building
    - python                   : not building
    - random                   : not building
    - regex                    : not building
    - serialization            : not building
    - stacktrace               : not building
    - system                   : not building
    - test                     : not building
    - thread                   : not building
    - timer                    : not building
    - type_erasure             : not building
    - wave                     : not building

loading initial cache file /root/.hunter/_Base/908ddcb/ebf07e1/3038148/Build/Boost/args.cmake
[100%] Completed 'Boost'
[100%] Built target Boost
-- [hunter] Build step successful (dir: /root/.hunter/_Base/908ddcb/ebf07e1/3038148/Build/Boost)
-- [hunter] Cache saved: /root/.hunter/_Base/Cache/raw/7e51202c22f9385b3a054fb2913a8827b5697879.tar.bz2
-- [hunter] BOOST_ROOT: /root/.hunter/_Base/908ddcb/ebf07e1/3038148/Install (ver.: 1.79.0)
-- [hunter] Building Boost (component: system)
loading initial cache file /root/.hunter/_Base/908ddcb/ebf07e1/3038148/cache.cmake
loading initial cache file /root/.hunter/_Base/908ddcb/ebf07e1/3038148/Build/Boost/__system/args.cmake
-- The C compiler identification is GNU 8.5.0
-- The CXX compiler identification is GNU 8.5.0
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /root/.hunter/_Base/908ddcb/ebf07e1/3038148/Build/Boost/__system/Build
[ 12%] Creating directories for 'Boost-system'
[ 25%] Performing download step (download, verify and extract) for 'Boost-system'
-- verifying file...
       file='/root/.hunter/_Base/Download/Boost/1.79.0/31209dc/boost_1_79_0.tar.bz2'
-- File already exists and hash match (skip download):
  file='/root/.hunter/_Base/Download/Boost/1.79.0/31209dc/boost_1_79_0.tar.bz2'
  SHA1='31209dcff292bd6a64e5e08ceb3ce44a33615dc0'
-- extracting...
     src='/root/.hunter/_Base/Download/Boost/1.79.0/31209dc/boost_1_79_0.tar.bz2'
     dst='/root/.hunter/_Base/908ddcb/ebf07e1/3038148/Build/Boost/__system/Source'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[ 37%] Performing update step for 'Boost-system'
[ 50%] No patch step for 'Boost-system'
[ 62%] Performing configure step for 'Boost-system'
Dummy patch command
Building B2 engine..

###
###
### Using 'gcc' toolset.
###
###

g++ (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

###
###

> g++ -x c++ -std=c++11 -O2 -s -DNDEBUG builtins.cpp class.cpp command.cpp compile.cpp constants.cpp cwd.cpp debug.cpp debugger.cpp execcmd.cpp execnt.cpp execunix.cpp filesys.cpp filent.cpp fileunix.cpp frames.cpp function.cpp glob.cpp hash.cpp hcache.cpp hdrmacro.cpp headers.cpp jam_strings.cpp jam.cpp jamgram.cpp lists.cpp make.cpp make1.cpp md5.cpp mem.cpp modules.cpp native.cpp object.cpp option.cpp output.cpp parse.cpp pathnt.cpp pathsys.cpp pathunix.cpp regexp.cpp rules.cpp scan.cpp search.cpp startup.cpp subst.cpp sysinfo.cpp timestamp.cpp variable.cpp w32_getreg.cpp modules/order.cpp modules/path.cpp modules/property-set.cpp modules/regex.cpp modules/sequence.cpp modules/set.cpp -o b2
> cp b2 bjam
tools/build/src/engine/b2
Unicode/ICU support for Boost.Regex?... /usr
Generating B2 configuration in project-config.jam for gcc...

Bootstrapping is done. To build, run:

    ./b2

To generate header files, run:

    ./b2 headers

The configuration generated uses gcc to build by default. If that is
unintended either use the --with-toolset option or adjust configuration, by
editing 'project-config.jam'.

Further information:

   - Command line help:
     ./b2 --help

   - Getting started guide: 
     http://www.boost.org/more/getting_started/unix-variants.html

   - B2 documentation:
     http://www.boost.org/build/

[ 75%] Performing build step for 'Boost-system'
Performing configuration checks

    - default address-model    : 64-bit [1]
    - default architecture     : power [1]

Building the Boost C++ Libraries.

[1] gcc-8

Component configuration:

    - atomic                   : not building
    - chrono                   : not building
    - container                : not building
    - context                  : not building
    - contract                 : not building
    - coroutine                : not building
    - date_time                : not building
    - exception                : not building
    - fiber                    : not building
    - filesystem               : not building
    - graph                    : not building
    - graph_parallel           : not building
    - headers                  : not building
    - iostreams                : not building
    - json                     : not building
    - locale                   : not building
    - log                      : not building
    - math                     : not building
    - mpi                      : not building
    - nowide                   : not building
    - program_options          : not building
    - python                   : not building
    - random                   : not building
    - regex                    : not building
    - serialization            : not building
    - stacktrace               : not building
    - system                   : building
    - test                     : not building
    - thread                   : not building
    - timer                    : not building
    - type_erasure             : not building
    - wave                     : not building

...found 138 targets...
...updating 21 targets...
gcc.compile.c++ bin.v2/libs/system/build/gcc-8/rls/lnk-sttc/thrd-mlt/vsblt-hdn/error_code.o
gcc.compile.c++ bin.v2/libs/system/build/gcc-8/dbg/lnk-sttc/thrd-mlt/vsblt-hdn/error_code.o
gcc.archive bin.v2/libs/system/build/gcc-8/rls/lnk-sttc/thrd-mlt/vsblt-hdn/libboost_system-mt-p64.a
gcc.archive bin.v2/libs/system/build/gcc-8/dbg/lnk-sttc/thrd-mlt/vsblt-hdn/libboost_system-mt-d-p64.a
common.copy /root/.hunter/_Base/908ddcb/ebf07e1/3038148/Build/Boost/__system/Source/stage/lib/libboost_system-mt-p64.a
common.copy /root/.hunter/_Base/908ddcb/ebf07e1/3038148/Build/Boost/__system/Source/stage/lib/libboost_system-mt-d-p64.a
...updated 21 targets...

The Boost C++ Libraries were successfully built!

The following directory should be added to compiler include paths:

    /root/.hunter/_Base/908ddcb/ebf07e1/3038148/Build/Boost/__system/Source

The following directory should be added to linker library paths:

    /root/.hunter/_Base/908ddcb/ebf07e1/3038148/Build/Boost/__system/Source/stage/lib

[ 87%] Performing install step for 'Boost-system'
Performing configuration checks

    - default address-model    : 64-bit [1]
    - default architecture     : power [1]

[1] gcc-8

Component configuration:

    - atomic                   : not building
    - chrono                   : not building
    - container                : not building
    - context                  : not building
    - contract                 : not building
    - coroutine                : not building
    - date_time                : not building
    - exception                : not building
    - fiber                    : not building
    - filesystem               : not building
    - graph                    : not building
    - graph_parallel           : not building
    - headers                  : not building
    - iostreams                : not building
    - json                     : not building
    - locale                   : not building
    - log                      : not building
    - math                     : not building
    - mpi                      : not building
    - nowide                   : not building
    - program_options          : not building
    - python                   : not building
    - random                   : not building
    - regex                    : not building
    - serialization            : not building
    - stacktrace               : not building
    - system                   : building
    - test                     : not building
    - thread                   : not building
    - timer                    : not building
    - type_erasure             : not building
    - wave                     : not building

[100%] Completed 'Boost-system'
[100%] Built target Boost-system
-- [hunter] Build step successful (dir: /root/.hunter/_Base/908ddcb/ebf07e1/3038148/Build/Boost/__system)
-- [hunter] Cache saved: /root/.hunter/_Base/Cache/raw/8adc8b8167aaa587dcc9a2371627929984041556.tar.bz2
CMake Error at /root/.hunter/_Base/Download/Hunter/0.24.7/908ddcb/Unpacked/cmake/find/FindBoost.cmake:1273 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.79.0

  Boost include path:
  /root/.hunter/_Base/908ddcb/ebf07e1/3038148/Install/include

  Could not find the following static Boost libraries:

          boost_system

  No Boost libraries were found.  You may need to set BOOST_LIBRARYDIR to the
  directory containing Boost libraries or BOOST_ROOT to the location of
  Boost.
Call Stack (most recent call first):
  /root/.hunter/_Base/908ddcb/ebf07e1/3038148/Install/lib/cmake/Boost/BoostConfig.cmake:51 (find_package)
  CMakeLists.txt:90 (find_package)

[hunter ** INTERNAL **] Library not exists: Boost_SYSTEM_LIBRARY_DEBUG-NOTFOUND
[hunter ** INTERNAL **] [Directory:/root/.hunter/_Base/908ddcb/ebf07e1/3038148/Install/lib/cmake/Boost]

------------------------------ ERROR -----------------------------
    https://hunter.readthedocs.io/en/latest/reference/errors/error.internal.html
------------------------------------------------------------------

CMake Error at /root/.hunter/_Base/Download/Hunter/0.24.7/908ddcb/Unpacked/cmake/modules/hunter_error_page.cmake:12

It seems to be the same issue, Hunter is able to build Boost successfully but it fails to link it.

Is anything else that I can do or provide?

Thanks.

NeroBurner commented 1 year ago

Mysterious. The error is at Boost::system build time as far as I can see

Could you try to build the Boost example directly from hunter? Just to be sure we have the same CMake config to work with

git clone --recursive https://github.com/cpp-pm/hunter.git
cd hunter/examples/Boost-chrono-useBoostConfig/
cmake -H. -Bbuild -DHUNTER_ENABLED=ON -DHUNTER_STATUS_DEBUG=ON |& tee build.log

Afterwards please upload the build.log file so we can do some data forensics ;)

viniciusferrao commented 1 year ago

Hi @NeroBurner, Boost-chrono-useBoostConfig seems to have worked as expeceted. But the issue is with Boost-system. So I've compiled both, and Boost-system failed with what seems to be the same issue.

I'm attaching both logs.

Thanks.

build-Boost-chrono-useBoostConfig.log build-Boost-system.log

NeroBurner commented 1 year ago

The BoostConfig.cmake file doesnt find the boost system Library. Can you show me what is installed in the library path

I think it should be this path, according to your logs

ls /root/hunter/_Base/xxxxxxx/19404f8/314d74e/Install/lib
viniciusferrao commented 1 year ago

There you go:

[root@rhvpower lib]# pwd
/root/hunter/_Base/xxxxxxx/19404f8/314d74e/Install/lib
[root@rhvpower lib]# ls -R
.:
cmake  libboost_system-mt-d-p64.a  libboost_system-mt-p64.a

./cmake:
Boost

./cmake/Boost:
BoostConfig.cmake  BoostConfigVersion.cmake
NeroBurner commented 1 year ago

so the library is definitely there. Next step in debugging :)

please add the config.cmake from examples/Boost-chrono-useBoostConfig https://github.com/cpp-pm/hunter/blob/master/examples/Boost-chrono-useBoostConfig/config.cmake to the examples/Boost-system example and try it again.

There should be no FindBoost.cmake calls in the logs, rather the BoostConfig.cmake file should be used

Please report back if it works, and add the logs from the Boost-system example cmake call with the added config.cmake

viniciusferrao commented 1 year ago

Hmmm it's working now.

config.cmake:

hunter_config(Boost
    VERSION ${HUNTER_Boost_VERSION}
    CMAKE_ARGS USE_CONFIG_FROM_BOOST=ON
)

CMakeLists.txt (I've added the set line):

# Copyright (c) 2013, Ruslan Baratov
# All rights reserved.

cmake_minimum_required(VERSION 3.0)

set(Boost_DEBUG ON CACHE BOOLEAN "")
set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake)

# Emulate HunterGate:
# * https://github.com/hunter-packages/gate
include("../common.cmake")

project(download-boost)

hunter_add_package(Boost COMPONENTS system)
find_package(Boost CONFIG REQUIRED system)

add_executable(foo foo.cpp)
target_link_libraries(foo PUBLIC Boost::system)

file(GLOB_RECURSE boost_configs "${BOOST_ROOT}/*/BoostConfig.cmake")
list(LENGTH boost_configs len)
if(NOT len GREATER "0")
  message(FATAL_ERROR "Not even one *Config: ${boost_configs}")
endif()

And finally the attached build.log: build.log

Thanks.

NeroBurner commented 1 year ago

wohoo it works! You're welcome

viniciusferrao commented 1 year ago

Hi @NeroBurner thanks!

Just let me ask something. Isn’t the case to also update the Hunter examples? Specifically Boost-system to reflect the changes made on the last message?

NeroBurner commented 1 year ago

In this case no, I don't think so. We already have examples/Boost-chrono-useBoostConfig to test the useBoostConfig parameter (as an alteration to the examples/Boost-chrono one). So adding a examples/Boost-system-useBoostConfig would be redundant

I'd personally like to set the default of USE_BOOST_CONFIG=ON. Do you know if the BoostProcess error is fixed mentioned by @Bjoe in https://github.com/cpp-pm/hunter/issues/351#issuecomment-815567125 ?

@rbsheth do you have an opinion about this? As I think the OFF default will regularly lead to confusion with hunter and Boost with users