I am working on a QT gui application that I wish to deploy on mac. After reading through various forums, I have created an app that contains the frameworks and libs, but the application crashes. I have verified that the application works when compiled as a command-line tool. I am giving below the steps and outputs in the hope that someone can help me figure out the problem.
There are three libraries that I am linking to statically, so I assume they cannot be the problem: QGLViewer (http://www.libqglviewer.com/), GLE (http://www.linas.org/gle/), and GLEW.
1 - I compile the code as an app-bundle, and check the lib dependencies:
otool -L ./AtomTrajectoryViewer.app/Contents/MacOS/AtomTrajectoryViewer
./AtomTrajectoryViewer.app/Contents/MacOS/AtomTrajectoryViewer:
/Users/bhatia4/macports/Library/Frameworks/QtOpenGL.framework/Versions/5/QtOpenGL (compatibility version 5.3.0, current version 5.3.2)
/Users/bhatia4/macports/Library/Frameworks/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.3.0, current version 5.3.2)
/Users/bhatia4/macports/Library/Frameworks/QtGui.framework/Versions/5/QtGui (compatibility version 5.3.0, current version 5.3.2)
/Users/bhatia4/macports/Library/Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.3.0, current version 5.3.2)
/Users/bhatia4/macports/Library/Frameworks/QtXml.framework/Versions/5/QtXml (compatibility version 5.3.0, current version 5.3.2)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
/Users/bhatia4/macports/lib/libgcc/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.20.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/Users/bhatia4/macports/lib/libgcc/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
2 - I use macdeployqt to deploy the application, and check again the lib dependencies
otool -L ./AtomTrajectoryViewer.app/Contents/MacOS/AtomTrajectoryViewer
./AtomTrajectoryViewer.app/Contents/MacOS/AtomTrajectoryViewer:
#executable_path/../Frameworks/QtOpenGL.framework/Versions/5/QtOpenGL (compatibility version 5.3.0, current version 5.3.2)
#executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.3.0, current version 5.3.2)
#executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui (compatibility version 5.3.0, current version 5.3.2)
#executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.3.0, current version 5.3.2)
#executable_path/../Frameworks/QtXml.framework/Versions/5/QtXml (compatibility version 5.3.0, current version 5.3.2)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
#executable_path/../Frameworks/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.20.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
#executable_path/../Frameworks/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
3 - This all seems to work fine. But when I double-click on the application, it crashes with the following error log.
Process: AtomTrajectoryViewer [12044]
Path:
/Users/USER/*/AtomTrajectoryViewer.app/Contents/MacOS/AtomTrajectoryViewer
Identifier: com.yourcompany.AtomTrajectoryViewer
Version: ???
Code Type: X86-64 (Native)
Parent Process: launchd [432]
Responsible: AtomTrajectoryViewer [12044]
User ID: 37086
Date/Time: 2015-04-24 14:50:17.069 -0700
OS Version: Mac OS X 10.9.5 (13F1077)
Report Version: 11
Anonymous UUID: 3AD366C6-C5BA-EB79-EA67-6D293D1A8B8B
Sleep/Wake UUID: 962187D8-70E2-4886-8371-03303761E575
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Application Specific Information:
abort() called
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff8edec866 __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff9a95435c pthread_kill + 92
2 libsystem_c.dylib 0x00007fff8e955b1a abort + 125
3 QtCore 0x0000000100cb5709 0x100c92000 + 145161
4 QtCore 0x0000000100cb6bb1 QMessageLogger::fatal(char const*, ...) const + 161
5 QtGui 0x0000000100815c08 QGuiApplicationPrivate::createPlatformIntegration() + 5672
6 QtGui 0x0000000100815c2b QGuiApplicationPrivate::createEventDispatcher() + 27
7 QtCore 0x0000000100e68401 QCoreApplication::init() + 113
8 QtCore 0x0000000100e68377 QCoreApplication::QCoreApplication(QCoreApplicationPrivate&) + 39
9 QtGui 0x000000010081338e QGuiApplication::QGuiApplication(QGuiApplicationPrivate&) + 14
10 QtWidgets 0x000000010022de0e QApplication::QApplication(int&, char**, int) + 206
11 com.yourcompany.AtomTrajectoryViewer 0x00000001000f28e9 main + 41
12 com.yourcompany.AtomTrajectoryViewer 0x0000000100003854 start + 52
Thread 1:
0 libsystem_kernel.dylib 0x00007fff8edece6a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff9a954f08 _pthread_wqthread + 330
2 libsystem_pthread.dylib 0x00007fff9a957fb9 start_wqthread + 13
Thread 2:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x00007fff8eded662 kevent64 + 10
1 libdispatch.dylib 0x00007fff990aa421 _dispatch_mgr_invoke + 239
2 libdispatch.dylib 0x00007fff990aa136 _dispatch_mgr_thread + 52
Thread 3:
0 libsystem_kernel.dylib 0x00007fff8edece6a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff9a954f08 _pthread_wqthread + 330
2 libsystem_pthread.dylib 0x00007fff9a957fb9 start_wqthread + 13
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x00007fff7f5fe310 rcx: 0x00007fff5fbff418 rdx: 0x0000000000000000
rdi: 0x0000000000000707 rsi: 0x0000000000000006 rbp: 0x00007fff5fbff440 rsp: 0x00007fff5fbff418
r8: 0x0000000103700ac0 r9: 0x0000000000000000 r10: 0x0000000008000000 r11: 0x0000000000000206
r12: 0x0000000100f723c8 r13: 0x00000001032006c0 r14: 0x0000000000000006 r15: 0x00007fff5fbffbf0
rip: 0x00007fff8edec866 rfl: 0x0000000000000206 cr2: 0x0000000100b402f3
Logical CPU: 0
Error Code: 0x02000148
Trap Number: 133
Any help if appreciated. Please let me know if more details might be needed on the error. Thanks.
Related
I try to build nedit-ng from the github under macOS Monterey 12.2.
I can build the executable nedit-ng with gcc-9 and g++-9 from brew install.
But at the execution, I get the following error :
$ ./nedit-ng
dyld[52683]: Symbol not found: __ZNKSt3_V214error_category10_M_messageB5cxx11Ei
Referenced from: /Users/fab/Install_Programmes/nedit-ng/build/nedit-ng
Expected in: /usr/lib/libstdc++.6.dylib
zsh: abort ./nedit-ng
and I can't manage to fix this.
If I do a otool -L on executable, I get :
$ otool -L nedit-ng
nedit-ng:
/usr/local/opt/qt#5/lib/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.15.0, current version 5.15.2)
/usr/local/opt/qt#5/lib/QtXml.framework/Versions/5/QtXml (compatibility version 5.15.0, current version 5.15.2)
/usr/local/opt/qt#5/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport (compatibility version 5.15.0, current version 5.15.2)
/opt/X11/lib/libX11.6.dylib (compatibility version 11.0.0, current version 11.0.0)
/usr/local/opt/qt#5/lib/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.15.0, current version 5.15.2)
/usr/local/opt/qt#5/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.15.0, current version 5.15.2)
/usr/local/opt/qt#5/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.15.0, current version 5.15.2)
/usr/local/opt/gcc#6/lib/gcc/6/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.22.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)
/usr/local/lib/gcc/6/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
this may come from the line /usr/local/opt/gcc#6/lib/gcc/6/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.22.0) : indeed, it is indicated gcc#6 whereas for compiling, I have used gcc#9 : it is just a suggestion, maybe nothing related to my issue.
Could anyone see what's wrong at first sight ?
I'm developing a Qt application on mac, using some other libraries. I've
run macdeployqt to gather all the Qt libraries into myApp/Contents/Framworks
copied other libraries listed using otool -L myApp/Contents/MacOS/myApp into this directory
used intall_name_tool -change to change the path to the framworks like install_name_tool -change "/usr/lib/libc++.1.dylib" "#rpath/libc++.1.dylib" ./myApp.app/Contents/MacOS/myApp
But when I'm trying to run macdeployqt again after I changed the path rules, it fails with these errors:
ERROR: Could not parse otool output line: "\t/usr/lib/system/libcache.dylib (compatibility version 1.0.0, current version 83.0.0, reexport)"
ERROR: Could not parse otool output line: "\t/usr/lib/system/libcommonCrypto.dylib (compatibility version 1.0.0, current version 60165.120.1, reexport)"
ERROR: Could not parse otool output line: "\t/usr/lib/system/libcompiler_rt.dylib (compatibility version 1.0.0, current version 101.2.0, reexport)"
ERROR: Could not parse otool output line: "\t/usr/lib/system/libcopyfile.dylib (compatibility version 1.0.0, current version 1.0.0, reexport)"
ERROR: Could not parse otool output line: "\t/usr/lib/system/libcorecrypto.dylib (compatibility version 1.0.0, current version 866.140.1, reexport)"
ERROR: Could not parse otool output line: "\t/usr/lib/system/libdispatch.dylib (compatibility version 1.0.0, current version 1173.100.2, reexport)"
ERROR: Could not parse otool output line: "\t/usr/lib/system/libdyld.dylib (compatibility version 1.0.0, current version 750.6.0, reexport)"
ERROR: Could not parse otool output line: "\t/usr/lib/system/libkeymgr.dylib (compatibility version 1.0.0, current version 30.0.0, reexport)"
ERROR: Could not parse otool output line: "\t/usr/lib/system/liblaunch.dylib (compatibility version 1.0.0, current version 1738.140.1, reexport)"
ERROR: Could not parse otool output line: "\t/usr/lib/system/libmacho.dylib (compatibility version 1.0.0, current version 959.0.1, reexport)"
ERROR: Could not parse otool output line: "\t/usr/lib/system/libquarantine.dylib (compatibility version 1.0.0, current version 110.40.3, reexport)"
ERROR: Could not parse otool output line: "\t/usr/lib/system/libremovefile.dylib (compatibility version 1.0.0, current version 48.0.0, reexport)"
ERROR: Could not parse otool output line: "\t/usr/lib/system/libsystem_asl.dylib (compatibility version 1.0.0, current version 377.60.2, reexport)"
ERROR: Could not parse otool output line: "\t/usr/lib/system/libsystem_blocks.dylib (compatibility version 1.0.0, current version 74.0.0, reexport)"
ERROR: Could not parse otool output line: "\t/usr/lib/system/libsystem_c.dylib (compatibility version 1.0.0, current version 1353.100.2, reexport)"
ERROR: Could not parse otool output line: "\t/usr/lib/system/libsystem_configuration.dylib (compatibility version 1.0.0, current version 1061.141.1, reexport)"
...
And even if I use macdeployqt with other QT projects, this error still exists.
How can I use other libraries in my Qt application correctly? Thanks a lot!
First run ./configure it worked,
then make -j4, it will report
options.c:11145: error: narrowing conversion of '-0x00000000000000001' from 'int' to 'short unsigned int' inside { }
GMP、MPFR、MPC install successed
cat /proc/version
Linux version 2.6.32-504.23.4.el6.x86_64 (mockbuild#x86-029.build.eng.bos.redhat.com) (gcc version 4.4.7 20120313 (Red Hat 4.4-9) (GCC) ) #1 SMP Fri May 29 10:16:43 EDT 2015
file /bin/ls
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped
lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 6.6 (Santiago)
Release: 6.6
Codename: Santiago
iam writing an C++ application with QT 5.3 using QT-Creator as IDE on mac os 10.8.
The problem appears when iam trying to load the QMYSQL plugin with
db = QSqlDatabase::addDatabase("QMYSQL");
it results in
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
so I tried
loader.setFileName("/Users/kilian/Qt/5.3/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib");
qDebug() << loader.load();
qDebug() << loader.errorString();
to get a better output
"Die Bibliothek /Users/foob/Qt/5.3/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib kann nicht geladen werden:
(dlopen(/Users/foob/Qt/5.3/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib, 5):
Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/foob/Qt/5.3/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib
Reason: image not found)"
So I tried otool
otool -L build-$appname-Desktop-Debug/$appname.app/Contents/MacOS/$appname
build-$appname-Desktop-Debug/$appname.app/Contents/MacOS/$appname:
/usr/local/mysql/lib/libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0)
/Users/foob/Qt/5.3/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.3.0, current version 5.3.0)
/Users/foob/Qt/5.3/clang_64/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.3.0, current version 5.3.0)
/Users/foob/Qt/5.3/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.3.0, current version 5.3.0)
/Users/foob/Qt/5.3/clang_64/lib/QtSql.framework/Versions/5/QtSql (compatibility version 5.3.0, current version 5.3.0)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
As information, I built the QMYSQL Plugin by myself with
$cd Qt/5.3/Src/qtbase/src/plugins/sqldrivers/mysql/
$qmake "INCLUDEPATH+=/usr/local/mysql/include" "LIBS+=-L/usr/local/mysql/lib -lmysqlclient_r" mysql.pro
$ make
make -f Makefile.Release all
make[1]: Nothing to be done for `all'.
make -f Makefile.Debug all
make[1]: Nothing to be done for `all'.
$ make install
make -f Makefile.Release install
cp -f "../../../../plugins/sqldrivers/libqsqlmysql.dylib" "/Users/foob/Qt/5.3/clang_64/plugins/sqldrivers/libqsqlmysql.dylib"
cp -f /Users/foob/Qt/5.3/Src/qtbase/lib/cmake/Qt5Sql/Qt5Sql_QMYSQLDriverPlugin.cmake /Users/foob/Qt/5.3/clang_64/lib/cmake/Qt5Sql/
make -f Makefile.Debug install
cp -f "../../../../plugins/sqldrivers/libqsqlmysql_debug.dylib" "/Users/foob/Qt/5.3/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib"
cp -f /Users/foob/Qt/5.3/Src/qtbase/lib/cmake/Qt5Sql/Qt5Sql_QMYSQLDriverPlugin.cmake /Users/foob/Qt/5.3/clang_64/lib/cmake/Qt5Sql/
Everythink seems fine, i set earlier DYLD_LIBRARY_PATH in /etc/profile
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
echo $DYLD_LIBRARY_PATH
results in
/usr/local/mysql/lib:
The folder /usr/local/mysql/lib :
$ls -lisa /usr/local/mysql/lib/
total 556840
2147230 0 drwxr-xr-x 12 root wheel 408 21 Jun 00:01 .
2147093 0 drwxr-xr-x 17 root wheel 578 21 Jun 00:01 ..
2147231 8384 -rwxr-xr-x 1 root wheel 4289380 6 Mai 13:18 libmysqlclient.18.dylib
2147232 20744 -rw-r--r-- 1 root wheel 10620040 6 Mai 13:18 libmysqlclient.a
2147233 8 lrwxr-xr-x 1 root wheel 23 21 Jun 00:01 libmysqlclient.dylib -> libmysqlclient.18.dylib
2147234 8 lrwxr-xr-x 1 root wheel 23 21 Jun 00:01 libmysqlclient_r.18.dylib -> libmysqlclient.18.dylib
2147235 8 lrwxr-xr-x 1 root wheel 16 21 Jun 00:01 libmysqlclient_r.a -> libmysqlclient.a
2147236 8 lrwxr-xr-x 1 root wheel 20 21 Jun 00:01 libmysqlclient_r.dylib -> libmysqlclient.dylib
2147237 261360 -rw-r--r-- 1 root wheel 133814816 6 Mai 13:08 libmysqld-debug.a
2147239 266288 -rw-r--r-- 1 root wheel 136335512 6 Mai 13:18 libmysqld.a
2147240 32 -rw-r--r-- 1 root wheel 14544 6 Mai 13:18 libmysqlservices.a
2147241 0 drwxr-xr-x 17 root wheel 578 6 Mai 13:21 plugin
The related parts of the .pro file iam using
macx: {
INCLUDEPATH += /usr/local/mysql/include \
/Users/foob/Qt/5.3/clang_64/include
}
macx: {
LIBS += -L/usr/local/mysql/lib -lmysqld -lmysqlclient -v
}
Does anyone have an hint what iam doing wrong?
P.S. I changed User & App name for privacy.
Fixed the issue, wasn't aware its possible to use otool and install_name_tool for dylibs too.
Simply did it with
install_name_tool -change libqsqlmysql_debug.dylib /Users/foob/Qt/5.3/Src/qtbase/plugins/sqldrivers/libqsqlmysql_debug.dylib Qt/5.3/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib
Now it works. Does anyone knows why the libs aren't found in the first place? I checked the Makefile produced by qmake and it seems fine. Strange Mac ...
I have an application which links to our own library and boost date_time, both using libc++ (with clang).
When running the application it stops right away looking for __ZTISt12out_of_range ( = "typeinfo for std::out_of_range") in the boost library.
bash-3.2$ ./communicator
dyld: Symbol not found: __ZTISt12out_of_range
Referenced from: (...)/../Frameworks/libsipclient.dylib
Expected in: (...)/../Frameworks/libboost_date_time-mt.dylib
in (...)/../Frameworks/libsipclient.dylib
Trace/BPT trap: 5
They both have it as undefined symbol, and /usr/libc++.1.dylib has it:
bash-3.2$ nm -u ../Frameworks/{libsipclient,libboost_date_time-mt}.dylib | grep __ZTISt12out_of_range
__ZTISt12out_of_range
__ZTISt12out_of_range
bash-3.2$ nm /usr/lib/libc++.1.dylib | grep __ZTISt12out_of_range
000000000006d5c0 S __ZTISt12out_of_range
Both uses libc++ with correct path according to otool:
bash-3.2$ otool -L ../Frameworks/libsipclient.dylib | grep -e libboost -e libc
#executable_path/../Frameworks/libboost_date_time-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 65.1.0)
bash-3.2$ otool -L ../Frameworks/libboost_date_time-mt.dylib
../Frameworks/libboost_date_time-mt.dylib:
#executable_path/../Frameworks/libboost_date_time-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 65.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
What could be the problem?
libsipclient.dylib was linked originally to a boost::date_time which was linked to libstdc++ instead of libc++ (linker arguments had that path earlier than the libc++ one).