View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015325CMakeCMakepublic2014-12-22 16:272015-06-01 08:38
ReporterDavid Coppa 
Assigned ToBrad King 
PrioritynormalSeveritycrashReproducibilityalways
StatusclosedResolutionfixed 
Platformx86_64OSLinuxOS Version
Product VersionCMake 3.1 
Target VersionCMake 3.1.1Fixed in VersionCMake 3.1.1 
Summary0015325: Regression building x265 using CMake 3.1 (Segmentation fault)
DescriptionCMake 3.1 segfaults while building x265 using the ninja generator, "Unix Makefiles" generator is not affected.
This crash didn't happen with cmake-3.0.2 (same version of x265).

I have the same segfault on both Arch Linux and OpenBSD-current.

I've attached two files with the gdb output for both systems.

You can have a look at the source code for x265 here:
https://github.com/videolan/x265/tree/master/source/cmake [^]

$ cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr ../source/
-- cmake version 3.1.0
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler using: Ninja
-- Check for working CXX compiler using: Ninja -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detected x86 target processor
-- Looking for include file inttypes.h
-- Looking for include file inttypes.h - found
-- Performing Test CC_HAS_NO_NARROWING
-- Performing Test CC_HAS_NO_NARROWING - Success
-- Performing Test CC_HAS_NO_ARRAY_BOUNDS
-- Performing Test CC_HAS_NO_ARRAY_BOUNDS - Success
-- Performing Test CC_HAS_FAST_MATH
-- Performing Test CC_HAS_FAST_MATH - Success
-- Performing Test CC_HAS_STACK_REALIGN
-- Performing Test CC_HAS_STACK_REALIGN - Success
-- Performing Test CC_HAS_FNO_EXCEPTIONS_FLAG
-- Performing Test CC_HAS_FNO_EXCEPTIONS_FLAG - Success
-- Found yasm: /usr/bin/yasm (found version "1.3.0")
-- Found Yasm 1.3.0 to build assembly primitives
-- x265 version 1.4
-- The ASM_YASM compiler identification is unknown
-- Found assembler: /usr/bin/yasm
-- Looking for strtok_r
-- Looking for strtok_r - found
-- Looking for include file getopt.h
-- Looking for include file getopt.h - found
-- Configuring done
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_ASM_YASM_COMPILE_OBJECT
Segmentation fault (core dumped)
Steps To ReproduceTry building x265 using the ninja generator of CMake 3.1.0.
TagsNo tags attached.
Attached Files? file icon cmake31-x265-openbsd.out [^] (32,623 bytes) 2014-12-22 16:27
? file icon cmake31-x265-arch-linux.out [^] (25,475 bytes) 2014-12-22 16:29
log file icon trace.log [^] (2,469,776 bytes) 2014-12-22 17:56

 Relationships

  Notes
(0037514)
David Coppa (reporter)
2014-12-22 17:57

Also added log for cmake in trace mode.
(0037515)
Brad King (manager)
2014-12-22 18:32

Git bisects to:

 cmTarget: Compute languages from object libraries on demand.
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=042c1c83 [^]
(0037516)
Brad King (manager)
2014-12-22 18:38

Here is a fix to the crash:

 Ninja: Do not crash when CMAKE_<LANG>_COMPILE_OBJECT is empty
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9a13fcbf [^]

The error message about CMAKE_ASM_YASM_COMPILE_OBJECT not being available still appears with Ninja but not Makefiles.
(0037517)
Brad King (manager)
2014-12-22 18:42

Side note: I noticed x265's CMakeLists.txt file has:

if(POLICY CMP0025)
    cmake_policy(SET CMP0025 OLD) # report Apple's Clang as just Clang
endif()


Policies should never be set to OLD except in maintenance branches for existing project releases. The development branches should be fixed to deal with the policy's NEW behavior.
(0037518)
Brad King (manager)
2014-12-22 19:06

The x265 project should be fixed to enable ASM_YASM at the top level. Here is why:

The "x265-shared" target specifies "$<TARGET_OBJECTS:common>", and the "common" object library uses the ASM_YASM language. This means the "x265-shared" target uses the ASM_YASM language. This is not defined behavior because the ASM_YASM language is not enabled in the top-level directory containing the "x265-shared" target. This worked in earlier versions of CMake only by accident.

For reference, consider the case of enabling C at the top level and CXX in a subdirectory defining an object library. If a target in the top level uses objects from a C++ object library in the subdirectory then the C++ compiler front-end would be chosen to drive linking of the target. However, the CXX language is not enabled at the top level so no information is available to construct the link rule.
(0037521)
Brad King (manager)
2014-12-23 08:19

While x265 should still be fixed, we can make the existing case continue to work:

 Ninja: Generate rules only for languages compiled in a target
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fdbfcfdf [^]

 Tests: Test using objects from a language enabled in a subdirectory
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=07fc7b75 [^]
(0038828)
Robert Maynard (manager)
2015-06-01 08:38

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2014-12-22 16:27 David Coppa New Issue
2014-12-22 16:27 David Coppa File Added: cmake31-x265-openbsd.out
2014-12-22 16:29 David Coppa File Added: cmake31-x265-arch-linux.out
2014-12-22 17:56 David Coppa File Added: trace.log
2014-12-22 17:57 David Coppa Note Added: 0037514
2014-12-22 18:25 Brad King Status new => acknowledged
2014-12-22 18:25 Brad King Target Version => CMake 3.1.1
2014-12-22 18:25 Brad King Description Updated
2014-12-22 18:32 Brad King Note Added: 0037515
2014-12-22 18:38 Brad King Note Added: 0037516
2014-12-22 18:42 Brad King Note Added: 0037517
2014-12-22 19:06 Brad King Note Added: 0037518
2014-12-23 08:19 Brad King Note Added: 0037521
2014-12-23 08:19 Brad King Assigned To => Brad King
2014-12-23 08:19 Brad King Status acknowledged => resolved
2014-12-23 08:19 Brad King Resolution open => fixed
2014-12-23 08:19 Brad King Fixed in Version => CMake 3.1.1
2015-06-01 08:38 Robert Maynard Note Added: 0038828
2015-06-01 08:38 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team