I have Centos7 and I see both 32 and 64 bit version of gdb are installed however /usr/bin/gdb is the 64bit version. How can I invoke 32bit gdb version since i need to debug application compiled with -m32 compiler option
The 64-bit GDB is perfectly capable of debugging both 64 and 32-bit programs. You don't need to invoke 32-bit GDB.
Related
TWO QUESTIONS HERE:
according to this in another post elsewhere --
"had to compile a 32-bit application using GNU gcc on the 64-bit version of Linux.
Luckily, gcc man page directed me to the '-m32' and '-m64' options. These options generate code for 32-bit or 64-bit environments, respectively.
The 32-bit environment sets int, long and pointer to 32 bits and generates code that runs on any i386 system.
The 64-bit environment sets int to 32 bits and long and pointer to 64 bits and generates code for AMD's x86-64 architecture."
I have this C program I modified adding features to it that I wanted and needed -- now that I have moved from a 32 bit Linux to a 64 Bit linux this program no longer works with 64 bit Linux.
before I get to ahead of myself --
Question: do I now have to re-compile it as a 64 bit program using m64 to get it to work?
when I recompiling it with the -m32 I get an error as well.
using Xlib.h
/usr/include/X11/Xlib.h:38:23: fatal error: sys/types.h: No such file or directory
I have already googled into this error -- looking at several posts and made sure I have build-essential installed, and it is.
and xlib.h are installed too.
is this looking for "sys/types.h" referencing the X11 or somewhere else?
I have no idea how to fix this problem either.
Question: do I now have to re-compile it as a 64 bit program using m64 to get it to work?
If you already have a 32-bit executable, you should be able to run it on a 64-bit Linux. Provided you have the required 32-bit system libraries installed.
when I recompiling it with the -m32 I get an error as well.
That most likely means you do not have 32-bit development packages installed.
I have an executable compiled on a 64-bit machine using Code::Blocks and GCC compiler. I also have someone on a 32-bit machine that can't run the executable. Do I need to make two separate versions of the executable, or is there a way that I can compile it to run on both 32-bit and 64-bit systems?
You could use -m32 in gcc command line to build a 32-bit version. Please make sure your code is portable from 64-bit to 32-bit.
I wish to generate 32 bit Fortran binaries on my 64 bit Win 7 Pro machine (using 64 bit gfortran in Cygwin) so I can then run them on my 32 bit Win 7 machine (using 32 bit Cygwin).
Is this doable with a switch at compile and/or link time?
You can cross-compile your code, but you'll probably need a cross-toolchain (i.e. cross mingw/Cygwin). Then you can add --target= to specify e.g. i686 or i586, depending on what the toolchain supports.
My guess is that it would be easiest to use a 32bit Cygwin installation instead and do a "native" build.
I want to build an application on Centos 5.6 64bit as a 64bit application and link it with a 32bit library.
How can i do this and what is the switches i need to pass to the gcc to compile and link.
Thanks.
You cannot. A 64 bit application must link to 64 bit libraries. If the library you must use is 32 bit, you must compile your application 32 bit as well.
I'm trying to build Qt in a shared 64 bit mode on my 32bit XP system.
I can configure the QMake and start the 64bit build. The problem is that when the build starts, the first thing that happens in that the process builds ui, moc and rcc utility compilers in 64 bit mode, then tries to run them on my 32bit machine.
Does anyone know how to configure the build so that it does not build those compilers first?
I don't think Qt support cross-compilation on Windows.
I suggest doing it the other way around, by using a 64bit machine (and a 64 bit version of Windows) to build the 64bit and 32bit versions.