Building GCC's libstdc++ with debug symbols on Windows - gcc

I am developing an app with GCC, mostly on Windows, until I got a crash that couldn't be debugged with the MinGW toolchain build I have. I installed a Linux VM, and debugged it there, which was possible, because the libstdc++ had the symbols I required.
I'm sure the Linux build of libstdc++ was a release (optimized version), because this would be normal to be installed for all apps to use. Same with the Windows version. But how can the Linux version have the necessary debug symbols built in, or if I ask the question I really want an answer to: how can I build GCC's libstdc++ so that I can get a useful stacktrace out of it, and still have it optimized? (note: I am able to recompile GCC/MinGW, so that's not an issue)
I know visual studio has both debug and release versions, but never heard of something like that for Linux. The debug symbols are always in seperate packages as I remember.
Info: I was using Arch linux with the plain GCC packages installed (no special debug versions explicitly selected).

I'll answer this one myself: you need to configure with
--with-stdcxx-debug
This will place a in lib/bin and lib/debug a shared and import library, which contains debug info.

Related

Rust - How to remove the dependency on ucrtbase.dll?

When compiling my Rust app in Windows 10, it is linked against ucrtbase.dll; however, this dll does not exist on some editions of Windows Server 2008 R2 Datacenter, making my app impossible to execute.
I tried setting -Ctarget-feature=+crt-static as found here, but it did not do anything; ldd app.exe still shows this dll.
Is there a way of removing the dependency on this dll?
If your Rust app does not depend on C libraries that specifically require the MSVC toolchain, you can build it for the x86_64-pc-windows-gnu (or i686-pc-windows-gnu, to build for 32-bit CPUs) target instead. This target links to DLLs that are available in all Windows versions.
For more information about the different Windows ABIs, you can check out this documentation page.

Setting up QtCreator cross compiler for ARM on Windows

I need to develop Qt and command line software for the BeagleBone Black and Raspberry Pi-2. Ideally I wish to use QtCreator as I am accustomed to it, but in any case I need to use QtDesigner for GUI work.
I have spent days trawling through articles, going around in circles and getting nowhere.
The Raspberry Pi-2 has Raspbian/Jessie installed together with Qt 5.2.3. I can design, compile and run Qt desktop applications on this. Of course compilation is slow and not really usable for development work.
To try and keep matters simple, I downloaded qt-opensource-windows-x86-android-5.3.2.exe and installed that on my Windows 7 (64-bit) system. My belief is that this Qt install is the same version as the Qt on the Pi-2 and already contains the ARM7 library files required for cross-compiling. All that should be needed is a cross-compiler for Windows/ARM?
Windows/QtCreator complained in Tools > Options > Qt Versions about the Qt 5.3 for Android armv7 stating "No compiler can produce code for this Qt version...".
For a Windows/ARM cross-compiler I downloaded and installed Yagarto (yagarto-bu-2.23.1_gcc-4.7.2-c-c++_nl-1.20.0_gdb-7.5.1_eabi_20121222.exe). I figured I then just need to set the QtCreator compiler path in Tools > Options > Compilers and then things would start working. This is not the case.
Clearly I am missing something important and have managed to become confused by the number of not-quite-relevant articles I have read.
Is Yagarto the cross-compiler I need in this situation?
How do I define the compiler in QtCreator and get rid of the error?
Is there an easier way to set-up this stuff?
Thank you.
Details:
QtCreator 3.2.1 (Qt 5.3.2)
Windows 7 64-bit service pack 1
Edit:
I have just tried again using the GCC ARM Embedded ToolChain and GNU Make for Windows. The result is the same in that I cannot seem to configure the settings for QtCreator ARM7 and make it happy.

Link GCC libraries statically (libgcc and libstdc) on Windows

I am using Mingw environment, GCC compiler and Code::Blocks IDE to create an application that is supposed to work on different Windows versions, without the need of installing any other software. So, I am using the last version of GCC.
I have created the EXE on a Windows 7 and it works perfectly. I moved it on a Windows XP (recently installed, no .NET, no C++ redistributable, no gcc dlls and it asked me for the libgcc_s_dw2-1.dll and for the libstdc++-6.dll. They couldn't be found on the XP computer. With an older version of GCC this didn't happen.
So, I copied those two libraries inside the same folder as the executable. Now, it also worked on the XP.
What I would like is to link both libraries statically. I added the -static option to GCC but it looks like I don't have the static libraries, only the dynamic ones, so I wonder if somebody can tell me where can I download them from and how would I link them.
Thanks so much!

Boost thread local storage in Windows threads

I tried to use Boost thread local storage with Windows threads. I built the project without any problems.
However my question here is, is it okay to use Boost TLS with Windows threads?
Edit
Yes Boost is integrally supported on windows with all major compilers:
Supported compilers and platforms
The library should build and work with a reasonably compliant compiler. The library was > successfully built and tested on the following platforms:
Windows XP, Windows Vista. MSVC 8.0, 9.0. MSVC 7.1 may work too, but it was not tested.
Windows Vista. Intel C++ Compiler 10.1.022, 11.1.048.
Linux. GCC 4.2 and newer. GCC 4.1 may work too, but it was not tested.
Linux. Intel C++ 11.1.056.
The following compilers/platforms are not supported and will likely fail to compile the library:
MSVC 7.0 and older.
Borland C++ 5.5.1 (free version). Newer versions might or might not work.
GCC 4.0 and older.
Windows 9x, ME, NT4 and older are not supported.
I suppose you mean what "libraries do I need"?
You need to link to the import library for boost threads, usually a file like
C:\Program Files\boost\boot_1_47_0\lib\libboost_pthread....lib
This file can be added to the additional libraries to link box in the c++ linker settings. Don't forget to add it for debug and release builds.
PS. don't have Windows handy right now, so I can't do the screen shots.

Navit and Debug it

Does anybody know how i can debug Navit. It doesn't matter if i can do it in MS Visual Studio or Eclipse. It doesn't matter if I have to do that under Windows or Ubuntu.
Navit is a C application, and can be debugged using any debugger that can debug C programs.
The details depend on your development environment (IDE/editor, compiler, operating system).
For development on Linux, popular debugger options include:
gdb (text-based)
DDD (graphical)
Eclipse CDT (graphical)
Pyclewn (vim plugin)
Some notes:
Usually you want to build in debug mode (cmake option -DCMAKE_BUILD_TYPE=Debug). This will build with symbols and disable optimizations, which makes debugging easier.
When running the navit binary without installing it, you must run it from the directory it is created in - otherwise it will not find the plugins (which are compiled to separate libraries). Take care to configure the current directory correctly in the debugger.

Resources