g++ with -m32 --coverage profile .gcda: Cannot open - gcc

When I'm trying to compile my C/C++ software using gcc/g++ with -m32 option on RedHat 6.10 which is a 64bit OS, we have a Dell isilon file system exporting 64 bit file ID's we get a run-time error using code coverage compile options. I wrote a simple main() test app test.cpp and compile with the following compile options.
g++ --coverage -m32 test.cpp -o test
When I run the 32bit executable we get a run-time error relating to our file system exporting 64bit file ID's vs 32 bit. We don't want to change to a 32bit file ID export.
./test
profiling:test.gcda: Cannot open
If we compile the app without the -m32 option the problem goes away. However, I need to compile with -m32 for other reasons outside the scope of this discussion.
gcc version 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC)
RedHat 6.10 64bit OS
Thank you for any help.

It appears that a later version of gcc has fixed this problem. I now know that gcc version 8.2.0 compiles properly and doesn't have the error about not being able to find the .gcda file. This makes sense since the Dell isilon system is newer and the gcc compiler version we've been using with RedHat 6.10 is quite old.

Related

gcc cross compilation for powerpc7448

I want to cross compile the gcc for powerpc7448, and after this I want to run one simple program and get the elf from the cross compiled gcc for powerpc7448,I am using the linux OS,could anyone please suggest me the steps, cross compilation gcc for powerpc7448(any link) and what are all the components are required for cross compilation,Thanks in advance.
Try ELDK cross compiler toolchain (linux distributions) for PowerPC:
ftp://ftp.denx.de/pub/eldk/4.2/ppc-linux-x86/distribution/README.html
Check Eldk version 4.2.
Help: https://www.denx.de/wiki/ELDK-5/WebHome
ppc_74xx-gcc from eldk can be used to compile for your platform.
`
$ ppc_74xx-gcc -c myfile.c
`

How to cross compile solaris 32-bit

We are currently building our Go executables for several platforms including Solaris 64-bit. We have requests for a 32-bit Solaris executable version as well and I am unable to get this to work (the person who setup the Solaris 64-bit cross compiler is gone and unreachable).
I tried just setting -m32 flag on go build using our existing solaris cross compilation, but that didn't work, so I am attempting to build a Solaris 32-bit specific cross compiler.
I googled and found some vague examples, so I am following this process:
Copy headers and libraries from a 32-bit Solaris machine to my Linux build machine.
D/L and build binutils and gcc pointing SYSROOT to the downloaded 32-bit Solaris headers and libraries where:
$TARGET=sparc-sun-solaris2.10
$SYSROOT=/path/to/solaris32/includes
$PREFIX=/path/to/gcc-output
binutils-2.31/configure -target=$TARGET --prefix=$PREFIX -with-sysroot=$SYSROOT -v
gcc-8.2.0/configure --target=$TARGET --with-gnu-as --with-gnu-ld --prefix=$PREFIX -with-sysroot=$SYSROOT --disable-libgcj --enable-languages=c,c++,go -v
Create a symlink to gogcc and put GCC on the path
Compile a trivial test go program like this:
go build --compiler gccgo --gccgoflags "-m32 -O3 -static-libgo -Wl,-dy -lnsl -lsocket -lrt -lsendfile" -o ${GOTOOLS}/${BINARIES}/${PROJECT_NAME}/test/solaris_sparc32 test/main.go
This fails as follows:
go build: when using gccgo toolchain, please pass compiler flags using -gccgoflags, not -gcflags
command-line-arguments
gccgo: error: may not use both -m32 and -m64
Clearly I don't know what I'm doing. Can anyone point me in the right direction?
Solaris 32-bit does not appear to be supported, according to the list of supported OS/arch targets:
The valid combinations of $GOOS and $GOARCH are:
$GOOS $GOARCH
...
solaris amd64
...
That is, Solaris 64-bit is explicitly listed as a supported platform but Solaris 32-bit is not listed.
As such, there is good reason to believe that go programs will not run reliably on Solaris 32-bit systems and you probably should not agree to support that platform (if you do happen to get that cross compilation working) mainly because the go team itself does not support it!

cannot compile C program with GCC on Mac and -masm=intel

I'm trying to compile a C program that has some inline assembly code in Intel format. I'm using GCC 4.9 (installed via Homebrew) on Mac 10.9, and the compiler flags:
gcc-4.9 -m32 -masm=intel -std=gnu99 get_rating.c
Unfortunately I get an error:
error: -masm=intel not supported in this configuration
I've tried many different combinations of the flags, but I keep getting that error. I can't leave out the -masm=intel flag, because the code I'm trying to compile uses Intel.
How can I compile the program? Is it at all possible on my Mac (version 10.9) or do I need to run a virtual machine?
The GCC docs state that Darwin does not support intel, so it seems you are out of luck with the direct approach. Virtual machine as you suggested, cross compiling, converting the assembler to att, and replacing the assembler with C are among your options - which is best for you you'll have to figure out.
HTH

How to Compile 32-bit Apps on 64-bit RHEL?

I'm trying to compile a 32-bit C application on RHEL 7 64-bit using gcc 4.8. I'm getting a compiler error /usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory. What do I need to do to get 32 bit apps compiled and linked?
To get RHEL 7 64-bit to compile gcc 4.8 32-bit programs, you'll need to do two things.
Make sure all the 32-bit gcc 4.8 development tools are completely installed:
sudo yum install glibc-devel.i686 libgcc.i686 libstdc++-devel.i686 ncurses-devel.i686
Compile programs using the -m32 flag
gcc pgm.c -m32 -o pgm

MinGW64 cannot compile 32bit code

I've downloaded MinGW from this link x64-4.8.1-posix-sjlj-rev1 but when I try to build for x86 target I've lots of linkage errors... seems that only x64 lib are installed...
I've need to build for x86 and x64 platforms on windows... Have I to download both x64 and x86 or are some simpler ways?
Edit I'm using eclipse keplero as IDE
I've tryed to build myself a simple hello world program with g++ -m32 -std=c++11 test.cpp -o test32.exe and g++ -m64 -std=c++11 test.cpp -o test64.exe. And all is ok... So the problem was with eclipse... After a little a discovered that I need to use MYSY ( set in PATH ) and set -m32 also in the c++ linkage options...
Now all is fine.
I've also tryed to use NetBeans C++ as IDE... seems a gread IDE!!!
It is not multilib enabled. That's why you are not able to compile 32-bit(x86) program. You can get multilib enabled toolchain from following link:
For 64-bit machine: 64-Bit
For 32-bit machine: 32-Bit

Resources