Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,801
    • Issues 3,801
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #23115

Closed
Open
Created Jan 17, 2022 by Etienne Arnal@etienne.arnal

CMake generation fail in check_type_size(off64_t OFF64_T) related to CMAKE_EXECUTABLE_SUFFIX definition

Hi CMake users,

In trying to compile zlib repository, I faced a very strange CMake generation error:

CMake Error at /dev/install/cmake-3.19.5-Linux-x86_64/share/cmake-3.19/Modules/CheckTypeSize.cmake:135 (try_compile):
  Cannot copy output executable

    ''

  to destination specified by COPY_FILE:

    '/dev/build/CMakeFiles/CheckTypeSize/OFF64_T.bin'

  Unable to find the executable at any of:

    /dev/build/CMakeFiles/CMakeTmp/cmTC_e470b.x
    /dev/build/CMakeFiles/CMakeTmp/Debug/cmTC_e470b.x
    /dev/build/CMakeFiles/CMakeTmp/Development/cmTC_e470b.x

Call Stack (most recent call first):
  /dev/install/cmake-3.19.5-Linux-x86_64/share/cmake-3.19/Modules/CheckTypeSize.cmake:266 (__check_type_size_impl)
  CMakeLists.txt:8 (check_type_size)

To identify the root of this error, I reproduced in a small CMakeLists:

cmake_minimum_required(VERSION 3.19)
project(zlib C)
set(CMAKE_EXECUTABLE_SUFFIX ".x")

include(CheckTypeSize)

set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
check_type_size(off64_t OFF64_T)

With this small example the generation fail:

cmake -G Ninja -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_BUILD_TYPE=Release ..

-- The C compiler identification is Intel 19.0.5.20190815
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/intel_2019/compilers_and_libraries_2019.5.281/linux/bin/intel64/icc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- var : OFF64_T :  src : /dev/build/CMakeFiles/CheckTypeSize/OFF64_T.c : bin : /dev/build/CMakeFiles/CheckTypeSize/OFF64_T.bin : CMAKE_TRY_COMPILE_CONFIGURATION =
-- CMAKE_REQUIRED_DEFINITIONS : -D_LARGEFILE64_SOURCE=1 :  CMAKE_REQUIRED_LINK_OPTIONS :  : CMAKE_REQUIRED_LINK_OPTIONS :  : CMAKE_REQUIRED_LIBRARIES  : -DCOMPILE_DEFINITIONS:STRING=  : -DINCLUDE_DIRECTORIES:STRING=
CMake Error at /dev/install/cmake-3.19.5-Linux-x86_64/share/cmake-3.19/Modules/CheckTypeSize.cmake:135 (try_compile):
  Cannot copy output executable

    ''

  to destination specified by COPY_FILE:

    '/dev/build/CMakeFiles/CheckTypeSize/OFF64_T.bin'

  Unable to find the executable at any of:

    /dev/build/CMakeFiles/CMakeTmp/cmTC_e470b.x
    /dev/build/CMakeFiles/CMakeTmp/Debug/cmTC_e470b.x
    /dev/build/CMakeFiles/CMakeTmp/Development/cmTC_e470b.x

Call Stack (most recent call first):
  /dev/install/cmake-3.19.5-Linux-x86_64/share/cmake-3.19/Modules/CheckTypeSize.cmake:266 (__check_type_size_impl)
  CMakeLists.txt:8 (check_type_size)


-- Configuring incomplete, errors occurred!
See also "/dev/build/CMakeFiles/CMakeOutput.log".

We also observed two things:

  1. It fails only on the first generation
  2. It works when the set(CMAKE_EXECUTABLE_SUFFIX ".x") is commented 🤔

Any ideas ?

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking