rizsotto / Bear

Bear is a tool that generates a compilation database for clang tooling.
GNU General Public License v3.0
4.76k stars 312 forks source link

build proccess broken on MSYS2 #427

Closed FrostKiwi closed 2 years ago

FrostKiwi commented 2 years ago
CMAKE OUTPUT of "cmake -DENABLE_UNIT_TESTS=OFF -DENABLE_FUNC_TESTS=OFF .." ``` -- The C compiler identification is GNU 11.2.0 -- The CXX compiler identification is GNU 11.2.0 System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Detecting C compiler ABI info System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Detecting C compiler ABI info - done -- Check for working C compiler: /mingw64/bin/cc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /mingw64/bin/CC.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Setting build type to 'Release' as none was specified. -- Looking for nlohman_json dependency -- Looking for nlohman_json dependency -- not found -- Looking for fmt dependency -- Looking for fmt dependency -- found -- Looking for spdlog dependency -- Looking for pthread.h System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Looking for spdlog dependency -- found -- Looking for gRPC::grpc++ dependency -- Found PkgConfig: /mingw64/bin/pkg-config.exe (found version "1.8.0") -- Checking for modules 'protobuf>=3.11;grpc++>=1.26' -- Found protobuf, version 3.16.0.0 -- Found grpc++, version 1.35.0 -- Looking for gRPC::grpc++ dependency -- found -- Looking for protoc -- Looking for protoc -- found -- Looking for grpc_cpp_plugin -- Looking for grpc_cpp_plugin -- found -- Configuring done -- Generating done -- Build files have been written to: /home/Bayonetta2.0/new-horizon/lbs/Bear/build ```
MAKE OUTPUT of "make all" ``` [ 0%] Built target grpc_dependency [ 0%] Built target googletest_dependency [ 5%] Creating directories for 'nlohmann_json_dependency' [ 11%] Performing download step (download, verify and extract) for 'nlohmann_json_dependency' -- Downloading... dst='/home/Bayonetta2.0/new-horizon/lbs/Bear/build/subprojects/Download/nlohmann_json_dependency/v3.10.4.tar.gz' timeout='none' inactivity timeout='none' -- Using src='https://github.com/nlohmann/json/archive/v3.10.4.tar.gz' -- verifying file... file='/home/Bayonetta2.0/new-horizon/lbs/Bear/build/subprojects/Download/nlohmann_json_dependency/v3.10.4.tar.gz' -- Downloading... done -- extracting... src='/home/Bayonetta2.0/new-horizon/lbs/Bear/build/subprojects/Download/nlohmann_json_dependency/v3.10.4.tar.gz' dst='/home/Bayonetta2.0/new-horizon/lbs/Bear/build/subprojects/Source/nlohmann_json_dependency' -- extracting... [tar xfz] -- extracting... [analysis] -- extracting... [rename] -- extracting... [clean up] -- extracting... done [ 17%] No update step for 'nlohmann_json_dependency' [ 23%] No patch step for 'nlohmann_json_dependency' [ 29%] Performing configure step for 'nlohmann_json_dependency' -- nlohmann_json_dependency configure command succeeded. See also /home/Bayonetta2.0/new-horizon/lbs/Bear/build/subprojects/Stamp/nlohmann_json_dependency/nlohmann_json_dependency-configure-*.log [ 35%] Performing build step for 'nlohmann_json_dependency' -- nlohmann_json_dependency build command succeeded. See also /home/Bayonetta2.0/new-horizon/lbs/Bear/build/subprojects/Stamp/nlohmann_json_dependency/nlohmann_json_dependency-build-*.log [ 41%] Performing install step for 'nlohmann_json_dependency' -- nlohmann_json_dependency install command succeeded. See also /home/Bayonetta2.0/new-horizon/lbs/Bear/build/subprojects/Stamp/nlohmann_json_dependency/nlohmann_json_dependency-install-*.log [ 47%] Completed 'nlohmann_json_dependency' [ 47%] Built target nlohmann_json_dependency [ 47%] Built target fmt_dependency [ 47%] Built target spdlog_dependency [ 52%] Creating directories for 'BearSource' [ 58%] No download step for 'BearSource' [ 64%] No update step for 'BearSource' [ 70%] No patch step for 'BearSource' [ 76%] Performing configure step for 'BearSource' loading initial cache file /home/Bayonetta2.0/new-horizon/lbs/Bear/build/subprojects/tmp/BearSource/BearSource-cache-Release.cmake -- The C compiler identification is GNU 11.2.0 -- The CXX compiler identification is GNU 11.2.0 System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Detecting C compiler ABI info System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Detecting C compiler ABI info - done -- Check for working C compiler: /mingw64/bin/cc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /mingw64/bin/CC.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Looking for pthread.h System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Found nlohmann_json: /home/Bayonetta2.0/new-horizon/lbs/Bear/build/subprojects/Install/nlohmann_json_dependency/lib/cmake/nlohmann_json/nlohmann_jsonConfig.cmake (found version "3.10.4") -- Found PkgConfig: /mingw64/bin/pkg-config.exe (found version "1.8.0") -- Checking for modules 'protobuf;grpc++' -- Found protobuf, version 3.16.0.0 -- Found grpc++, version 1.35.0 -- Looking for spawn.h System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for spawn.h - not found -- Looking for unistd.h System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for unistd.h - found -- Looking for dlfcn.h System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for dlfcn.h - found -- Looking for errno.h System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for errno.h - found -- Looking for sys/utsname.h System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for sys/utsname.h - not found -- Looking for sys/wait.h System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for sys/wait.h - not found -- Looking for sys/time.h System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for sys/time.h - found -- Looking for gnu/lib-names.h System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for gnu/lib-names.h - not found -- Looking for _NSGetEnviron System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for _NSGetEnviron - not found -- Looking for dlopen System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for dlopen - found -- Looking for dlsym System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for dlsym - found -- Looking for dlerror System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for dlerror - found -- Looking for dlclose System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for dlclose - found -- Looking for RTLD_NEXT System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for RTLD_NEXT - found -- Looking for EACCES System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for EACCES - found -- Looking for ENOENT System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for ENOENT - found -- Looking for strerror_r System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for strerror_r - not found -- Looking for environ System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for environ - not found -- Looking for uname System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for uname - not found -- Looking for confstr System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for confstr - not found -- Looking for _CS_PATH System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for _CS_PATH - not found -- Looking for _CS_GNU_LIBC_VERSION System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for _CS_GNU_LIBC_VERSION - not found -- Looking for _CS_GNU_LIBPTHREAD_VERSION System is unknown to cmake, create: Platform/MINGW64_NT-10.0-19043 to use this system, please post your config file on discourse.cmake.org so it can be added to cmake -- Looking for _CS_GNU_LIBPTHREAD_VERSION - not found -- Looking for protoc ... /mingw64/bin/protoc.exe -- Looking for grpc_cpp_plugin ... /mingw64/bin/grpc_cpp_plugin.exe -- Configuring done CMake Error in intercept/CMakeLists.txt: Target "rpc_a" contains relative path in its INTERFACE_INCLUDE_DIRECTORIES: "C:/msys64/mingw64/include" CMake Error in intercept/CMakeLists.txt: Target "rpc_a" contains relative path in its INTERFACE_INCLUDE_DIRECTORIES: "C:/msys64/mingw64/include" CMake Error in intercept/CMakeLists.txt: Target "domain_a" contains relative path in its INTERFACE_INCLUDE_DIRECTORIES: "C:/msys64/mingw64/include" CMake Error in intercept/CMakeLists.txt: Target "intercept_a" contains relative path in its INTERFACE_INCLUDE_DIRECTORIES: "C:/msys64/mingw64/include" CMake Error in intercept/CMakeLists.txt: Target "domain_a" contains relative path in its INTERFACE_INCLUDE_DIRECTORIES: "C:/msys64/mingw64/include" CMake Error in intercept/CMakeLists.txt: Target "wrapper_a" contains relative path in its INTERFACE_INCLUDE_DIRECTORIES: "C:/msys64/mingw64/include" CMake Error in intercept/proto/CMakeLists.txt: Target "PkgConfig::gRPC" contains relative path in its INTERFACE_INCLUDE_DIRECTORIES: "C:/msys64/mingw64/include" CMake Error in citnames/CMakeLists.txt: Target "events_db_a" contains relative path in its INTERFACE_INCLUDE_DIRECTORIES: "C:/msys64/mingw64/include" CMake Error in citnames/CMakeLists.txt: Target "citnames_a" contains relative path in its INTERFACE_INCLUDE_DIRECTORIES: "C:/msys64/mingw64/include" -- Generating done CMake Generate step failed. Build files cannot be regenerated correctly. make[2]: *** [CMakeFiles/BearSource.dir/build.make:95: subprojects/Stamp/BearSource/BearSource-configure] Error 1 make[1]: *** [CMakeFiles/Makefile2:174: CMakeFiles/BearSource.dir/all] Error 2 make: *** [Makefile:156: all] Error 2 ```

Describe the bug Building Bear on MSYS2 with the MinGW64-GCC Toolchain fails with the errors CMake Error [...] Target [...] contains relative path in its INTERFACE_INCLUDE_DIRECTORIES: [...] , see logs above. The build process up to that point runs flawlessly. This was initially reported here: https://github.com/rizsotto/Bear/issues/294 The GNU Toolchain on Windows is available via the "MinGW64" project. To build and program stuff you go through a Unix environment for windows called "MSYS2" which provides the package manager Pacman, like with Arch Linux. Via that environment you install the MinGW64 toolchain, basically a port of GCC for 64-bit Windows, which supports the Windows API.

I wonder if this has to do with the fact, that cmake does not list MinGW Makefiles as an option with bear's cmake files, hence the Cmake warning Platform/MINGW64_NT-10.0-19043 to use this system [...] I expect it to be listed as an "cmake -G" option, but maybe I am confusing stuff. It should work with the default cmake "Unix Makefiles" just fine...

I am a happy user of Emacs + LSP Clangd to program on my FreeBSD machine. To get the compilation commands for LSP ready, I use Bear. Due to the need of my program running on Windows, and MinGW64 support for cross-compilation being good on Linux, but bad on FreeBSD, I am forced build my stuff on a Windows 10 machine. Everything works flawlessly, except for the Bear build process.

To Reproduce Build with MSYS2 MinGW64 GCC toolchain

Expected behavior Build without errors

Environment:

FrostKiwi commented 2 years ago

Ups, I had the wrong cmake installed. Turns out I had used msys/cmake and not mingw64/cmake and the system did not notify me of that. Indeed, the missing -G options should have tipped me off. I now have the same problem as: https://github.com/msys2/MINGW-packages/issues/7411