Projects
New Ticket     Wiki     Browse Source     Timeline     Roadmap     Bug Reports     Search

Ticket #15099 (reopened defect)

Opened 8 months ago

Last modified 4 days ago

[vim-7.1.293+python] wrong Python linked?

Reported by: frodwith@… Owned by: raimue@…
Priority: Normal Milestone: Port Bugs
Component: ports Version: 1.6.0
Keywords: Cc: wms@…
Port: vim vim-app

Description

With python25 installed and "python_select"ed, I get this error when running my first :python command in a new vim session.

sys:1: RuntimeWarning: Python C API version mismatch for module vim: This Python

has API version 1012, module vim has version 1013.

As nearly as I can tell, vim is getting built with -framework Python instead of the stuff python-config would give you (-ldl -lpython2.5). I don't know if this is a bug for the port to fix or for vim to fix, please advise. :)

Change History

Changed 8 months ago by ram@…

  • owner changed from macports-tickets@… to raimue@…
  • milestone set to Port Bugs

assign to maintainer

Changed 7 months ago by raimue@…

Ok, I see a real problem here. The build system of vim always builds against the first 'python' binary it finds in PATH. This means it takes the includes and libs of this binary.

If you still have it, could you please provide the output of:

otool -L /opt/local/bin/vim

(Sorry at this point for examining this bug so late, I was busy.)

Currently I see no solution how we could fix this bug without rewriting the vim configure checks. And I also think the same applies to ruby and perl when linked into vim.

Changed 7 months ago by frodwith@…

hephaestus:pdriver $ otool -L /opt/local/bin/vim
/opt/local/bin/vim:
        /opt/local/lib/libncurses.5.dylib (compatibility version 5.0.0, current version 5.0.0)
        /opt/local/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
        /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 128.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.10)
        /System/Library/Frameworks/Python.framework/Versions/2.3/Python (compatibility version 2.3.0, current version 2.3.5)
        /System/Library/Frameworks/Tcl.framework/Versions/8.4/Tcl (compatibility version 8.4.0, current version 8.4.0)
        /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 368.33.0)
        /usr/lib/libruby.1.dylib (compatibility version 1.8.0, current version 1.8.2)
        /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0)

Changed 7 months ago by wsiegrist@…

  • cc wms@… added

Changed 7 months ago by raimue@…

  • status changed from new to closed
  • resolution set to fixed

I think the problem here was that at build time python from the system was used and later python25 was installed and made the default. But now the python in PATH changed and causes this error message.

To avoid a similar issue in #13292, I made python25 a mandatory dependency for the +python variant. I hope this also fixed this issue here.

I am closing this ticket, please reopen if the issue remains.

Changed 7 months ago by frodwith@…

  • status changed from closed to reopened
  • resolution fixed deleted

port uninstall vim port clean vim port sync port upgrade outdated port install vim +python

issue still persists. the macports python25 has always been the first one in my path, so I didn't anticipate that this would work. One workaround might be to try ripping the shipped Apple python out, but I fear this might break things that depend on it. The problem seems to be somewhere in vim's build process - for instance, the vim module is getting built with the proper python, but vim the editor is getting linked to the Apple version.

Changed 7 months ago by raimue@…

Hm, okay. Seems like I will have to dive deeper into vim's build system.

Changed 7 months ago by macsforever2000@…

Does it work if you first run the following?

sudo port install python_select

Changed 7 months ago by frodwith@…

no; python25 has always been python_select'd.

Changed 2 months ago by raimue@…

  • port set to vim vim-app

Changed 4 days ago by raimue@…

I was trying to solve this issue using the --with-python-config-dir=${prefix}/lib/python2.5/config switch, but it is not so easy. First, I had to comment out the hardcoded string "-framework Python", which is why it is always picking up python from the system.

In ${prefix}/lib/python2.5/config/Makefile the variable LINKFORSHARED is set to "-ldl -u _PyMac_Error Python.framework/Versions/2.5/Python". This cannot work as the path to the framework is missing and therefore linking with these flags fails.

python should be fixed first to give the whole path to the framework directory in LINKFORSHARED and not only a part. Then this will hopefully work for vim.

Changed 4 days ago by blb@…

Rainer, can you try against python26 if you have a chance, I updated the config/Makefile so LINKFORSHARED is better (in r42841).

Note: See TracTickets for help on using tickets.