Package: ruby-mkrf
Version: 0.2.3+dfsg-2
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch quantal

ruby-mkrf fails to build with a linker that defaults to --as-needed.

This is because of incorrect link ordering: it puts libraries before the
objects that use them rather than after.  See:

  http://wiki.debian.org/ToolChain/DSOLinking#Only_link_with_needed_libraries

The attached patch fixes this.


Build log:

> cd 
> /tmp/buildd/ruby-mkrf-0.2.3+dfsg/test/sample_files/libxml-ruby-0.3.8/ext/xml/;
>  /usr/bin/ruby1.8 extconf.rb; rake
>  extconf failure: need zlib
> [...]
>   1) Failure:
> test_that_libxml_compiles(TestSampleProjects)
>     [./test/unit/../abstract_unit.rb:42:in `assert_creates_file'
>      ./test/integration/test_sample_projects.rb:20:in 
> `test_that_libxml_compiles']:
> ./test/integration/../sample_files/libxml-ruby-0.3.8/ext/xml/libxml_so.so 
> wasn't created!.
> <false> is not true.
Description: Fix link command order so it works with ld --as-needed.
Author: Felix Geyer <de...@ubuntu.com>

--- ruby-mkrf-0.2.3+dfsg.orig/lib/mkrf/availability.rb
+++ ruby-mkrf-0.2.3+dfsg/lib/mkrf/availability.rb
@@ -279,9 +279,9 @@ module Mkrf
     def link_command
       # This current implementation just splats the library_paths in
       # unconditionally.  Is this problematic?
-      "#{@compiler} -o #{TEMP_EXECUTABLE} #{library_paths_compile_string}" +
-      " #{library_compile_string} #{includes_compile_string}" +
-      " #{TEMP_SOURCE_FILE}"
+      "#{@compiler} -o #{TEMP_EXECUTABLE}" +
+      " #{includes_compile_string} #{TEMP_SOURCE_FILE}" + 
+      " #{library_paths_compile_string} #{library_compile_string}"
     end
 
     # Creates a temporary source file with the string passed

Reply via email to