Bug #9760

mkmf does not allow for linking against custom libraries when a system library is present

Andrew DeMaria1年以上前に追加. 15日前に更新.

[ruby-core:62100]
ステータス:Open
優先度:Normal
担当者:-
ruby -v:ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux] Backport:2.0.0: UNKNOWN, 2.1: REQUIRED, 2.2: REQUIRED

説明

Hi,

Hopefully the title is not confusing, but the short story is that mkmf outputs a makefile that first searches the default lib path before searching any user provided lib paths. This is not an issue until one tries to link against an included library whose version is different than a preexisting system library.

The issue cropped up while trying to install the rugged gem (libgit2 wrapper) and a full dialog on the issue can be found on github https://github.com/libgit2/rugged/issues/351.

I was able to fix the issue with the attached patch (https://github.com/muff1nman/ruby/commit/a0c8bc32cfc11e61c5b9703bff243934c6509210)

fix_default_libpath.diff Magnifier (1.2 KB) Andrew DeMaria, 2014/04/19 22:12

early-libdir.patch Magnifier (1.24 KB) Shota Fukumori, 2015/08/27 17:18

関係しているリビジョン

リビジョン 45640
Nobuyoshi Nakada1年以上前に追加

mkmf.rb: prefer $LIBPATH than $DEFLIBPATH

  • lib/mkmf.rb (link_command, libpathflag, create_makefile): prefer user specified $LIBPATH than $DEFLIBPATH. [ruby-trunk - Bug #9760]

リビジョン 45640
Nobuyoshi Nakada1年以上前に追加

mkmf.rb: prefer $LIBPATH than $DEFLIBPATH

  • lib/mkmf.rb (link_command, libpathflag, create_makefile): prefer user specified $LIBPATH than $DEFLIBPATH. [ruby-trunk - Bug #9760]

リビジョン 52267
Shota Fukumori15日前に追加

  • lib/mkmf.rb: Revert r45640 because it may lead to link with different libruby. [Bug #9760]

履歴

#1 Nobuyoshi Nakada1年以上前に更新

  • ステータスOpen から Closed に変更
  • 進捗率0 から 100 に変更

Applied in changeset r45640.


mkmf.rb: prefer $LIBPATH than $DEFLIBPATH

  • lib/mkmf.rb (link_command, libpathflag, create_makefile): prefer user specified $LIBPATH than $DEFLIBPATH. [ruby-trunk - Bug #9760]

#2 Akinori MUSHA1年以上前に更新

In the meantime, third parties can work around this problem by a monkey patch like this:

https://github.com/sparklemotion/nokogiri/commit/c98745d9098487c51685a732f1c5a21d8d07cdad

#3 Akinori MUSHA1年以上前に更新

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.

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.

#4 Tomoyuki Chikanaga1年以上前に更新

  • Backport2.0.0: UNKNOWN, 2.1: UNKNOWN から 2.0.0: UNKNOWN, 2.1: REQUIRED に変更

Does this issue exist in 2.0.0 too?

#5 Akinori MUSHA1年以上前に更新

Please do not backport this yet; I'm suggesting backing out the commit made in trunk for the reason I gave above.

#6 Akinori MUSHA1年以上前に更新

  • ステータスClosed から Open に変更

#7 Shota Fukumori2ヶ月前に更新

#8 Shota Fukumori2ヶ月前に更新

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.

#9 Usaku NAKAMURA2ヶ月前に更新

  • Backport2.0.0: UNKNOWN, 2.1: REQUIRED から 2.0.0: UNKNOWN, 2.1: REQUIRED, 2.2: REQUIRED に変更

#10 Shota Fukumori2ヶ月前に更新

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..

#11 Shota Fukumori2ヶ月前に更新

I'm positive to revert the change at r45640.

#12 Shota Fukumori15日前に更新

  • ステータスOpen から Closed に変更

Applied in changeset r52267.


  • lib/mkmf.rb: Revert r45640 because it may lead to link with different libruby. [Bug #9760]

#13 Shota Fukumori15日前に更新

  • ステータスClosed から Open に変更

Reverted r45640 at r52267. Hmm...

他の形式にエクスポート: Atom PDF