> I'm not sure what you mean by this.  Again, the configure script doesn't know 
> anything about "default locations" in itself.  Rather, because of that, it 
> works nicely regardless of how or where Ruby was installed; it works for both 
> Mac-specific bundle structured installation in /System/Library/Frameworks/ 
> and  ordinary Unix-like installation in /usr/ or /usr/local/.   That's what I 
> showed in my previous email, not that "It works fine only if it's not asked 
> too much".
> 

What I'm trying to prove here is exactly this — that it works only "if it's not 
asked too much"

System's ruby dylib is located at /usr/lib/libruby.x.x.x.dylib — -L/usr/lib is 
default for clang.
Your ruby installation puts library at /usr/local/lib/libruby.x.x.x.dylib — and 
-L/usr/local/lib is readily provided from other parts of configure script.

And with rvm it is located at 
$HOME/.rvm/rubies/ruby.x.x.x/lib/libruby.x.x.x.dylib — and that is not picked 
up because of that defect.

> 
> Could you show me how the library search failed more specifically?  Your 
> patch could be right, but since your understanding of the configure script is 
> somehow different from mine, I can't seem to understand your explanation.
> 

Here's the failed command: 

 env LD_RUN_PATH=/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE 
clang   -L. -fstack-protector -L/usr/local/lib 
-L/Volumes/storage/app-usr-local/opt/libyaml/lib 
-L/Volumes/storage/app-usr-local/opt/readline/lib 
-L/Volumes/storage/app-usr-local/opt/libksba/lib 
-L/Volumes/storage/app-usr-local/opt/[email protected]/lib  -L/usr/local/lib    -o 
vim objects/arabic.o objects/beval.o objects/buffer.o objects/blowfish.o 
objects/crypt.o objects/crypt_zip.o objects/dict.o objects/diff.o 
objects/digraph.o objects/edit.o objects/eval.o objects/evalfunc.o 
objects/ex_cmds.o objects/ex_cmds2.o objects/ex_docmd.o objects/ex_eval.o 
objects/ex_getln.o objects/farsi.o objects/fileio.o objects/fold.o 
objects/getchar.o objects/hardcopy.o objects/hashtab.o  objects/if_cscope.o 
objects/if_xcmdsrv.o objects/list.o objects/mark.o objects/memline.o 
objects/menu.o objects/misc1.o objects/misc2.o objects/move.o objects/mbyte.o 
objects/normal.o objects/ops.o objects/option.o objects/os_unix.o 
objects/pathdef.o objects/popupmnu.o objects/pty.o objects/quickfix.o 
objects/regexp.o objects/screen.o objects/search.o objects/sha256.o 
objects/spell.o objects/spellfile.o objects/syntax.o objects/tag.o 
objects/term.o objects/terminal.o objects/ui.o objects/undo.o 
objects/userfunc.o objects/version.o objects/window.o  objects/term_encoding.o 
objects/term_keyboard.o objects/term_mouse.o objects/term_parser.o 
objects/term_pen.o objects/term_screen.o objects/term_state.o 
objects/term_unicode.o objects/term_vterm.o objects/if_lua.o  objects/if_perl.o 
objects/if_perlsfio.o  objects/if_python3.o  objects/if_ruby.o 
objects/os_macosx.o objects/os_mac_conv.o  objects/netbeans.o objects/channel.o 
 objects/charset.o objects/json.o objects/main.o objects/memfile.o 
objects/message.o    -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm  
-lncurses -liconv -lintl -framework AppKit  -pagezero_size 10000 -image_base 
100000000 -L/Volumes/storage/app-usr-local/lib -lluajit-5.1 -fstack-protector  
-L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl  
-L/Volumes/storage/app-usr-local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin
 -lpython3.6m -ldl -framework CoreFoundation  -lruby.2.4.1 -lpthread -lgmp -ldl 
-lobjc
ld: library not found for -lruby.2.4.1
clang: error: linker command failed with exit code 1 (use -v to see invocation)

As you can see, all other ./lib directories for other libraries got picked up, 
wherever they happen to be. Not ruby's.

Here is the relevant part of config.log:

configure:7075: checking --enable-rubyinterp argument
configure:7084: result: yes
configure:7091: checking --with-ruby-command argument
configure:7100: result: defaulting to ruby
configure:7106: checking for ruby
configure:7124: found /Users/morpheby/.rvm/rubies/ruby-2.4.1/bin/ruby
configure:7136: result: /Users/morpheby/.rvm/rubies/ruby-2.4.1/bin/ruby
configure:7145: checking Ruby version
configure:7148: result: OK
configure:7150: checking Ruby rbconfig
configure:7156: result: RbConfig
configure:7158: checking Ruby header files
configure:7162: result: 
/Users/morpheby/.rvm/rubies/ruby-2.4.1/include/ruby-2.4.0

<...>

LDFLAGS='-L. -fstack-protector -L/usr/local/lib 
-L/Volumes/storage/app-usr-local/opt/libyaml/lib 
-L/Volumes/storage/app-usr-local/opt/readline/lib 
-L/Volumes/storage/app-usr-local/opt/libksba/lib 
-L/Volumes/storage/app-usr-local/opt/[email protected]/lib  -L/usr/local/lib'

<...>

RUBY_CFLAGS='-I/Users/morpheby/.rvm/rubies/ruby-2.4.1/include/ruby-2.4.0 
-I/Users/morpheby/.rvm/rubies/ruby-2.4.1/include/ruby-2.4.0/x86_64-darwin17 
-DRUBY_VERSION=24'
RUBY_LIBS='-lruby.2.4.1 -lpthread -lgmp -ldl -lobjc'

<...>

vi_cv_path_ruby='/Users/morpheby/.rvm/rubies/ruby-2.4.1/bin/ruby'


As you can see, everything is fine _except_ library directory for installed 
ruby.

So yes, why it works in both of your configurations is indeed incidental. 
Unless your intention is to completely disregard possible existence of rvm or 
just non-statndard ruby installation path.

So to sum up:
1. It is incidental
2. It  has no support for custom ruby locations
3. Custom ruby locations are common when using rvm
4. This patch fixes a defect in configure script, which leads to it making the 
incorrect judgement that it is _not_ on macOS, and ignoring discovered 
$rubylibdir
5. The change affects the way the decision is made: RbConfig returns 
"libruby-x.x.x-static.a" and not libruby.a (as implied by the original 
condition), so this condition is more broad and works on any value matching 
libruby*.a.

Also, it appears, you have made an incorrect assumption that this static 
library exists on my setup — it doesn't, and I have never said it does. In 
fact, this logic path:

>  if test -f "$rubylibdir/$librubya"; then 
>     ... 
>  elif test "$librubyarg" = "libruby.a"; then 
>    dnl required on Mac OS 10.3 where libruby.a doesn't exist

is obviously invoked only when is _does not_ exist. The problem is that the 
last test fails (since the value of $librubyarg is "libruby-x.x.x-static.a" and 
not "libruby.a"), and so it is assumed that we are not on macOS and so the 
$rubylibdir never gets to $LDFLAGS.

---

PS It may also be sensible to rely instead on pkgconfig. It is an interesting 
question why it doesn't.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui