mingw 64-bit build of gdb crashes before launching program - crash

I have installed msys2 and mingw64 and I am using it for programming purposes. I used Pacman to install GCCc which comes with GDB. I am having difficulty running GDB. I get the following error in two programs I am running:
(gdb) run
Starting program: C:\Users\Nick\Desktop\hwselector.exe
warning: cYgFFFFFFFF 18023CC60 0
[New Thread 18816.0x3cc0]
[New Thread 18816.0x4284]
[New Thread 18816.0x4d98]
Number of Problems: warning: cYgstd 0xffffcb90 d 3
[Thread 18816.0x3cc0 exited with code 0]
[Thread 18816.0x4e88 exited with code 0]
[Thread 18816.0x4d98 exited with code 0]
[Inferior 1 (process 18816) exited normally]
I do not know GDB internals enough to fix this problem. Does anyone know why this is happening? I am running Windows 7 Professional 64-bit edition. GDB and GCC are their respective 64 bit versions (I assume) and the latest version of MSYS64

If you used pacman -S gcc or similar to install gcc, that is not the right gcc to use. Better delete it and use pacboy -S gcc.
Also, gcc does not come with gdb. Make sure you install it separately (pacboy -S gdb), I believe you may accidentally be using a cygwin gdb.

Open your executable with DependancyWalker (http://www.dependencywalker.com/) for the same version (x86 / x64) and check if there are any missing dependancy DLLs.
In many cases where GDB couldn't give me information, DependancyWalker helped me in detecting the fact that DLLs were missing, or even loaded from the wrong location.

Related

Meet "dyld: Library not loaded of wrong architecture" for libquadmath.0.dylib when running scip

I installed SCIP Optimization Suite from the SCIPOptSuite-7.0.2-Darwin-Ipopt-gcc10.sh installer of precompiled binary.
I also installed gcc and tbb by running:
brew install gcc
brew install tbb
Error message:
$ SCIPOptSuite-7.0.2-Darwin/bin/scip
dyld: Library not loaded: /usr/local/lib/7/i386/libquadmath.0.dylib
Referenced from: /Users/it/VirtualBox/10运筹学/14SCIP/01install/SCIPOptSuite-7.0.2-Darwin/bin/scip
Reason: no suitable image found. Did find:
/usr/local/lib/7/i386/libquadmath.0.dylib: mach-o, but wrong architecture
/usr/local/lib/7/i386/libquadmath.0.dylib: stat() failed with errno=1
/usr/local/lib/7/i386/libquadmath.0.dylib: mach-o, but wrong architecture
[1] 93720 abort SCIPOptSuite-7.0.2-Darwin/bin/scip
There is other libquadmath.0.dylib with x86_64 architecture installed:
$ sudo find / -name libquadmath.0.dylib
Password:
/usr/local/lib/7/i386/libquadmath.0.dylib
/usr/local/lib/7/libquadmath.0.dylib
/usr/local/opt/lib/gcc/7/i386/libquadmath.0.dylib
/usr/local/opt/lib/gcc/7/libquadmath.0.dylib
/usr/local/Cellar/4.6.4/lib/gcc/x86_64-apple-darwin12.5.0/4.6.4/i386/libquadmath.0.dylib
/usr/local/Cellar/4.6.4/lib/gcc/x86_64-apple-darwin12.5.0/4.6.4/libquadmath.0.dylib
/usr/local/Cellar/gcc/10.2.0_2/lib/gcc/10/libquadmath.0.dylib
/usr/local/Cellar/gcc#4.6/4.6.4/lib/gcc/x86_64-apple-darwin12.5.0/4.6.4/i386/libquadmath.0.dylib
/usr/local/Cellar/gcc#4.6/4.6.4/lib/gcc/x86_64-apple-darwin12.5.0/4.6.4/libquadmath.0.dylib
/Users/it/miniconda3/lib/python3.6/site-packages/numpy/.dylibs/libquadmath.0.dylib
/Users/it/miniconda3/lib/python3.6/site-packages/scipy/.dylibs/libquadmath.0.dylib
/Users/it/miniconda3/envs/py2/lib/python2.7/site-packages/scipy/.dylibs/libquadmath.0.dylib
$ lipo /usr/local/lib/7/libquadmath.0.dylib -archs
x86_64
I wonder why scip did not find these dylibs with right architecture?
Thanks very much.
First of all make sure you have the correct version of gcc installed, the installer that you downloaded asks for version 10.
Second, try installing all prerequisites first and then rerunning the installer-script afterwards.
If that does not help, please check the output of otool -L SCIPOptSuite-7.0.2-Darwin/bin/scip and echo $DYLD_LIBRARY_PATH to see if the library in question is loaded.
Lastly, you can try to patch the binary by adjusting the path to the library for the correct one:
install_name_tool -change /usr/local/lib/7/i386/libquadmath.0.dylib /usr/local/Cellar/gcc/10.2.0_2/lib/gcc/10/libquadmath.0.dylib SCIPOptSuite-7.0.2-Darwin/bin/scip

valgrind not building 32 bit rpm on 64 bit machine

I have 32 bit C application(running on 64 bit system) leaking memory.
Do debug it I have downloaded valgrind 3.8.1 from http://valgrind.org/downloads/.
Did ./configure, make and make install to install valgrind.
But valgrind builds only 64 bit memcheck-amd64-linux binary.
32 bit memcheck is not getting built.
As a result I get below errors
# valgrind --tool=memcheck --time-stamp=yes -v --track-origins=yes --leak-check=yes /home/test_code32 --error-limit=no
valgrind: failed to start tool 'memcheck' for platform 'x86-linux': No such file or directory
Stracing valgrind gives me:
execve("/usr/local/lib/valgrind/memcheck-x86-linux", ["valgrind", "--tool=memcheck", "--time-stamp=yes", "-v", "--track-origins=yes", "--leak-check=yes", "/home/test_code32", "--error-limit=no"], [/* 60 vars */]) = -1 ENOENT (No such file or directory)
write(2, "valgrind: failed to start tool '"..., 94valgrind: failed to start tool 'memcheck' for platform 'x86-linux': No such file or directory
) = 94
I checked the ./configure output and it says:
checking for 32 bit build support... no
I am using gcc (SUSE Linux) 4.3.4.
Any idea how to get valgrind build 32 bit memcheck on 64 bit machine?
I have resolved the issue.
I installed 32-bit gcc support and then again built valgrind and it created the 32 bit memcheck.
I had the same issue, and resolved it by setting an environment variable:
export VALGRIND_LIB=/YourValgrindInstallDirectory/lib/valgrind
which is the direcory where valgrind missing lib is.
Try re-running your configure script with the --enable-only32bit option:
./configure --enable-only32bit
I installed the 32bit version of valgrind and it seems that it works now. The information about installing the 32bit version I took it from here

install valgrind, Fatal error at startup

I am installing Valgrind but encounter some problems. The info of my platform:
Linux xx-ThinkPad-X61 3.2.0-39-generic-pae #62-Ubuntu SMP Wed Feb 27 22:25:11 UTC 2013 i686 i686 i386 GNU/Linux
I follows the installation instruction of the README file in the valgrind folder.
./configure ->make -> sudo make install.
I can't understand the following reminder in the README file, I just overlooked it.
Important! Do not move the valgrind installation into a place
different from that specified by --prefix at build time. This will
cause things to break in subtle ways, mostly when Valgrind handles
fork/exec calls.
after typing "valgrind ls -l", error appears:
xx#xx-ThinkPad-X61:~/Downloads/valgrind-3.8.1$ valgrind ls -l
==7674== Memcheck, a memory error detector
==7674== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==7674== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==7674== Command: ls -l
==7674==
valgrind: Fatal error at startup: a function redirection
valgrind: which is mandatory for this platform-tool combination
valgrind: cannot be set up. Details of the redirection are:
valgrind:
valgrind: A must-be-redirected function
valgrind: whose name matches the pattern: strlen
valgrind: in an object with soname matching: ld-linux.so.2
valgrind: was not found whilst processing
valgrind: symbols from the object with soname: ld-linux.so.2
valgrind:
valgrind: Possible fixes: (1, short term): install glibc's debuginfo
valgrind: package on this machine. (2, longer term): ask the packagers
valgrind: for your Linux distribution to please in future ship a non-
valgrind: stripped ld.so (or whatever the dynamic linker .so is called)
valgrind: that exports the above-named function using the standard
valgrind: calling conventions for this platform. The package you need
valgrind: to install for fix (1) is called
valgrind:
valgrind: On Debian, Ubuntu: libc6-dbg
valgrind: On SuSE, openSuSE, Fedora, RHEL: glibc-debuginfo
valgrind:
valgrind: Cannot continue -- exiting now. Sorry.
Could someone give some suggestions?
thanks!
I also faced this error, but finally resolved in below manner.
I am having 64 bit Ubuntu 14.04, and my executable is 32 bit. When I run my 32 bit executable with valgrind I got this same error. This error was not resolved even after installing libc6-dbg (using command apt-get install libc6-dbg).
Later I found like whatever libc6-dbg present in my machine was 64 bit and valgrind requires a 32 bit libc6-dbg to run my 32 bit executable. After installing 32 bit libc6-dbg (using the command apt-get install libc6-dbg:i386) it started working.
Valgrind indicates it cannot work because it is missing the libc debug info,
and it indicates which package has to be installed to solve that.
In your case (Ubuntu), you must install
libc6-dbg
apt install -y libc6-dbg
It worked for me. (Note: without :i386.)
A hunch is that Valgrind might have upgraded to 64-bit since the answer
by rashok was written.

Merging Mono Runtime 3.0.4 with MonoDevelop 3.x fails

I'm trying to merge the Mono Runtime (v 3.0.4) with a MonoMac application, but since the upgrade to 3.0.4 (from 2.10.11) this fails with the following error:
Merging Mono Runtime into app bundle
/Applications/MonoDevelop-old.app/Contents/MacOS/lib/monodevelop/AddIns/MonoDevelop.MonoMac/mmp
-nolink "-minos=10.6.6"
-o "/Users/ted/Documents/XCode/Mac/StageTimer/StageTimer/bin/Release"
-n "StageTimer"
-a "/Library/Frameworks/Mono.framework/Versions/3.0.4/lib/mono/4.0/System.dll"
-a "/Library/Frameworks/Mono.framework/Versions/3.0.4/lib/mono/4.0/System.Xml.dll"
-a "/Library/Frameworks/Mono.framework/Versions/3.0.4/lib/mono/4.0/System.Core.dll"
-a "/Library/Frameworks/Mono.framework/Versions/3.0.4/lib/mono/4.0/System.Xml.Linq.dll"
-a "/Library/Frameworks/Mono.framework/Versions/3.0.4/lib/mono/4.0/System.Drawing.dll"
-a "/Applications/MonoDevelop-old.app/Contents/MacOS/lib/monodevelop/AddIns/MonoDevelop.MonoMac/MonoMac.dll"
"/Users/ted/Documents/XCode/Mac/StageTimer/StageTimer/bin/Release/StageTimer.exe"
Process exited with code 1, command:
pkg-config --variable=prefix mono-2
Unhandled Exception: System.IO.DirectoryNotFoundException: Directory '/lib/mono/4.0' not found.
Even if I configure MonoDevelop to use Mono 2.10.11 instead of 3.0.4 it fails with the same error (and path: '/lib/mono/4.0'). Next I also tried modifying the symlink in /Library/Frameworks/Mono.framework/Versions/Current to point to 2.10.11 but still the same error & path.
Anyone with mono & pkg-config skills that knows how to configure this?
Similar issue happened to F# compiler when one tried to run it alongside Mono 3.0.4 (instead of 3.0.3). The issue boils down to a bugfix in Mono that prevents conflicting the homebrew pkg-config set up. The workaround that was adopted in F# sources was to hardcode the path to Mono's pkg-config.
You could probably get the same result as this by just overriding the environment variable PKG_CONFIG_PATH when launching MonoDevelop, this way:
PKG_CONFIG_PATH=/path/were/mono/pc/files/are/in/Mac:$PKG_CONFIG_PATH monodevelop
The exact path must be somewhere underneath /Library/Frameworks/Mono.framework/Versions/Current/ , just look out for files with .pc extension.

How to specify c++0x flag on cent os

The command g++ -o myprogram myprogram.c -std=c++0x works well on ubuntu but when I try the same with centos it throws me an error cc1plus: error: unrecognized command line option "-std=c++0x". Even google doesn't give the answer. Have anybody experienced it before? Does anybody know the solution?
You most likely have different versions of the compiler on each system, run g++ --version to see which version you're running on each (-std=c++0x is only supported from version 4.4 of g++).
In the CentOS repositories is something called g++44. Yum it, or grab it however makes the most sense to you.
Then, when you build, use g++44... with the rest of your switches. That might help, you never know.
If it works for you then you could remove g++ and symlink g++44.