cpp-pm / hunter

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

fatal error C1083: Cannot open include file: 'json/json.h': No such file or directory #662

Open Zhaojun-Liu opened 1 year ago

Zhaojun-Liu commented 1 year ago

Hi all, I tried to build Aleth with VS2022 on Windows, but it failed at the cmake step. Could anyone helps look at this issue? Thanks in advance.

Environment: VS2022 + Windows Server

Repro steps:

  1. Open a VS 2022 x64 Native Tools command.
  2. git clone https://github.com/ethereum/aleth F:\gitP\ethereum\aleth
  3. cd F:\gitP\ethereum\aleth
  4. git submodule update --init --recursive
  5. mkdir build_amd64 & cd build_amd64
  6. set HUNTER_ROOT=F:\gitP\ethereum\hunter_tools_New
  7. cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_SYSTEM_VERSION=10.0.22621.0 -DCMAKE_BUILD_TYPE=Release ..

CmakeLists.txt CMakeLists.txt

Result: F:\gitP\ethereum\hunter_tools_New_Base\8010d63\7ad3772\0db49b4\Build\libjson-rpc-cpp\Build\libjson-rpc-cpp-Release-prefix\src\libjson-rpc-cpp-Release-build\gen\jsonrpccpp\common\jsonparser.h(13,10): fatal error C1083: Cannot open include file: 'json/json.h': No such file or directory (C:\repos\msvc\src\vctools\Compiler\CxxFE\sl\p1\c\p0prepro.c:1955)

detailed logs: camke.log

NeroBurner commented 1 year ago

does the same thing happen when you try to compile the json-rpc-cpp example from the Hunter repo? https://github.com/cpp-pm/hunter/blob/master/examples/libjson-rpc-cpp/CMakeLists.txt

Zhaojun-Liu commented 1 year ago

Hi @NeroBurner, I tried the json-rpc-cpp example from the Hunter repo, the same error as below:

Checking Build System
    Building Custom Rule F:/hunter/_Base/xxxxxxx/18afadb/e1cac17/Build/libjson-rpc-cpp/Source/src/jsonrpccpp/CMakeLists.txt
    errors.cpp
F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\libjson-rpc-cpp-Release-prefix\src\libjson-rpc-cpp-Release-build\gen\jsonrpccpp\common\jsonparser.h(13,10): fatal error C1083: Cannot open include file: 'json/json.h': No such file or directory (C:\repos\msvc\src\vctools\Compiler\CxxFE\sl\p1\c\p0prepro.c:1955) [F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\libjson-rpc-cpp-Release-prefix\src\libjson-rpc-cpp-Release-build\src\jsonrpccpp\common.vcxproj] [F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\libjson-rpc-cpp-Release.vcxproj]
    exception.cpp
F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\libjson-rpc-cpp-Release-prefix\src\libjson-rpc-cpp-Release-build\gen\jsonrpccpp\common\jsonparser.h(13,10): fatal error C1083: Cannot open include file: 'json/json.h': No such file or directory (C:\repos\msvc\src\vctools\Compiler\CxxFE\sl\p1\c\p0prepro.c:1955) [F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\libjson-rpc-cpp-Release-prefix\src\libjson-rpc-cpp-Release-build\src\jsonrpccpp\common.vcxproj] [F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\libjson-rpc-cpp-Release.vcxproj]
    procedure.cpp
F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\libjson-rpc-cpp-Release-prefix\src\libjson-rpc-cpp-Release-build\gen\jsonrpccpp\common\jsonparser.h(13,10): fatal error C1083: Cannot open include file: 'json/json.h': No such file or directory (C:\repos\msvc\src\vctools\Compiler\CxxFE\sl\p1\c\p0prepro.c:1955) [F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\libjson-rpc-cpp-Release-prefix\src\libjson-rpc-cpp-Release-build\src\jsonrpccpp\common.vcxproj] [F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\libjson-rpc-cpp-Release.vcxproj]
    specificationparser.cpp
F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\libjson-rpc-cpp-Release-prefix\src\libjson-rpc-cpp-Release-build\gen\jsonrpccpp\common\jsonparser.h(13,10): fatal error C1083: Cannot open include file: 'json/json.h': No such file or directory (C:\repos\msvc\src\vctools\Compiler\CxxFE\sl\p1\c\p0prepro.c:1955) [F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\libjson-rpc-cpp-Release-prefix\src\libjson-rpc-cpp-Release-build\src\jsonrpccpp\common.vcxproj] [F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\libjson-rpc-cpp-Release.vcxproj]
    specificationwriter.cpp
F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\libjson-rpc-cpp-Release-prefix\src\libjson-rpc-cpp-Release-build\gen\jsonrpccpp\common\jsonparser.h(13,10): fatal error C1083: Cannot open include file: 'json/json.h': No such file or directory (C:\repos\msvc\src\vctools\Compiler\CxxFE\sl\p1\c\p0prepro.c:1955) [F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\libjson-rpc-cpp-Release-prefix\src\libjson-rpc-cpp-Release-build\src\jsonrpccpp\common.vcxproj] [F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\libjson-rpc-cpp-Release.vcxproj]
    Generating Code...
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(247,5): error MSB8066: Custom build for 'F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\CMakeFiles\9f5ec4964eacb4fbc840882a51edb310\libjson-rpc-cpp-Release-mkdir.rule;F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\CMakeFiles\9f5ec4964eacb4fbc840882a51edb310\libjson-rpc-cpp-Release-download.rule;F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\CMakeFiles\9f5ec4964eacb4fbc840882a51edb310\libjson-rpc-cpp-Release-update.rule;F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\CMakeFiles\9f5ec4964eacb4fbc840882a51edb310\libjson-rpc-cpp-Release-patch.rule;F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\CMakeFiles\9f5ec4964eacb4fbc840882a51edb310\libjson-rpc-cpp-Release-configure.rule;F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\CMakeFiles\9f5ec4964eacb4fbc840882a51edb310\libjson-rpc-cpp-Release-build.rule;F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\CMakeFiles\9f5ec4964eacb4fbc840882a51edb310\libjson-rpc-cpp-Release-install.rule;F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\CMakeFiles\19fef4e8c90eb21d5e0265405175d8fc\libjson-rpc-cpp-Release-complete.rule;F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\CMakeFiles\1286d4e0ece16bcfef655e2b57d1dd65\libjson-rpc-cpp-Release.rule;F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\CMakeLists.txt' exited with code 1. [F:\hunter\_Base\xxxxxxx\18afadb\e1cac17\Build\libjson-rpc-cpp\Build\libjson-rpc-cpp-Release.vcxproj]

[hunter ** FATAL ERROR **] Build step failed (dir: F:/hunter/_Base/xxxxxxx/18afadb/e1cac17/Build/libjson-rpc-cpp
[hunter ** FATAL ERROR **] [Directory:F:/hunter/cmake/projects/libjson-rpc-cpp]

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

CMake Error at F:/hunter/cmake/modules/hunter_error_page.cmake:12 (message):
Call Stack (most recent call first):
  F:/hunter/cmake/modules/hunter_fatal_error.cmake:20 (hunter_error_page)
  F:/hunter/cmake/modules/hunter_download.cmake:623 (hunter_fatal_error)
  F:/hunter/cmake/projects/libjson-rpc-cpp/hunter.cmake:61 (hunter_download)
  F:/hunter/cmake/modules/hunter_add_package.cmake:62 (include)
  CMakeLists.txt:8 (hunter_add_package)

-- Configuring incomplete, errors occurred!
See also "F:/hunter/examples/libjson-rpc-cpp/build/CMakeFiles/CMakeOutput.log".
Zhaojun-Liu commented 1 year ago

Hi @NeroBurner, any update for this issue?

NeroBurner commented 1 year ago

There is no entry in the package status page for libjson-rpc-cpp so I can't say if it is an expected error (compiler/OS not supported) or a new error of an outdated package (in comparison to the compiler)

I can confirm that the issue persists compiling on Ubuntu 22.04 with gcc 11.3.0.

So it is probably an always broken package. PRs with a fix and update for the package are very welcome