[Qgis-user] Mac OS X: QGIS 1.0 Preview 2 Crashes

William Kyngesburye woklist at kyngchaos.com
Fri Nov 14 20:03:29 PST 2008


On Nov 14, 2008, at 7:04 PM, William Kyngesburye wrote:

> Hmmm...  A possibility: compile and link statically as Qgis does  
> now, use install_name_tool to change the python link to drop the  
> path (this is how the Qt frameworks are initially).  The linker at  
> runtime then will use DYLD_FRAMEWORK_PATH and its internal default  
> path to search for the python binary.  A pseudo-dynamic linking, no  
> need to fuss with dlopen() and searching for python or a  
> preference.  A user-installed python framework will override the  
> system python, as expected.


Victory!

I patched SIP to compile as a bundle, with no direct link to Python.   
Rebuild PyQt and it followed.  Rebuild Qgis, and the qgis-python  
modules are also now correct.

Then, changed libqgispython to drop the full path to Python binary (I  
built with system Python).

Run Qgis - Python OK, uses system python.

Quit, "enable" python.org Python by moving the framework into /Library/ 
Frameworks.

Run Qgis - Python OK! uses python.org Python!

So, the only thing that needs to be done in Qgis compilation is change  
the Python linking in libqgispython (in install step?):

install_name_tool -change /configured/path/to/Python.framework/binary  
Python.framework/binary /path/to/libqgispython.dylib

ie, for the system python:

install_name_tool -change /System/Library/Frameworks/Python.framework/ 
Versions/2.5/Python Python.framework/Versions/2.5/Python /path/to/ 
libqgispython.dylib

This will still work even if SIP isn't fixed (or takes a while to  
fix).  Qgis will just have the same limitation as it already does with  
Python.


I will suggest the patch to Riverbank to get SIP fixed.  If anything,  
we can add notes to the Qgis build instructions about how to patch SIP.

note: another bit of those details - it only works with -undefined  
dynamic_lookup.  The bundle_loader flag didn't work.  It looks like  
the bundle_loader flag tags the module and it will look only in the  
immediate loading binary (executable only?) for the symbols.  When I  
ran python, then tried to import sip, it tried to find the Python  
symbols in the Python executable, not the framework loaded by the  
executable.

While with undefined dynamic_lookup, it looks in all loaded libraries  
for symbols.

The only problem with this is that during compilation we won't get  
notified if there are any missing symbols that we may be expecting to  
be in other libraries.

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"Oh, look, I seem to have fallen down a deep, dark hole.  Now what  
does that remind me of?  Ah, yes - life."

- Marvin





More information about the Qgis-user mailing list