Hi,

Trying to compile Vim with Ruby support results in the following linking error:

... lots of ld warnings removed ...
ld warning: in objects/version.o, file is not of required architecture
Undefined symbols for architecture ppc:
  "_main", referenced from:
      start in crt1.10.5.o
ld: symbol(s) not found for architecture ppc
collect2: ld returned 1 exit status
lipo: can't open input file:
/var/folders/nu/nupuYQ6lF0uquqdm-77RL++++TI/-Tmp-//ccXXt4cQ.out (No
such file or directory)
make: *** [Vim] Error 1


The problem (as far as I understand it) is that Ruby was built with
LDFLAGS including "-arch ppc -arch i386" and these are passed on to
LDFLAGS in src/auto/config.mk when you run src/configure.  My solution
is to strip these flags before modifying LDFLAGS in the appropriate
part of src/configure.in.  It is a bit of a hack, but I don't see any
problems with it.

Without this patch you had to manually remove the -arch flags from
src/auto/config.mk before calling make (unless you were compiling a
universal binary).  With this patch you can compile both a native and
universal binary (the -arch flags are added by the --with-mac-arch
switch).

Björn


*** src/configure.in    2009-06-19 18:36:54.000000000 +0200
--- mysrc/configure.in  2009-06-19 18:32:53.000000000 +0200
***************
*** 984,990 ****
        fi
        rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print
Config::CONFIG[["LDFLAGS"]]'`
        if test "X$rubyldflags" != "X"; then
!         LDFLAGS="$rubyldflags $LDFLAGS"
        fi
        RUBY_SRC="if_ruby.c"
        RUBY_OBJ="objects/if_ruby.o"
--- 984,996 ----
        fi
        rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print
Config::CONFIG[["LDFLAGS"]]'`
        if test "X$rubyldflags" != "X"; then
!         dnl Ruby on Mac OS X 10.5 adds "-arch" flags but these should only
!         dnl be included if requested by passing --with-mac-arch to
!         dnl configure, so strip these flags first (if present)
!         rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e
's/-arch\ i386//'`
!         if test "X$rubyldflags" != "X"; then
!           LDFLAGS="$rubyldflags $LDFLAGS"
!         fi
        fi
        RUBY_SRC="if_ruby.c"
        RUBY_OBJ="objects/if_ruby.o"

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Attachment: configure.in.diff.gz
Description: GNU Zip compressed data

Raspunde prin e-mail lui