https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112014-04-19T23:41:44ZRuby Issue Tracking SystemRuby master - Bug #9760: mkmf does not allow for linking against custom libraries when a system library is presenthttps://redmine.ruby-lang.org/issues/9760?journal_id=462602014-04-19T23:41:44Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>Applied in changeset r45640.</p>
<hr>
<p>mkmf.rb: prefer $LIBPATH than $DEFLIBPATH</p>
<ul>
<li>lib/mkmf.rb (<code>link_command</code>, <code>libpathflag</code>, <code>create_makefile</code>): prefer<br>
user specified <code>$LIBPATH</code> than <code>$DEFLIBPATH</code>. <a href="/issues/9760">[ruby-core:62100]</a><br>
[ruby-trunk - Bug <a class="issue tracker-1 status-1 priority-4 priority-default" title="Bug: mkmf does not allow for linking against custom libraries when a system library is present (Open)" href="https://redmine.ruby-lang.org/issues/9760">#9760</a>]</li>
</ul> Ruby master - Bug #9760: mkmf does not allow for linking against custom libraries when a system library is presenthttps://redmine.ruby-lang.org/issues/9760?journal_id=465922014-05-07T10:58:39Zknu (Akinori MUSHA)knu@ruby-lang.org
<ul></ul><p>In the meantime, third parties can work around this problem by a monkey patch like this:</p>
<p><a href="https://github.com/sparklemotion/nokogiri/commit/c98745d9098487c51685a732f1c5a21d8d07cdad" class="external">https://github.com/sparklemotion/nokogiri/commit/c98745d9098487c51685a732f1c5a21d8d07cdad</a></p> Ruby master - Bug #9760: mkmf does not allow for linking against custom libraries when a system library is presenthttps://redmine.ruby-lang.org/issues/9760?journal_id=468032014-05-19T06:01:09Zknu (Akinori MUSHA)knu@ruby-lang.org
<ul></ul><p>The monkey patch I mentioned above was backed out due to a serious problem found, that is, if an instance of libruby.so (of the same soname as the running ruby) is found in a user-given path that is different from the one for the running ruby used for build, it will be picked by the linker and the resulted extension will cause a SEGV in run time.</p>
<p>So, it turned out DEFLIBPATH took precedence over LIBPATH for a good reason and I'm afraid it should not have been simply changed this way.</p> Ruby master - Bug #9760: mkmf does not allow for linking against custom libraries when a system library is presenthttps://redmine.ruby-lang.org/issues/9760?journal_id=471952014-06-12T11:30:40Znagachika (Tomoyuki Chikanaga)nagachika00@gmail.com
<ul><li><strong>Backport</strong> changed from <i>2.0.0: UNKNOWN, 2.1: UNKNOWN</i> to <i>2.0.0: UNKNOWN, 2.1: REQUIRED</i></li></ul><p>Does this issue exist in 2.0.0 too?</p> Ruby master - Bug #9760: mkmf does not allow for linking against custom libraries when a system library is presenthttps://redmine.ruby-lang.org/issues/9760?journal_id=471972014-06-12T12:23:53Zknu (Akinori MUSHA)knu@ruby-lang.org
<ul></ul><p>Please do not backport this yet; I'm suggesting backing out the commit made in trunk for the reason I gave above.</p> Ruby master - Bug #9760: mkmf does not allow for linking against custom libraries when a system library is presenthttps://redmine.ruby-lang.org/issues/9760?journal_id=471982014-06-12T12:24:16Zknu (Akinori MUSHA)knu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Closed</i> to <i>Open</i></li></ul> Ruby master - Bug #9760: mkmf does not allow for linking against custom libraries when a system library is presenthttps://redmine.ruby-lang.org/issues/9760?journal_id=540132015-08-27T16:37:55Zsorah (Sorah Fukumori)her@sorah.jp
<ul></ul><p>Hit a problem as <a class="user active user-mention" href="https://redmine.ruby-lang.org/users/8">@knu (Akinori MUSHA)</a> said: <a href="https://github.com/brianmario/mysql2/issues/657" class="external">https://github.com/brianmario/mysql2/issues/657</a></p> Ruby master - Bug #9760: mkmf does not allow for linking against custom libraries when a system library is presenthttps://redmine.ruby-lang.org/issues/9760?journal_id=540142015-08-27T17:19:28Zsorah (Sorah Fukumori)her@sorah.jp
<ul><li><strong>File</strong> <a href="/attachments/5478">early-libdir.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/5478/early-libdir.patch">early-libdir.patch</a> added</li></ul><p>attached diff (early-libdir.patch) works well for my case... but I can't determine this is correct fix. If it's okay I'll commit into trunk.</p> Ruby master - Bug #9760: mkmf does not allow for linking against custom libraries when a system library is presenthttps://redmine.ruby-lang.org/issues/9760?journal_id=540192015-08-28T00:09:11Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Backport</strong> changed from <i>2.0.0: UNKNOWN, 2.1: REQUIRED</i> to <i>2.0.0: UNKNOWN, 2.1: REQUIRED, 2.2: REQUIRED</i></li></ul> Ruby master - Bug #9760: mkmf does not allow for linking against custom libraries when a system library is presenthttps://redmine.ruby-lang.org/issues/9760?journal_id=540232015-08-28T04:17:38Zsorah (Sorah Fukumori)her@sorah.jp
<ul></ul><p>Assume /usr/lib has librubyA and libfooB, and /home/someone/local/lib has libfooA. I think early-libdir.patch makes mkmf.rb can't link to libfooA never..</p> Ruby master - Bug #9760: mkmf does not allow for linking against custom libraries when a system library is presenthttps://redmine.ruby-lang.org/issues/9760?journal_id=540242015-08-28T07:19:57Zsorah (Sorah Fukumori)her@sorah.jp
<ul></ul><p>I'm positive to revert the change at r45640.</p> Ruby master - Bug #9760: mkmf does not allow for linking against custom libraries when a system library is presenthttps://redmine.ruby-lang.org/issues/9760?journal_id=545572015-10-24T12:11:14Zsorah (Sorah Fukumori)her@sorah.jp
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>Applied in changeset r52267.</p>
<hr>
<ul>
<li>lib/mkmf.rb: Revert r45640 because it may lead to link<br>
with different libruby. [Bug <a class="issue tracker-1 status-1 priority-4 priority-default" title="Bug: mkmf does not allow for linking against custom libraries when a system library is present (Open)" href="https://redmine.ruby-lang.org/issues/9760">#9760</a>]</li>
</ul> Ruby master - Bug #9760: mkmf does not allow for linking against custom libraries when a system library is presenthttps://redmine.ruby-lang.org/issues/9760?journal_id=545582015-10-24T12:14:48Zsorah (Sorah Fukumori)her@sorah.jp
<ul><li><strong>Status</strong> changed from <i>Closed</i> to <i>Open</i></li></ul><p>Reverted r45640 at r52267. Hmm...</p> Ruby master - Bug #9760: mkmf does not allow for linking against custom libraries when a system library is presenthttps://redmine.ruby-lang.org/issues/9760?journal_id=588322016-05-24T08:11:26Zonur (Onur Küçük)
<ul></ul><p>We have a system where</p>
<ul>
<li>Ruby 1.8.7-p374 is installed system wide from distribution packages</li>
<li>There is a user setup with RVM to run Ruby 2.x running Redmine with Mysql</li>
</ul>
<p>During Redmine bundle install, mysql2 gem is linking against the system Ruby, leading to issues like missing symbols etc. for the generated SO. The issue is happening with 2.2.3, 2.2.4 and 2.3.0 but it seems it is fixed in 2.3.1. I did not bisect but r52267 is probably what fixed it, thank you !</p> Ruby master - Bug #9760: mkmf does not allow for linking against custom libraries when a system library is presenthttps://redmine.ruby-lang.org/issues/9760?journal_id=992262022-09-21T10:56:27Zrhenium (Kazuki Yamaguchi)k@rhe.jp
<ul></ul><p>This is still an issue in the current master (e.g., <a href="https://github.com/ruby/openssl/issues/545" class="external">https://github.com/ruby/openssl/issues/545</a>).</p>
<p>If I understand correctly, mkmf.rb prepends libruby's path solely to prevent picking up a wrong libruby. Since the exact path of the correct libruby is known, I wonder if it's possible for mkmf.rb to just use it instead of the <code>-L[...] -lruby</code> combo to achieve the same thing.</p>
<p>BTW, Python 3.8 made an interesting change in <a href="https://bugs.python.org/issue21536" class="external">https://bugs.python.org/issue21536</a>: if the platform allows, extensions don't link to libpython (don't use <code>-lpythonX.Y</code>) and leave symbols unresolved until at runtime.</p>