Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with CMake`s check_type_size #972

Open
pfhgil opened this issue May 8, 2024 · 0 comments
Open

Problem with CMake`s check_type_size #972

pfhgil opened this issue May 8, 2024 · 0 comments

Comments

@pfhgil
Copy link

pfhgil commented May 8, 2024

Hi, I'm getting a rather strange error when installing zlib using vcpkg. I use MinGW Clang for cross compilation and my MinGW triplet for vcpkg (it differs from the standard x64-mingw-dynamic triplet only in the installation of the mingw-llvm toolchain). No error occurs when building for the host device.

I noticed that this error seems to appear on line 42 of zlib's CMakeLists.txt. This line says check_type_size(off64_t OFF64_T)

Host:

  • Linux Mint
  • Compiler: GCC 11.4.0

Target:

  • MinGW x86_64
  • Compiler llvm-mingw

Vcpkg version: 2024-02-07-8a83681f921b10d86ae626fd833c253f4f8c355b
Build type: release

Target triplet:

set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "/home/ilya/pixelfield/test-windows/cmake/mingw.cmake")

set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_ENV_PASSTHROUGH PATH)

set(VCPKG_CMAKE_SYSTEM_NAME MinGW)
set(VCPKG_POLICY_DLLS_WITHOUT_LIBS enabled)

Using toolchain:

SET(CMAKE_C_COMPILER "$ENV{SUNGEAR_LLVM_MINGW_PATH}/bin/x86_64-w64-mingw32-clang")
SET(CMAKE_CXX_COMPILER "$ENV{SUNGEAR_LLVM_MINGW_PATH}/bin/x86_64-w64-mingw32-clang++")
SET(CMAKE_ASM_COMPILER "$ENV{SUNGEAR_LLVM_MINGW_PATH}/bin/x86_64-w64-mingw32-clang")
set(CMAKE_RC_COMPILER "$ENV{SUNGEAR_LLVM_MINGW_PATH}/bin/llvm-rc")

config-sg-x64-mingw-dynamic-out.log:

[1/2] "/home/ilya/.vcpkg-clion/vcpkg/downloads/tools/cmake-3.27.1-linux/cmake-3.27.1-linux-x86_64/bin/cmake" -E chdir "../../sg-x64-mingw-dynamic-dbg" "/home/ilya/.vcpkg-clion/vcpkg/downloads/tools/cmake-3.27.1-linux/cmake-3.27.1-linux-x86_64/bin/cmake" "/home/ilya/.vcpkg-clion/vcpkg/buildtrees/zlib/src/v1.3.1-2e5db616bf.clean" "-G" "Ninja" "-DCMAKE_BUILD_TYPE=Debug" "-DCMAKE_INSTALL_PREFIX=/home/ilya/.vcpkg-clion/vcpkg/packages/zlib_sg-x64-mingw-dynamic/debug" "-DFETCHCONTENT_FULLY_DISCONNECTED=ON" "-DSKIP_INSTALL_FILES=ON" "-DZLIB_BUILD_EXAMPLES=OFF" "-DCMAKE_MAKE_PROGRAM=/home/ilya/.vcpkg-clion/vcpkg/downloads/tools/ninja/1.10.2-linux/ninja" "-DCMAKE_SYSTEM_NAME=MinGW" "-DBUILD_SHARED_LIBS=ON" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/home/ilya/pixelfield/test-windows/cmake/mingw.cmake" "-DVCPKG_TARGET_TRIPLET=sg-x64-mingw-dynamic" "-DVCPKG_SET_CHARSET_FLAG=ON" "-DVCPKG_PLATFORM_TOOLSET=external" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" "-DCMAKE_TOOLCHAIN_FILE=/home/ilya/.vcpkg-clion/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=" "-DVCPKG_CXX_FLAGS_RELEASE=" "-DVCPKG_CXX_FLAGS_DEBUG=" "-DVCPKG_C_FLAGS=" "-DVCPKG_C_FLAGS_RELEASE=" "-DVCPKG_C_FLAGS_DEBUG=" "-DVCPKG_CRT_LINKAGE=static" "-DVCPKG_LINKER_FLAGS=" "-DVCPKG_LINKER_FLAGS_RELEASE=" "-DVCPKG_LINKER_FLAGS_DEBUG=" "-DVCPKG_TARGET_ARCHITECTURE=x64" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" "-D_VCPKG_ROOT_DIR=/home/ilya/.vcpkg-clion/vcpkg" "-D_VCPKG_INSTALLED_DIR=/home/ilya/pixelfield/test-windows/cmake-build-release-mingw-x86-64/vcpkg_installed" "-DVCPKG_MANIFEST_INSTALL=OFF" "-DSKIP_INSTALL_HEADERS=ON"
FAILED: ../../sg-x64-mingw-dynamic-dbg/CMakeCache.txt 
"/home/ilya/.vcpkg-clion/vcpkg/downloads/tools/cmake-3.27.1-linux/cmake-3.27.1-linux-x86_64/bin/cmake" -E chdir "../../sg-x64-mingw-dynamic-dbg" "/home/ilya/.vcpkg-clion/vcpkg/downloads/tools/cmake-3.27.1-linux/cmake-3.27.1-linux-x86_64/bin/cmake" "/home/ilya/.vcpkg-clion/vcpkg/buildtrees/zlib/src/v1.3.1-2e5db616bf.clean" "-G" "Ninja" "-DCMAKE_BUILD_TYPE=Debug" "-DCMAKE_INSTALL_PREFIX=/home/ilya/.vcpkg-clion/vcpkg/packages/zlib_sg-x64-mingw-dynamic/debug" "-DFETCHCONTENT_FULLY_DISCONNECTED=ON" "-DSKIP_INSTALL_FILES=ON" "-DZLIB_BUILD_EXAMPLES=OFF" "-DCMAKE_MAKE_PROGRAM=/home/ilya/.vcpkg-clion/vcpkg/downloads/tools/ninja/1.10.2-linux/ninja" "-DCMAKE_SYSTEM_NAME=MinGW" "-DBUILD_SHARED_LIBS=ON" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/home/ilya/pixelfield/test-windows/cmake/mingw.cmake" "-DVCPKG_TARGET_TRIPLET=sg-x64-mingw-dynamic" "-DVCPKG_SET_CHARSET_FLAG=ON" "-DVCPKG_PLATFORM_TOOLSET=external" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" "-DCMAKE_TOOLCHAIN_FILE=/home/ilya/.vcpkg-clion/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=" "-DVCPKG_CXX_FLAGS_RELEASE=" "-DVCPKG_CXX_FLAGS_DEBUG=" "-DVCPKG_C_FLAGS=" "-DVCPKG_C_FLAGS_RELEASE=" "-DVCPKG_C_FLAGS_DEBUG=" "-DVCPKG_CRT_LINKAGE=static" "-DVCPKG_LINKER_FLAGS=" "-DVCPKG_LINKER_FLAGS_RELEASE=" "-DVCPKG_LINKER_FLAGS_DEBUG=" "-DVCPKG_TARGET_ARCHITECTURE=x64" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" "-D_VCPKG_ROOT_DIR=/home/ilya/.vcpkg-clion/vcpkg" "-D_VCPKG_INSTALLED_DIR=/home/ilya/pixelfield/test-windows/cmake-build-release-mingw-x86-64/vcpkg_installed" "-DVCPKG_MANIFEST_INSTALL=OFF" "-DSKIP_INSTALL_HEADERS=ON"
-- The C compiler identification is Clang 18.1.5
System is unknown to cmake, create:
Platform/MinGW 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/MinGW 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 - failed
-- Check for working C compiler: /home/ilya/pixelfield/llvm-mingw-20240502-msvcrt-ubuntu-20.04-x86_64/bin/x86_64-w64-mingw32-clang
System is unknown to cmake, create:
Platform/MinGW to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Check for working C compiler: /home/ilya/pixelfield/llvm-mingw-20240502-msvcrt-ubuntu-20.04-x86_64/bin/x86_64-w64-mingw32-clang - works
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for sys/types.h
System is unknown to cmake, create:
Platform/MinGW to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Looking for sys/types.h - found
-- Looking for stdint.h
System is unknown to cmake, create:
Platform/MinGW to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Looking for stdint.h - found
-- Looking for stddef.h
System is unknown to cmake, create:
Platform/MinGW to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Looking for stddef.h - found
-- Check size of off64_t
System is unknown to cmake, create:
Platform/MinGW to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
CMake Error at /home/ilya/.vcpkg-clion/vcpkg/downloads/tools/cmake-3.27.1-linux/cmake-3.27.1-linux-x86_64/share/cmake-3.27/Modules/CheckTypeSize.cmake:146 (try_compile):
  Cannot copy output executable

    ''

  to destination specified by COPY_FILE:

    '/home/ilya/.vcpkg-clion/vcpkg/buildtrees/zlib/sg-x64-mingw-dynamic-dbg/CMakeFiles/CheckTypeSize/OFF64_T.bin'

  because:

    No such file or directory (input)

  Recorded try_compile output location doesn't exist:

    /home/ilya/.vcpkg-clion/vcpkg/buildtrees/zlib/sg-x64-mingw-dynamic-dbg/CMakeFiles/CMakeScratch/TryCompile-QwZPze/cmTC_e2858

Call Stack (most recent call first):
  /home/ilya/.vcpkg-clion/vcpkg/downloads/tools/cmake-3.27.1-linux/cmake-3.27.1-linux-x86_64/share/cmake-3.27/Modules/CheckTypeSize.cmake:271 (__check_type_size_impl)
  CMakeLists.txt:42 (check_type_size)


-- Looking for fseeko
System is unknown to cmake, create:
Platform/MinGW to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Looking for fseeko - found
-- Looking for unistd.h
System is unknown to cmake, create:
Platform/MinGW 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
-- Configuring incomplete, errors occurred!
[2/2] "/home/ilya/.vcpkg-clion/vcpkg/downloads/tools/cmake-3.27.1-linux/cmake-3.27.1-linux-x86_64/bin/cmake" -E chdir ".." "/home/ilya/.vcpkg-clion/vcpkg/downloads/tools/cmake-3.27.1-linux/cmake-3.27.1-linux-x86_64/bin/cmake" "/home/ilya/.vcpkg-clion/vcpkg/buildtrees/zlib/src/v1.3.1-2e5db616bf.clean" "-G" "Ninja" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=/home/ilya/.vcpkg-clion/vcpkg/packages/zlib_sg-x64-mingw-dynamic" "-DFETCHCONTENT_FULLY_DISCONNECTED=ON" "-DSKIP_INSTALL_FILES=ON" "-DZLIB_BUILD_EXAMPLES=OFF" "-DCMAKE_MAKE_PROGRAM=/home/ilya/.vcpkg-clion/vcpkg/downloads/tools/ninja/1.10.2-linux/ninja" "-DCMAKE_SYSTEM_NAME=MinGW" "-DBUILD_SHARED_LIBS=ON" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/home/ilya/pixelfield/test-windows/cmake/mingw.cmake" "-DVCPKG_TARGET_TRIPLET=sg-x64-mingw-dynamic" "-DVCPKG_SET_CHARSET_FLAG=ON" "-DVCPKG_PLATFORM_TOOLSET=external" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" "-DCMAKE_TOOLCHAIN_FILE=/home/ilya/.vcpkg-clion/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=" "-DVCPKG_CXX_FLAGS_RELEASE=" "-DVCPKG_CXX_FLAGS_DEBUG=" "-DVCPKG_C_FLAGS=" "-DVCPKG_C_FLAGS_RELEASE=" "-DVCPKG_C_FLAGS_DEBUG=" "-DVCPKG_CRT_LINKAGE=static" "-DVCPKG_LINKER_FLAGS=" "-DVCPKG_LINKER_FLAGS_RELEASE=" "-DVCPKG_LINKER_FLAGS_DEBUG=" "-DVCPKG_TARGET_ARCHITECTURE=x64" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" "-D_VCPKG_ROOT_DIR=/home/ilya/.vcpkg-clion/vcpkg" "-D_VCPKG_INSTALLED_DIR=/home/ilya/pixelfield/test-windows/cmake-build-release-mingw-x86-64/vcpkg_installed" "-DVCPKG_MANIFEST_INSTALL=OFF"
FAILED: ../CMakeCache.txt 
"/home/ilya/.vcpkg-clion/vcpkg/downloads/tools/cmake-3.27.1-linux/cmake-3.27.1-linux-x86_64/bin/cmake" -E chdir ".." "/home/ilya/.vcpkg-clion/vcpkg/downloads/tools/cmake-3.27.1-linux/cmake-3.27.1-linux-x86_64/bin/cmake" "/home/ilya/.vcpkg-clion/vcpkg/buildtrees/zlib/src/v1.3.1-2e5db616bf.clean" "-G" "Ninja" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=/home/ilya/.vcpkg-clion/vcpkg/packages/zlib_sg-x64-mingw-dynamic" "-DFETCHCONTENT_FULLY_DISCONNECTED=ON" "-DSKIP_INSTALL_FILES=ON" "-DZLIB_BUILD_EXAMPLES=OFF" "-DCMAKE_MAKE_PROGRAM=/home/ilya/.vcpkg-clion/vcpkg/downloads/tools/ninja/1.10.2-linux/ninja" "-DCMAKE_SYSTEM_NAME=MinGW" "-DBUILD_SHARED_LIBS=ON" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/home/ilya/pixelfield/test-windows/cmake/mingw.cmake" "-DVCPKG_TARGET_TRIPLET=sg-x64-mingw-dynamic" "-DVCPKG_SET_CHARSET_FLAG=ON" "-DVCPKG_PLATFORM_TOOLSET=external" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" "-DCMAKE_TOOLCHAIN_FILE=/home/ilya/.vcpkg-clion/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=" "-DVCPKG_CXX_FLAGS_RELEASE=" "-DVCPKG_CXX_FLAGS_DEBUG=" "-DVCPKG_C_FLAGS=" "-DVCPKG_C_FLAGS_RELEASE=" "-DVCPKG_C_FLAGS_DEBUG=" "-DVCPKG_CRT_LINKAGE=static" "-DVCPKG_LINKER_FLAGS=" "-DVCPKG_LINKER_FLAGS_RELEASE=" "-DVCPKG_LINKER_FLAGS_DEBUG=" "-DVCPKG_TARGET_ARCHITECTURE=x64" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" "-D_VCPKG_ROOT_DIR=/home/ilya/.vcpkg-clion/vcpkg" "-D_VCPKG_INSTALLED_DIR=/home/ilya/pixelfield/test-windows/cmake-build-release-mingw-x86-64/vcpkg_installed" "-DVCPKG_MANIFEST_INSTALL=OFF"
-- The C compiler identification is Clang 18.1.5
System is unknown to cmake, create:
Platform/MinGW 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/MinGW 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 - failed
-- Check for working C compiler: /home/ilya/pixelfield/llvm-mingw-20240502-msvcrt-ubuntu-20.04-x86_64/bin/x86_64-w64-mingw32-clang
System is unknown to cmake, create:
Platform/MinGW to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Check for working C compiler: /home/ilya/pixelfield/llvm-mingw-20240502-msvcrt-ubuntu-20.04-x86_64/bin/x86_64-w64-mingw32-clang - works
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for sys/types.h
System is unknown to cmake, create:
Platform/MinGW to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Looking for sys/types.h - found
-- Looking for stdint.h
System is unknown to cmake, create:I noticed that this error seems to appear on line 42 of zlib's CMakeLists.txt. This line says ```check_type_size(off64_t OFF64_T)```
Platform/MinGW to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Looking for stdint.h - found
-- Looking for stddef.h
System is unknown to cmake, create:
Platform/MinGW to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Looking for stddef.h - found
-- Check size of off64_t
System is unknown to cmake, create:
Platform/MinGW to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
CMake Error at /home/ilya/.vcpkg-clion/vcpkg/downloads/tools/cmake-3.27.1-linux/cmake-3.27.1-linux-x86_64/share/cmake-3.27/Modules/CheckTypeSize.cmake:146 (try_compile):
  Cannot copy output executable

    ''

  to destination specified by COPY_FILE:

    '/home/ilya/.vcpkg-clion/vcpkg/buildtrees/zlib/sg-x64-mingw-dynamic-rel/CMakeFiles/CheckTypeSize/OFF64_T.bin'

  because:

    No such file or directory (input)

  Recorded try_compile output location doesn't exist:

    /home/ilya/.vcpkg-clion/vcpkg/buildtrees/zlib/sg-x64-mingw-dynamic-rel/CMakeFiles/CMakeScratch/TryCompile-IHn0yx/cmTC_b32eb

Call Stack (most recent call first):
  /home/ilya/.vcpkg-clion/vcpkg/downloads/tools/cmake-3.27.1-linux/cmake-3.27.1-linux-x86_64/share/cmake-3.27/Modules/CheckTypeSize.cmake:271 (__check_type_size_impl)
  CMakeLists.txt:42 (check_type_size)


-- Looking for fseeko
System is unknown to cmake, create:
Platform/MinGW to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Looking for fseeko - found
-- Looking for unistd.h
System is unknown to cmake, create:
Platform/MinGW 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
-- Configuring incomplete, errors occurred!
ninja: build stopped: subcommand failed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant