Installing debug version of Qt on Mac OSX - macos

I need to step through the Qt code to help solve a bug in my C++ application. I've downloaded qt-mac-opensource-src-4.5.2.tar from here and followed the install instructions that came with this:
unpacked the file to /tmp.
typed ./configure -debug.
typed make.
typed sudo make install.
edited the PATH environment variable as instructed.
set the DYLD_IMAGE_SUFFIX environment variable to _debug.
This installed Qt and my Qt application runs, but I still can't step into the Qt code.
I'm using Xcode 3.1.3 and tried changing the Executable Info to "use debug suffix when loading frameworks". This generated a lot of warnings like:
warning: Could not find object file "/private/tmp/qt-mac-opensource-src-4.5.2/src/corelib/.obj/debug-shared/qmalloc.o" - no debug information available for "global/qmalloc.cpp".
warning: Could not find object file "/private/tmp/qt-mac-opensource-src-4.5.2/src/corelib/.obj/debug-shared/qnumeric.o" - no debug information available for "global/qnumeric.cpp".
and also a lot of non-qt related warnings.
I'd shutdown the Macbook Pro overnight, which I can only assume clears the tmp directory as the unpacked file is no longer there.
I think I could fix it by rebuilding Qt without frameworks, but this is more of a work-around than a fix that will probably come back to bite me. I'm also a bit reluctant to do this, when each rebuild takes between 3 and 4 hours.
Alternatively, would downloading the binaries and debug libs work?
I'd be grateful for any suggestions on what I'm missing and how I address this.
Thanks.

With the help of Qt support, I've now resolved this.
There were a couple of issues:
The Qt debug "make install" doesn't currently generate dSYM files for the _debug stuff. They've raised a bug about this. To get round this:
4a. cd /usr/local/Trolltech/Qt-4.5.2/lib
4b. Type /usr/bin/dsymutil -o QtGui.framework/QtGui_debug.dSYM QtGui.framework/Versions/4/QtGui_debug
4c. Repeat for each Qt framework.
The tmp directory does indeed get wiped on each reboot. To get round this:
7- Copy the entire contents of /tmp/qt-mac-opensource-src-4.5.2 to a new directory ~/Qt .
I also added both the frameworks and source code to the Xcode project.

Have a look at this http://doc.trolltech.com/4.5/debug.html
There is a section especially for debugging under MacOSX and Xcode...
I guess you need to generate a makefile with debug option using qmake !

In OS X 10.6 and 10.6.1, setting DYLD_IMAGE_SUFFIX to _debug will cause problems. Hopefully this will be addressed by a future update of OS X 10.6.

Related

XCode standard C++ headers suddenly not found before installing OSX update

I have a C++ project that have been compiling fine until now, I did not install any update of my system or XCode but I get this error:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/wchar.h:123:15: fatal error: 'wchar.h' file not found
This file does exist on my system, so I suppose it's the CMake env paths that are no longer set up properly in the console?
Edit: if I clean my build dir and regenerate the whole CMake project, it is working again, but I still find this behaviour very unpleasant.
This has happened just when there was an available update for MacOS 13.0, and probably XCode updates going with it. But I did not install any of them yet, and my compilation is already broken.
What is happening so that the dev env is changed anyway?
I remember I had likewise issues last time there was an OS update.
Is any configuration needed to "secure" a dev env on MacOS?
Are all OS updates going to screw my XCode includes etc?

After running make, get 'no rule to make target' error when looking for openGL framework after updating macOS and xcode

I have come back to working on a school project after a short hiatus. However, I can't get it to build anymore. We were provided with the following cmake file:
cmake_minimum_required(VERSION 2.8)
PROJECT(astro)
SET(VTK_DIR /Users/hank/Hartree/VTK/install/lib/cmake/vtk-6.0)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
add_executable(astro MACOSX_BUNDLE astro)
SET(CMAKE_CXX_LINK_FLAGS "-framework OpenGL")
if(VTK_LIBRARIES)
target_link_libraries(astro ${VTK_LIBRARIES})
else()
target_link_libraries(astro vtkHybrid)
endif()
After running cmake and trying to compile the project with make, I get the following error:
*** No rule to make target >'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Deve>loper/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/OpenGL.framework', >needed by 'astro.app/Contents/MacOS/astro'. Stop.
I think I updated my os and xcode during my break from the project, and that caused the issue. I don't know a whole lot about cmake or makefiles, but I think that somehow the path to openGL is getting messed up. Poking through my file system I have found the paths
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk,
and
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk,
and I have been able to find the OpenGL frameworks in those directories, but there is no MacOSX10.12.sdk directory.
I found the following similar questions here and here. However, I have not been using Qt, and when I run xcode-select -pit prints the correct path /Applications/Xcode.app/Contents/Developer
Any ideas how to fix this?
I received exactly the same error when installing an application from source code. I solved this problem by duplicate the "MacOSX10.13.sdk" directory in
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
and rename it "MacOSX10.12.sdk".
I am not an expert in MacOSX or cmake, therefore my answer may not be the best solution and may even cause problems, but it does solve this problem for me. If anyone knows the correct way to do, I'd like to know it.
Here are what I tried:
At beginning, cmake can not find "CMAKE_OSX_SYSROOT" after configuration.
I first changed the cmake settings to
CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.12
CMAKE_OSX_SYSROOT:STRING=macosx10.13
but this does not work. Same error.
Then I updated my Mac to MacOSX 10.13 High Sierra. This time cmake can correctly set
CMAKE_OSX_SYSROOT:PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
but still generates the same error. Therefore I believe the problem comes from the application source code.
I googled how to install MacOSX10.12.sdk and find this post:SDKs.
The easiest way may be finding the old sdk from TimeMachine. But I just bought my Mac and it doesn't have the old version sdk. Therefore I simply duplicate and rename the sdk to try, and it works. I think putting the sym link of the real MacOSX10.12.sdk in the folder will be the best solution to this problem.

MinGW / gcc: The application was unable to start correctly (0xc000007b)

I have been using MinGW and the GNU Fortran compiler for a while in order to compile Fortran programs on Windows, which has always been a successful method. However, I have been getting the following error for the past 4 days:
The application was unable to start correctly (0xc000007b). Click OK to close the application.
The error only happens when running applications that I wrote myself, and that I compiled using the MinGW/gfortran combo. When compiling using Visual Studio and iFort, I have no problem running the applications. The error seems retroactive: applications that were compiled using gfortran a long time ago and ran perfectly until now also break, even though I didn't recompile them. This leads me to think that it is a dynamic library problem. Online searches show that it probably is a compatibility problem between a 64-bit dll and a 32-bit application
I am using Windows 7. One of the latest things I remember doing before starting to get the problem was trying to update MinGW ; I used the mingw-get update and mingw-get upgrade command lines.
After looking around online, I have tried the following fixes:
- reinstalled the Visual C++ Runtime Environment
- reinstalled the .NET framework
- downloaded and replaced a bunch of .dlls like mscvr100.dll, mscvr100d.dll, etc...
- uninstalled and reinstalled MinGW in order to make sure I had the latest gcc version
- run Dependency Walker on a simple application ("Hello World!" type program)
Dependency Walker tells me that a number of .dlls cannot be found (full list: API-MS-WIN-APPMODEL-RUNTIME-L1-1-0.DLL, API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL, API-MS-WIN-CORE-WINRT-L1-1-0.DLL, API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL, API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL, API-MS-WIN-SHCORE-SCALING-L1-1-1.DLL, DCOMP.DLL, GPSVC.DLL, IESHIMS.DLL).
It also highlights in red the libquadmath-0.dll (on which libgfortran-3.dll seems to depend). Indeed, it seems that libquadmath-0.dll is a 64-bit DLL in the middle of a 32-bit program. When opening said .dll with Dependency Walker, I can see that all the modules in this library are x86 except the library itself which is x64 (CPU column of DW). I am not exactly sure how this is possible / how to fix it. The library is found in the Python/Anaconda folder (I installed Python and Anaconda a few weeks ago, the problem did NOT appear at that time).
If anybody has an idea of how to get my environment to work again without reinstalling Windows, I would greatly appreciate it! Thanks!!
I had a similar problem. Looking at Dependency Walker I wasn't loading API-MS-WIN-CORE entries. However, when I went to edit my path it turned out that by bin folder wasn't on the path. Adding, in my case the mingw64 bin folder to the path fixed this issue for me. I only mention the API-MS-WIN-CORE entries since I thought it might be the problem, but in reality it wasn't causing my issue.
I was getting this same error code, and used Dependency Walker to discover that, in my case, the 64-bit version of libwinpthread-1.dll was not being found. This helped me resolve my issue.
So, the solution is to determine the missing dll, track it down on your system and reference its location in your path variable, or find out how to install it if you don't have it.
That said, I also came across the following caveat that's important to know about when using Dependency Walker. It's currently out of date and will actually show false results for WIN-CORE dlls: https://stackoverflow.com/a/36244483/4438237
To work around this, there's a newer program called Dependencies by lucasg, that properly interprets these and won't mistakenly tell you about these falsely missing dlls.
I was getting same Error, as mentioned in above answers the problem is "path not being set" aside from setting path you can alternatively Do this; if u don't want to set the path for some reason:
Open CMD
cd C:\MinGW\bin to navigate to the bin directory of mingw
now u can compile the code as following Gcc (dir of ur .c file) -o (ur output dir) for ex : gcc I:\dir\Hello.c -o I:\dir\output.exe
alternatively if u want to automate the process u can make a batch file to automatically do it for you.
here's the batch file if anyone needs it
#echo off
C:
cd \MinGW\bin\
gcc I:\dir\*.c -o "I:\dir\Output.exe" Rem Replace "dir" with your own directory and * with ur own FileName!
pause
I had a similar error but over came it by editing my environment variables.
I had g77 as part of my path variables and by removing it and leaving gfortran alone, the error disappeared
I was on Windows 10 using cmake-gui to generate a MinGW-w64 project and meet same problem.
My solution: go to start windows, search and open MinGW-w64 terminal, then in terminal call cmake with specifiying cmake options.
Yes the old posts got it right. It is the environmental parameters messed up. I got the same error. It is solved by putting the msys64 path to the first:
Path=c:\msys64\mingw64\bin;%PATH%
The msys64 path was the last, now it is the first. Type it once at the command line after Windows started, or edit the Path environmental parameter if you have the admin right.

Help on installing a library like libical into Xcode

I would like to use the libical library in my project, but I have never used an external library before. I have downloaded the libical files, but I am pretty much stuck there. I do not how how, or even if, I need to build/extract them and then how to get them into Xcode. Any help would be greatly appreciated. Thank you.
If this a pre-built library then you can just drag it into your Xcode project (or use Project => Add to Project…) in the same way that you would for source/header files.
If it's not pre-built then you'll need to build it for whatever environments and architecture you want to target. If it comes with an Xcode project then this is easy. If it's just the usual open source type of distribution then you usually do something like this:
$ ./configure
$ ./make
$ sudo ./make install
That will typically put the built library(ies) and header(s) into somewhere like /usr/local/lib and /usr/local/include. In your main Xcode project you can then just add these header(s) and library(ies) to your project.
Note that if you're cross-compiling, e.g. for iPhone, then you'll need to add some flags to the ./configure command so that you target the correct architecture, e.g. ./configure -build=arm-apple-darwin9.0.0d1.
Note also that it's usually a good idea to check MacPorts to see if they have already fixed up a given open source project for Mac OS X - this can save you a lot of work.
See also this blog about building and using libical on iPhone.
Getting libical to configure and build for arm is more tricky then ./configure -build=arm-apple-darwin.
See this question and answer for more details: Compiling libical

setting up qt for xcode debugging

I just installed QT 4.6 on snow leopard 10.6.3. I wrote a really simple program. I can generate a xcode project using qmake, but I can't step into QT function. How can I set it up?
By default, qt is built with a debug and a non-debug library. This is my understanding. For example,
% ls /Library/Frameworks/QtCore.framework/
Contents/ Headers# QtCore# QtCore.prl QtCore_debug# QtCore_debug.dSYM/ QtCore_debug.prl Versions/
Also, my default from source build of Qt 4.7 branch also has the *_debug libs.
Setting up for Xcode is cake, you just set up your project and
% qmake -spec macx-xcode
This -spec is the default for the official mac distribution, but if you build your own from source the default is macx-g++ which creates a Makefile project.
This generates a MyProject.xcodeproj that comes preconfigured to link all the necessary Qt frameworks, sets up paths, and has a Release and Debug build target set to the same options as the official SDK's.
This is all assuming you have your qt project file set up, if you need to generate that first from a raw source directory:
% qmake -project
Debugging works "out of the box" for these generated *.xcodeproj files. However, there's one little "hitch". Since Qt is full of custom data types, Xcode doesn't know how to display their "values" in the debugger's summary pane. So you can't see what value a QString has, for example.
There's a method of entering custom macros for display, but I've found these often (always?) don't work for QObjects.
To get that working, I've started a project that uses xcode's debugger c callbacks (also mentioned in the above linked article, though their example doesn't even work o.O). I call it Qt4DataFormatters.
I've just started it and have been adding types as the need arises. It's dirt simple to create one using the existing functions as a template though.
I haven't tried this on Mac, but on Linux you need to take the following process:
First, you need to setup Qt so that it has debugging symbols available to you:
./configure -debug-and-release separate-debug-info # other options
With the debugging symbols available, you should now be able to get valid stack traces.
When building your application with qmake, you need to have the debug (or debug_and_release) flag set in your project file:
CONFIG += debug
Once you've done that, you should only need to tell the debugger where the Qt source is located:
(gdb) dir /path/to/qt/src
After that, list should show you the actual Qt source code. You may need to add additional directories under the src directory for the debugger to pick it all up.

Resources