View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015345CMakeModulespublic2015-01-12 07:432015-06-01 08:38
ReporterDavid Coppa 
Assigned ToRolf Eike Beer 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake 3.1 
Target VersionCMake 3.1.1Fixed in VersionCMake 3.1.1 
Summary0015345: FindRuby: Problem with "find_package(Ruby 2.0)"
DescriptionOS is OpenBSD, but I think this also applies to Linux or other Unix-like OSes.
Both ruby-2.0.0 and ruby-2.1.5 are installed on the system:

$ ls -1 /usr/local/bin/ruby*
/usr/local/bin/ruby20
/usr/local/bin/ruby21

Using "find_package(Ruby 2.1)" works as expected:

-- ATTENTION -> Ruby_FIND_VERSION_MINOR == 1
-- ATTENTION -> setting Ruby_FIND_VERSION_SHORT_NODOT...
-- --------FindRuby.cmake debug------------
-- _RUBY_POSSIBLE_EXECUTABLE_NAMES: ruby2.1;ruby21;ruby;ruby2.0;ruby20;ruby1.9;ruby19;ruby1.8;ruby18
-- _RUBY_POSSIBLE_LIB_NAMES: ruby;ruby-static;ruby2.1;ruby21;ruby-2.1;ruby-2.1.0
-- RUBY_ARCH_DIR: /usr/local/lib/ruby/2.1/x86_64-openbsd
-- RUBY_HDR_DIR: /usr/local/include/ruby-2.1
-- RUBY_POSSIBLE_LIB_DIR: /usr/local/lib
-- Found RUBY_VERSION: "2.1.0" , short: "2.1", nodot: "21"
-- _RUBY_REQUIRED_VARS: RUBY_EXECUTABLE;RUBY_INCLUDE_DIR;RUBY_LIBRARY;RUBY_CONFIG_INCLUDE_DIR
-- RUBY_EXECUTABLE: /usr/local/bin/ruby21
-- RUBY_LIBRARY: /usr/local/lib/libruby21.so.1.0
-- RUBY_INCLUDE_DIR: /usr/local/include/ruby-2.1
-- RUBY_CONFIG_INCLUDE_DIR: /usr/local/include/ruby-2.1/x86_64-openbsd
-- --------------------
-- Found Ruby: /usr/local/bin/ruby21 (found suitable version "2.1.0", minimum required is "2.1")

** NOTE: I've added some messages to help understand the problem and set _RUBY_DEBUG_OUTPUT to true.

While "find_package(Ruby 2.0)" is broken:

-- ATTENTION -> Ruby_FIND_VERSION_MINOR == 0
-- --------FindRuby.cmake debug------------
-- _RUBY_POSSIBLE_EXECUTABLE_NAMES: ruby;ruby2.1;ruby21;ruby2.0;ruby20;ruby1.9;ruby19;ruby1.8;ruby18
-- _RUBY_POSSIBLE_LIB_NAMES: ruby;ruby-static;ruby2.1;ruby21;ruby-2.1;ruby-2.1.0
-- RUBY_ARCH_DIR: /usr/local/lib/ruby/2.1/x86_64-openbsd
-- RUBY_HDR_DIR: /usr/local/include/ruby-2.1
-- RUBY_POSSIBLE_LIB_DIR: /usr/local/lib
-- Found RUBY_VERSION: "2.1.0" , short: "2.1", nodot: "21"
-- _RUBY_REQUIRED_VARS: RUBY_EXECUTABLE;RUBY_INCLUDE_DIR;RUBY_LIBRARY;RUBY_CONFIG_INCLUDE_DIR
-- RUBY_EXECUTABLE: /usr/local/bin/ruby21
-- RUBY_LIBRARY: /usr/local/lib/libruby21.so.1.0
-- RUBY_INCLUDE_DIR: /usr/local/include/ruby-2.1
-- RUBY_CONFIG_INCLUDE_DIR: /usr/local/include/ruby-2.1/x86_64-openbsd
-- --------------------
-- Found Ruby: /usr/local/bin/ruby21 (found suitable version "2.1.0", minimum required is "2.0")

This is because, when "Ruby_FIND_VERSION_MINOR" is 0, the "if(Ruby_FIND_VERSION_MAJOR AND Ruby_FIND_VERSION_MINOR)" check at line 61 evaluates to false.

Changing line 61 to:

"if(DEFINED Ruby_FIND_VERSION_MAJOR AND DEFINED Ruby_FIND_VERSION_MINOR)"

works around the issue for me:

-- ATTENTION -> Ruby_FIND_VERSION_MINOR == 0
-- ATTENTION -> setting Ruby_FIND_VERSION_SHORT_NODOT ...
-- --------FindRuby.cmake debug------------
-- _RUBY_POSSIBLE_EXECUTABLE_NAMES: ruby2.0;ruby20;ruby;ruby2.1;ruby21;ruby1.9;ruby19;ruby1.8;ruby18
-- _RUBY_POSSIBLE_LIB_NAMES: ruby;ruby-static;ruby2.0;ruby20;ruby-2.0;ruby-2.0.0
-- RUBY_ARCH_DIR: /usr/local/lib/ruby/2.0/x86_64-openbsd
-- RUBY_HDR_DIR: /usr/local/include/ruby-2.0
-- RUBY_POSSIBLE_LIB_DIR: /usr/local/lib
-- Found RUBY_VERSION: "2.0.0" , short: "2.0", nodot: "20"
-- _RUBY_REQUIRED_VARS: RUBY_EXECUTABLE;RUBY_INCLUDE_DIR;RUBY_LIBRARY;RUBY_CONFIG_INCLUDE_DIR
-- RUBY_EXECUTABLE: /usr/local/bin/ruby20
-- RUBY_LIBRARY: /usr/local/lib/libruby20.so.1.0
-- RUBY_INCLUDE_DIR: /usr/local/include/ruby-2.0
-- RUBY_CONFIG_INCLUDE_DIR: /usr/local/include/ruby-2.0/x86_64-openbsd
-- --------------------
-- Found Ruby: /usr/local/bin/ruby20 (found suitable version "2.0.0", minimum required is "2.0")

Steps To ReproduceUse "find_package(Ruby 2.0)" or "find_package(Ruby 2.0 EXACT)"
TagsNo tags attached.
Attached Filespatch file icon 0001-Fix-FindRuby-find_package-with-version.patch [^] (917 bytes) 2015-01-12 09:19 [Show Content]

 Relationships

  Notes
(0037670)
Rolf Eike Beer (developer)
2015-01-12 08:42

Thanks, I will look into this later. It would be helpful if you could attach a git patch to give you proper attribution.
(0037671)
Ben Boeckel (developer)
2015-01-12 11:45

@Rolf, there's the '--author=John Doe <foo@example.com>' argument to 'git commit' as well.
(0037672)
Rolf Eike Beer (developer)
2015-01-12 12:28

Sure, but I'm not allowed to see his email address in Mantis.
(0037673)
Rolf Eike Beer (developer)
2015-01-12 13:31

Fix pushed to next:

  http://www.cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dd5d2eb156b7e45ded53f694a12a1e00d19f6cd6 [^]

Fix is based on release, so it can go into 3.1.1.
(0038835)
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
2015-01-12 07:43 David Coppa New Issue
2015-01-12 08:42 Rolf Eike Beer Note Added: 0037670
2015-01-12 08:45 Brad King Target Version => CMake 3.1.1
2015-01-12 09:19 David Coppa File Added: 0001-Fix-FindRuby-find_package-with-version.patch
2015-01-12 11:45 Ben Boeckel Note Added: 0037671
2015-01-12 12:28 Rolf Eike Beer Note Added: 0037672
2015-01-12 13:31 Rolf Eike Beer Note Added: 0037673
2015-01-12 13:31 Rolf Eike Beer Assigned To => Rolf Eike Beer
2015-01-12 13:31 Rolf Eike Beer Status new => resolved
2015-01-12 13:31 Rolf Eike Beer Resolution open => fixed
2015-01-12 13:31 Rolf Eike Beer Category CMake => Modules
2015-01-12 13:31 Rolf Eike Beer Fixed in Version => CMake 3.1.1
2015-06-01 08:38 Robert Maynard Note Added: 0038835
2015-06-01 08:38 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team