View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015029CMakeCMakepublic2014-07-18 15:172015-01-05 08:39
Reporterdarlingm 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionno change required 
PlatformPCOSCentOSOS Version5
Product VersionCMake 3.0 
Target VersionFixed in Version 
Summary0015029: Segmentation fault handling packages (infinite loop, ?perhaps fills up memory?)
DescriptionLoading gdb for cmake and the associated dropped core file gives:

Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000003646e576b0 in _IO_vfscanf_internal () from /lib64/libc.so.6
(gdb) bt
#0 0x0000003646e576b0 in _IO_vfscanf_internal () from /lib64/libc.so.6
#1 0x0000003646e62eb5 in vsscanf () from /lib64/libc.so.6
0000002 0x0000003646e5dfe8 in sscanf () from /lib64/libc.so.6
0000003 0x00000000007b89d1 in cmFindPackageCommand::InitialPass(std::vector<std::string, std::allocator<std::string> > const&, cmExecutionStatus&) ()
0000004 0x00000000007c5b35 in cmCommand::InvokeInitialPass(std::vector<cmListFileArgument, std::allocator<cmListFileArgument> > const&, cmExecutionStatus&) ()
0000005 0x00000000006c80ba in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&) ()
0000006 0x00000000006c901e in cmMakefile::ReadListFile(char const*, char const*, std::string*, bool) ()
0000007 0x00000000007bce56 in cmFindPackageCommand::ReadListFile(char const*, cmFindPackageCommand::PolicyScopeRule) ()
0000008 0x00000000007bb531 in cmFindPackageCommand::FindModule(bool&) ()
#9 0x00000000007ba1d4 in cmFindPackageCommand::InitialPass(std::vector<std::string, std::allocator<std::string> > const&, cmExecutionStatus&) ()
0000010 0x00000000007c5b35 in cmCommand::InvokeInitialPass(std::vector<cmListFileArgument, std::allocator<cmListFileArgument> > const&, cmExecutionStatus&) ()
#11 0x00000000006c80ba in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&) ()
0000012 0x00000000006c901e in cmMakefile::ReadListFile(char const*, char const*, std::string*, bool) ()
0000013 0x00000000007bce56 in cmFindPackageCommand::ReadListFile(char const*, cmFindPackageCommand::PolicyScopeRule) ()
0000014 0x00000000007bb531 in cmFindPackageCommand::FindModule(bool&) ()
........... this InitialPass(0000003)->FindModule(0000008) repeats ...........
#31413 0x00000000007ba1d4 in cmFindPackageCommand::InitialPass(std::vector<std::string, std::allocator<std::string> > const&, cmExecutionStatus&) ()
#31414 0x00000000007c5b35 in cmCommand::InvokeInitialPass(std::vector<cmListFileArgument, std::allocator<cmListFileArgument> > const&, cmExecutionStatus&) ()
#31415 0x00000000006c80ba in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&) ()
#31416 0x00000000006c901e in cmMakefile::ReadListFile(char const*, char const*, std::string*, bool) ()
#31417 0x00000000006b1ac4 in cmLocalGenerator::ReadInputFile() ()
#31418 0x00000000006b163e in cmLocalGenerator::Configure() ()
#31419 0x00000000008b33c7 in cmLocalUnixMakefileGenerator3::Configure() ()
#31420 0x00000000006ccdfa in cmMakefile::ConfigureSubDirectory(cmLocalGenerator*) ()
#31421 0x00000000006cd224 in cmMakefile::AddSubDirectory(char const*, char const*, bool, bool, bool) ()
#31422 0x000000000079b462 in cmAddSubDirectoryCommand::InitialPass(std::vector<std::string, std::allocator<std::string> > const&, cmExecutionStatus&) ()
#31423 0x00000000007c5b35 in cmCommand::InvokeInitialPass(std::vector<cmListFileArgument, std::allocator<cmListFileArgument> > const&, cmExecutionStatus&) ()
#31424 0x00000000006c80ba in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&) ()
#31425 0x00000000006c901e in cmMakefile::ReadListFile(char const*, char const*, std::string*, bool) ()
#31426 0x00000000006b1ac4 in cmLocalGenerator::ReadInputFile() ()
#31427 0x00000000006b163e in cmLocalGenerator::Configure() ()
#31428 0x00000000008b33c7 in cmLocalUnixMakefileGenerator3::Configure() ()
#31429 0x000000000087edea in cmGlobalGenerator::Configure() ()
#31430 0x000000000089bca2 in cmGlobalUnixMakefileGenerator3::Configure() ()
#31431 0x000000000076657e in cmake::ActualConfigure() ()
#31432 0x0000000000765ec2 in cmake::Configure() ()
#31433 0x0000000000766d5c in cmake::Run(std::vector<std::string, std::allocator<std::string> > const&, bool) ()
#31434 0x0000000000681031 in do_cmake(int, char const* const*) ()
#31435 0x00000000006808b5 in main ()
Steps To ReproduceExtract attached codeTestPackages.tar.gz. mkdir build && cd build && cmake ..
Additional InformationI'm attempting to use packages in my build system for the first time. I have no doubt I've done something wrong in the CMakeLists.txt files or FindLIB.cmake file, but I've caused CMake to segmentation fault with a very small reduced case. (Entire project is 41 lines.)
TagsNo tags attached.
Attached Filesgz file icon codeTestPackages.tar.gz [^] (754 bytes) 2014-07-18 15:17

 Relationships

  Notes
(0036411)
darlingm (reporter)
2014-07-18 15:29

I compiled from source (cmake-3.0.0.tar.gz)

gcc v4.9.0, with its libstdc++
CentOS 5
kernel 2.6.18-308.24.1.el5
(0036412)
darlingm (reporter)
2014-07-18 15:39

commenting out the "find_package(LIB REQUIRED)" line in app/CMakeLists.txt prevents the segfault. (of course, then, the library header isn't found.) Also tried changing the line to "find_package(LIB REQUIRED MODULE)" but still got the segfault.
(0036413)
darlingm (reporter)
2014-07-18 15:59

Compiling from git source (cmake version 3.0.20140718-g36a81) still gives segfault.
(0036414)
Brad King (manager)
2014-07-18 16:11

The FindLIB.cmake file calls find_package(LIB) which recurses back into the module. This infinite recursion crashes when CMake runs out of stack space. Drop that line.
(0036415)
darlingm (reporter)
2014-07-18 16:34
edited on: 2014-07-18 17:45

Sorry about that! Misunderstood someone else's example.

Removing that line avoids the segfault. Also tried changing FindLIB.cmake from "LIB_INCLUDE_DIRS" to "LIB_INCLUDE_DIRECTORIES". I get no errors from cmake, but when making app, lib.h isn't found (turning on verbose mode shows the include directory isn't passed to g++.) I realize the fix for that isn't a bug, but my understanding of how to set this up, so I'd be more than happy to bring this to stackoverflow or the mailing list if you'd prefer. I was under the impression that since CMake 2.8.11, these include directories would automatically be used when using find_package - without needing for each app to do a "include_directories(${LIB_INCLUDE_DIRECTORIES})" or LIB_INCLUDE_DIRS or whichever is proper.

(0036419)
Brad King (manager)
2014-07-21 09:20

Re 0015029:0036415: 2.8.11 started introducing "usage requirements" but they still need to be specified. See here:

 http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html#build-specification-and-usage-requirements [^]

Further help can be obtained on the mailing list:

 http://www.cmake.org/mailman/listinfo/cmake [^]
(0037590)
Robert Maynard (manager)
2015-01-05 08:39

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

 Issue History
Date Modified Username Field Change
2014-07-18 15:17 darlingm New Issue
2014-07-18 15:17 darlingm File Added: codeTestPackages.tar.gz
2014-07-18 15:29 darlingm Note Added: 0036411
2014-07-18 15:39 darlingm Note Added: 0036412
2014-07-18 15:59 darlingm Note Added: 0036413
2014-07-18 16:11 Brad King Note Added: 0036414
2014-07-18 16:34 darlingm Note Added: 0036415
2014-07-18 17:17 darlingm Note Edited: 0036415
2014-07-18 17:45 darlingm Note Edited: 0036415
2014-07-21 09:20 Brad King Note Added: 0036419
2014-07-21 09:20 Brad King Status new => resolved
2014-07-21 09:20 Brad King Resolution open => no change required
2015-01-05 08:39 Robert Maynard Note Added: 0037590
2015-01-05 08:39 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team