[QScintilla] Building QScintilla on Mac OS X 10.4

Curtis Faith curtis at worldhouse.org
Mon Jul 2 06:37:34 BST 2007


I finally got this problem sorted. I'm amazed no one else has run  
into this before but I thought I would list the issues and  
resolutions here so that anyone else who tries this can have an  
easier time and perhaps so the QScintilla documentation or build  
system can be changed to avoid these problems.

First, you'll need to use the sudo command in front of the "make  
installs" everywhere since you won't have rights to write in the  
directories where everything gets installed without it.

The normal installation directions which don't work are:

     cd Qt4
     qmake qscintilla.pro
     make
     make install

The directions I used for successfully building QScintilla using Qt4  
on a Mac OS X are:

     cd Qt4

Next you need to account for the default behavior on the Mac where  
qmake builds XCode projects. Since I wanted to use the command line  
version I had to tell qmake to use the g++ tools

     qmake -spec macx-g++ qscintilla.pro

On the Mac it appears that dynamic libraries include the name where  
they are found in the library itself (see: http://qin.laya.com/ 
tech_coding_help/dylib_linking.html for more info). This means that  
you need to include "/Library/Frameworks/" in the front of  
libqscintilla2.2.dylib in the section of the make file called LFLAGS  
just after the
open Makefile and add  /Library/Frameworks/ to the front of  
libqscintilla2.2.dylib in LFLAGS just after the  -install_name  
option. LFLAGS was:

LFLAGS        = -headerpad_max_install_names -single_module - 
dynamiclib -compatibility_version 2.0
  -current_version 2.0.0 -install_name libqscintilla2.2.dylib

I changed it to:

LFLAGS        = -headerpad_max_install_names -single_module - 
dynamiclib -compatibility_version 2.0
  -current_version 2.0.0 -install_name /Library/Frameworks/ 
libqscintilla2.2.dylib

Now you can run the make to build the library.

     make

Before running install, we need to fix one other problem. There is  
some sort of problem with the includes being in their default  
position for the Qsci headers that causes a gcc error something like:  
"Error: template with C linkage". It appears that the gcc 4.0.1  
compiler on the Mac OS X assumes that anything that is in /usr/ 
include/ should be compiled with C linkage even if called from g++ (a  
really dumb idea I think)

The only way I found to fix this was to move the Qsci directory  
outside /usr/include/

Since you need to tell configure.py where they are located later on  
when building the Python bindings,  make it something easy to  
remember. Open Makefile and change the destination directory for QSci  
headers to another directory say: /usr/cpp_include/:

Change this:

install_header: first FORCE
	@$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/include/ || $(MKDIR) $ 
(INSTALL_ROOT)/usr/include/
	-$(INSTALL_DIR) /Users/curtis/Desktop/QScintilla-1.73-gpl-2.1/Qt4/ 
Qsci $(INSTALL_ROOT)/usr/include/

to something like this:

install_header: first FORCE
	@$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/cpp_include/ || $(MKDIR) $ 
(INSTALL_ROOT)/usr/cpp_include/
	-$(INSTALL_DIR) /Users/curtis/Desktop/QScintilla-1.73-gpl-2.1/Qt4/ 
Qsci $(INSTALL_ROOT)/usr/cpp_include/

Now you can run the install:
	
	sudo make install

To account for this new location of the directories while building  
the Python bindings you need to change the directions:

     python configure.py
     make
     make install

to tell configure where you placed the Qsci headers

     cd Python
     python configure.py -n /usr/cpp_include
     make
     sudo make install


After I did this I was able to get python to recognize QScintilla and  
then the installer for Eric 4 worked as well. So after two days, I  
finally have Eric 4 and QScintilla running.

Have fun!

- Curtis




Begin forwarded message:

> From: Curtis Faith <curtis at worldhouse.org>
> Date: July 1, 2007 9:24:43 PM GMT-03:00
> To: qscintilla at riverbankcomputing.com
> Subject: [QScintilla] PyQt Bindings for QScintilla on OS X 10.4  
> dlopen Problem
>
> I am in the process of installing Eric 4 on and am stuck on one of  
> the steps since it seems that QScintilla's python bindings are not  
> setup correctly.
>
> Here are my current versions:
>
>> Python-2.5.1
>> qt-mac-opensource-4.3.0
>> sip-4.6
>> PyQt-mac-gpl-4.2
>> QScintilla-1.73-gpl-2.1
>
> I have been working on this for several days. I have run into many  
> problems and it is a bit of a whack-a-mole in that everytime I fix  
> one problem another pops up, sometimes the same one I faced  
> earlier. I have followed the directions explicitly but they are no  
> where near sufficient on OS X.
>
> My current problem is getting the PyQt bindings for QScintilla  
> working. I have had these working before but then had the problem I  
> outline below (currently I can import qVersion fine and don't get a  
> Bus Error).
>
> I do get an error saying that I need to install QScintilla because  
> the python install script can't find the library. I isolated this  
> down to the following interpreter snippet.
>
> Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04)
> [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from PyQt4 import Qsci
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/ 
> 2.5/lib/python2.5/site-packages/PyQt4/Qsci.so, 2): Library not  
> loaded: libqscintilla2.2.dylib
>   Referenced from: /Library/Frameworks/Python.framework/Versions/ 
> 2.5/lib/python2.5/site-packages/PyQt4/Qsci.so
>   Reason: image not found
> >>>
>
> I have tried copying the libqscintilla2.2.dylib file various places  
> to see if I can at least get past this error but can't seem to. I  
> am just now returning to the Mac from a long hiatus in the hell of  
> Windows and haven't used FreeBSD in years so I have no idea how  
> Python on darwin loads dynamic libraries which doesn't help.
>
> Does anyone have any ideas what might be going on?
>
> - Curtis
>
>
>>  Software Foundation, Inc.
>> GDB is free software, covered by the GNU General Public License,  
>> and you are
>> welcome to change it and/or distribute copies of it under certain  
>> conditions.
>> Type "show copying" to see the conditions.
>> There is absolutely no warranty for GDB.  Type "show warranty" for  
>> details.
>> This GDB was configured as "i386-apple-darwin"...Reading symbols  
>> for shared libraries .. done
>>
>> "/Users/curtis/Desktop/eric4-4.0.0/install.py" is not a core dump:  
>> File format not recognized
>> (gdb) run
>> Starting program: /Library/Frameworks/Python.framework/Versions/ 
>> 2.5/bin/python
>> Reading symbols for shared libraries . done
>>
>> Program received signal SIGTRAP, Trace/breakpoint trap.
>> 0x8fe01010 in __dyld__dyld_start ()
>> (gdb)
>>
>> The bt command results in only the single entry for  
>> __dyld__dyld_start ()
>>
>> This appears to be the call to dynamically load a shared library  
>> on Darwin as best I can tell.
>>
>> I placed print statements inside install.py to find out that the  
>> following call:
>>
>> 	qtMajor = int(qVersion().split('.')[0])
>>
>> is causing the Bus Error. Specifically the call to "qVersion()".  
>> This tells me that there is probably something wrong with the PyQt  
>> installation or SIP but I have no idea what it might be or how to  
>> proceed.
>>
>> Does anyone have any idea how I can figure out what might be  
>> causing this problem?
>>
>> - Curtis
>>
>
>
> _______________________________________________
> QScintilla mailing list
> QScintilla at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/qscintilla

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/qscintilla/attachments/20070702/c3167057/attachment-0001.html


More information about the QScintilla mailing list