Building QScintilla framework on macOS: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
(rewrite all)
Line 1: Line 1:
testdddddd
By default, dynamic libraries files(.dylib) are generated after building the QScintilla project. For Qt libraries are built in form of frameworks by default, we will creating QScintilla framework here.
 
Modify Qt4Qt5/qscintilla.pro
 
Change the line:
 
CONFIG += qt warn_off release thread exceptions
 
to:
 
CONFIG += qt warn_off release thread exceptions lib_bundle
 
 
Build and install
 
/usr/local/Qt/4.8.7/bin/qmake # Qt is located in /usr/local/Qt/4.8.7
 
make
 
make install
 
cp -f -R /path/to/src/Qt4Qt5/Qsci /usr/local/Qt/4.8.7/include/
 
cp -f /path/to/src/Qt4Qt5/qscintilla_cs.qm /usr/local/Qt/4.8.7/translations/
 
cp -f /path/to/src/Qt4Qt5/qscintilla_de.qm /usr/local/Qt/4.8.7/translations/
 
cp -f /path/to/srcqscintilla_es.qm /usr/local/Qt/4.8.7/translations/
 
cp -f /path/to/src/Qt4Qt5/qscintilla_fr.qm /usr/local/Qt/4.8.7/translations/
 
cp -f /path/to/src/Qt4Qt5/qscintilla_pt_br.qm /usr/local/Qt/4.8.7/translations/
 
cp -f -R /path/to/srcqsci /usr/local/Qt/4.8.7/
 
rm -f -r "/usr/local/Qt/4.8.7/lib/qscintilla2.framework"
 
cp -f -R "qscintilla2.framework" "/usr/local/Qt/4.8.7/lib/qscintilla2.framework"
 
cp -f /path/to/srcQt4Qt5/features/qscintilla2.prf /usr/local/Qt/4.8.7/mkspecs/features/
 
 
Build example-Qt4Qt5
 
Because we have built qscintilla2.framework, not qscintilla2.dylib,it is required to change applicatioin.pro:
 
CONFIG      += release qscintilla2
 
macx {
 
    QMAKE_POST_LINK = install_name_tool -change libqscintilla2.12.dylib $$[QT_INSTALL_LIBS]/libqscintilla2.12.dylib $(TARGET)
 
}
 
HEADERS      = mainwindow.h
 
SOURCES      = main.cpp mainwindow.cpp
 
RESOURCES    = application.qrc
 
 
to:
 
CONFIG      += release
 
macx {
 
LIBS += -framework qscintilla2
 
}
 
HEADERS      = mainwindow.h
 
SOURCES      = main.cpp mainwindow.cpp
 
RESOURCES    = application.qrc
 
 
then, we compile:
 
/usr/local/Qt/4.8.7/bin/qmake
 
make
 
 
Run the program:
 
open application.app
 
We encounter error:
 
LSOpenURLsWithRole() failed with error -10810 for the file /Users/frankshong/Studio/Qt/3rd_party/QScintilla/QScintillaQt4/example-Qt4Qt5/application.app.
 
 
View dependencies with otool -L
 
 
otool -L application.app/Contents/MacOS/application
 
application.app/Contents/MacOS/application:
 
qscintilla2.framework/Versions/12/qscintilla2 (compatibility version 12.0.0, current version 12.0.0)
 
/usr/local/Qt/4.8.7/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.7)
 
/usr/local/Qt/4.8.7/lib/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.7)
 
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0)
 
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
 
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 283.0.0)
 
By default, OS X searches framework in /Library/Frameworks, but qscintilla2.framework is located in Qt directory. So we must specify the path.
 
 
Change library path with nstall_name_tool
 
install_name_tool -change qscintilla2.framework/Versions/12/qscintilla2 /usr/local/Qt/4.8.7/lib/qscintilla2.framework/Versions/12/qscintilla2
application.app/Contents/MacOS/application
 
 
View depencies again:
 
otool -L application.app/Contents/MacOS/application
 
application.app/Contents/MacOS/application:
 
/usr/local/Qt/4.8.7/lib/qscintilla2.framework/Versions/12/qscintilla2 (compatibility version 12.0.0, current version 12.0.0)
 
/usr/local/Qt/4.8.7/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.7)
 
/usr/local/Qt/4.8.7/lib/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.7)
 
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0)
 
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
 
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 283.0.0)
 
 
All right. Now we run:
 
open application.app
 
To deploy the program, run:
 
macdeployqt application.app

Revision as of 22:24, 24 August 2015

By default, dynamic libraries files(.dylib) are generated after building the QScintilla project. For Qt libraries are built in form of frameworks by default, we will creating QScintilla framework here.

Modify Qt4Qt5/qscintilla.pro

Change the line:

CONFIG += qt warn_off release thread exceptions

to:

CONFIG += qt warn_off release thread exceptions lib_bundle


Build and install

/usr/local/Qt/4.8.7/bin/qmake # Qt is located in /usr/local/Qt/4.8.7

make

make install

cp -f -R /path/to/src/Qt4Qt5/Qsci /usr/local/Qt/4.8.7/include/

cp -f /path/to/src/Qt4Qt5/qscintilla_cs.qm /usr/local/Qt/4.8.7/translations/

cp -f /path/to/src/Qt4Qt5/qscintilla_de.qm /usr/local/Qt/4.8.7/translations/

cp -f /path/to/srcqscintilla_es.qm /usr/local/Qt/4.8.7/translations/

cp -f /path/to/src/Qt4Qt5/qscintilla_fr.qm /usr/local/Qt/4.8.7/translations/

cp -f /path/to/src/Qt4Qt5/qscintilla_pt_br.qm /usr/local/Qt/4.8.7/translations/

cp -f -R /path/to/srcqsci /usr/local/Qt/4.8.7/

rm -f -r "/usr/local/Qt/4.8.7/lib/qscintilla2.framework"

cp -f -R "qscintilla2.framework" "/usr/local/Qt/4.8.7/lib/qscintilla2.framework"

cp -f /path/to/srcQt4Qt5/features/qscintilla2.prf /usr/local/Qt/4.8.7/mkspecs/features/


Build example-Qt4Qt5

Because we have built qscintilla2.framework, not qscintilla2.dylib,it is required to change applicatioin.pro:

CONFIG += release qscintilla2

macx {

   QMAKE_POST_LINK = install_name_tool -change libqscintilla2.12.dylib $$[QT_INSTALL_LIBS]/libqscintilla2.12.dylib $(TARGET)

}

HEADERS = mainwindow.h

SOURCES = main.cpp mainwindow.cpp

RESOURCES = application.qrc


to:

CONFIG += release

macx {

LIBS += -framework qscintilla2

}

HEADERS = mainwindow.h

SOURCES = main.cpp mainwindow.cpp

RESOURCES = application.qrc


then, we compile:

/usr/local/Qt/4.8.7/bin/qmake

make


Run the program:

open application.app

We encounter error:

LSOpenURLsWithRole() failed with error -10810 for the file /Users/frankshong/Studio/Qt/3rd_party/QScintilla/QScintillaQt4/example-Qt4Qt5/application.app.


View dependencies with otool -L


otool -L application.app/Contents/MacOS/application

application.app/Contents/MacOS/application:

qscintilla2.framework/Versions/12/qscintilla2 (compatibility version 12.0.0, current version 12.0.0)

/usr/local/Qt/4.8.7/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.7)

/usr/local/Qt/4.8.7/lib/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.7)

/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0)

/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)

/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 283.0.0)

By default, OS X searches framework in /Library/Frameworks, but qscintilla2.framework is located in Qt directory. So we must specify the path.


Change library path with nstall_name_tool

install_name_tool -change qscintilla2.framework/Versions/12/qscintilla2 /usr/local/Qt/4.8.7/lib/qscintilla2.framework/Versions/12/qscintilla2 application.app/Contents/MacOS/application


View depencies again:

otool -L application.app/Contents/MacOS/application

application.app/Contents/MacOS/application:

/usr/local/Qt/4.8.7/lib/qscintilla2.framework/Versions/12/qscintilla2 (compatibility version 12.0.0, current version 12.0.0)

/usr/local/Qt/4.8.7/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.7)

/usr/local/Qt/4.8.7/lib/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.7)

/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0)

/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)

/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 283.0.0)


All right. Now we run:

open application.app

To deploy the program, run:

macdeployqt application.app