MantisBT - CMake
View Issue Details
0012184CMakeModulespublic2011-05-11 16:442014-06-02 08:39
wheat 
jschueller 
normaltweakalways
closedfixed 
AppleMac OS XSnow Leopard
CMake 2.8.4 
CMake 3.0 
0012184: SWIG_ADD_MODULE generates wrong file name for Ruby under Mac OS X
Ruby requires the extension to be named as "foo.bundle", but SWIG_ADD_MODULE generates the target as "libfoo.so".
No tags attached.
patch 0001-UseSWIG-adjust-module-name-for-ruby.patch (4,807) 2012-04-02 16:03
https://public.kitware.com/Bug/file/4280/0001-UseSWIG-adjust-module-name-for-ruby.patch
Issue History
2011-05-11 16:44wheatNew Issue
2012-02-11 11:55Rolf Eike BeerAssigned To => Mathieu Malaterre
2012-02-11 11:55Rolf Eike BeerStatusnew => assigned
2012-02-11 11:55Rolf Eike BeerCategoryCMake => Modules
2012-04-02 16:03Felix SchwitzerFile Added: 0001-UseSWIG-adjust-module-name-for-ruby.patch
2012-04-02 16:11Felix SchwitzerNote Added: 0029060
2013-11-28 04:27jschuellerAssigned ToMathieu Malaterre => jschueller
2013-11-28 04:28jschuellerNote Added: 0034607
2013-11-28 16:16Felix SchwitzerNote Added: 0034612
2013-12-02 13:06jschuellerNote Added: 0034680
2013-12-02 13:06jschuellerStatusassigned => resolved
2013-12-02 13:06jschuellerFixed in Version => CMake 3.0
2013-12-02 13:06jschuellerResolutionopen => fixed
2014-06-02 08:39Robert MaynardNote Added: 0036097
2014-06-02 08:39Robert MaynardStatusresolved => closed

Notes
(0029060)
Felix Schwitzer   
2012-04-02 16:11   
The problem exists not only on Mac OSX, but also on linux and windows (cygwin and mingw).
I dug into ruby's own build system and makefile generator (generate_makefile in mkmf.rb) and found, that the name for the extension module is
"$(TARGET).#{CONFIG['DLEXT']}", so the library name is the module name
without prefix and the extension(suffix) is platform dependent
(.so on linux/cygwin/wingw, .bundle on mac).
I believe the best is to ask the ruby-interpreter for the extension, like
FindRuby.cmake it does for RUBY_ARCH and others.

I implemented this approach in the attached patch.
The patch generates a dependency to FindRuby, but when building a ruby extension
the assumption that a ruby interpreter is installed on the build machine is
reasonable, or isn't it?
(0034607)
jschueller   
2013-11-28 04:28   
Here is a more naive approach:
http://cmake.org/gitweb?p=stage/cmake.git;a=commitdiff;h=74f5545d0aa0a4ba6856b1280782b2c23185a6e1 [^]
(0034612)
Felix Schwitzer   
2013-11-28 16:16   
Great. I tested your patch and it works fine for me, thanks.
I checked also the naming convention for ruby 2.0 and it seems that nothing
changed here.

Maybe my initial approach was a little bit too intrusive...
(0034680)
jschueller   
2013-12-02 13:06   
http://cmake.org/gitweb?p=stage/cmake.git;a=commitdiff;h=f3a10191e714e39965c43b704ac17024968bbf31;hp=406635fd6c35e046a2f8b5647c49beae6c7f5f00 [^]
(0036097)
Robert Maynard   
2014-06-02 08:39   
Closing resolved issues that have not been updated in more than 4 months.