I'm trying to configure mpich library for Fortran only. When I use:
./configure -prefix=/home/jordi/Project/mpich-3.1.3/lib --disable-cxx
--disable-gcc
I obtain this error:
configure: error: **** Incompatible Fortran and C Object File Types!
**** F77 Object File Type produced by " " is : : ERROR: cannot open `' (No such file or directory). C Object File Type produced by "gcc
-O2" is : : ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped.
I don't undestand it. I'm shock that No such file, what file want?
I try to use CFLAGS=-m64 CXXFLAGS=-m64, if that's a problem with 64 bits but it doesn't work.
Can you help me?
Thanks for your time
Q: I get a configure error saying "Incompatible Fortran and C Object File Types!"
A: This is a problem with the default compilers available on Mac OS: it provides a 32-bit C compiler and a 64-bit Fortran compiler (or the other way around). These two are not compatible with each other. Consider installing the same architecture compilers. Alternatively, if you do not need to build Fortran programs, you can disable it with the configure option --disable-f77 --disable-f90.
Related
I have seen in Specifying an architecture in gdb-multiarch :
If I compile a C program with any arm compiler (e.g. arm-none-eabi-gcc) and afterwards call gdb-multiarch with the binary as second param(e)ter, it will correctly determine the machine type and I can debug my remote application.
I am using mingw-w64-x86_64-gdb-multiarch 12.1-1 on MINGW64 (MSYS2) on Windows 10; and unfortunately, it seems it cannot determine the architecture. I have built an executable for Pico/RP2040 with gcc on this same system, and the system sees it as:
$ file myexecutable.elf
myexecutable.elf: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped
However, if I try to run this in gdb-multiarch, I get:
$ gdb-multiarch myexecutable.elf
GNU gdb (GDB) 12.1
...
warning: A handler for the OS ABI "Windows" is not built into this configuration
of GDB. Attempting to continue with the default armv6s-m settings.
Reading symbols from myexecutable.elf...
(gdb)
Well, as the warning says, it seems that gdb-multiarch sees this .elf as 'OS ABI "Windows"' - similar to what was noted in Specifying an architecture in gdb-multiarch :
If however I call gdb-multiarch on its own, it will assume my machine type (x86_64) and tries to debug the remote target with the wrong architecture..
... except, here I'm calling gdb-multiarch with the binary as second parameter - and I still have that problem!
The linked question already explains that set architecture arch from within GDB should work; however, I'm not exactly sure what to enter: file says this executable is "ARM, EABI5", and I've tried to derive an architecture label from that, which doesn't quite work:
(gdb) set architecture armeabi5
Undefined item: "armeabi5".
... and I'm not that knowledgeable with ARM, so that I'd know exactly what to enter here manually.
Therefore, I would prefer if gdb-multiarch found the architecture on its own automatically.
How can I persuade gdb-multiarch to detect the (ARM) architecture of the compiled file correctly?
You may be trying to use a multiarch GDB suitable for use on Intel architectures only.
You can check by starting GDB and entering the following command:
set architecture. If this is the case, the list of supported architectures will look like this:
(gdb) set architecture
Requires an argument. Valid arguments are i386, i386:x86-64, i386:x64-32, i8086, i386:intel, i386:x86-64:intel, i386:x64-32:intel, auto.
(gdb)
For debugging a cortex-m0 target, I would suggest using the GDB provided with the Arm arm-none-eabi toolchain, arm-none-eabi-gdb:
(gdb) set architecture
Requires an argument. Valid arguments are arm, armv2, armv2a, armv3, armv3m, armv4, armv4t, armv5, armv5t, armv5te, xscale, ep9312, iwmmxt, iwmmxt2, armv5tej, armv6, armv6kz, armv6t2, armv6k, armv7, armv6-m, armv6s-m, armv7e-m, armv8-a, armv8-r, armv8-m.base, armv8-m.main, armv8.1-m.main, arm_any, auto.
(gdb)
(gdb) set architecture armv6-m
The target architecture is set to "armv6-m".
(gdb)
Architecture for Cortex-M0/Cortex-M0+ is armv6-m, but I was always able to debug Cortex-M0 programs with GDB without having to use set architecture.
I am configuring mpich 3.4.3 by using Intel fortran(not gfortran) and gcc, and my system is ubuntu18.04. I compiled by:
./configure --prefix=/opt/mpich --with-device=ch3
When I use gfortran and gcc (the default mode) to comfigure, all works well, but my model needs intel fortran but not gfortran, so I added before configuring like:
export FC=ifort
export F90=ifort
unset F90
unset F90FLAGS
Then I reconfigured, however, here appears the error:
error: **** Incompatible Fortran and C object file types!
F77 object file type produced by"ifort -m64" is:: ELF 64-bit LSB relocatable, x86-64,version 1(GNU/LINUX), not stripped.
C object file type produced by"gcc -O2" is:: ELF 64-bit LSB relocatable, x86-64,version 1(SYSV), not stripped.
I searched and found most of the cases are about problem of mac-OS 32-bit and 64-bit, but my system is not mac OS, I have no idea which vetsion I should change. Also, I need both ifort and gcc, so I can't disable any of them. Thank you so much if someone replies!
I tried to use -mbig-endian gcc option on AArch64 (Raspberry Pi 3 Model B with little-endian byte order configuration) with the intention of reading from and writing to the memory in big-endian byte order. I got the following error and the compilation terminated.
/usr/include/gnu/stubs.h:11:11: fatal error: gnu/stubs-lp64_be.h: No such file or directory `#include <gnu/stubs-lp64_be.h>`
I actually went to that folder and couldn't find that file. Am I missing something?
The gcc online documentation says -mbig-endian option generates big-endian code. What exactly does that mean?
You are not missing anything, but it seems than even gcc toolchains provided by ARM don't allow using -mbig-endian with aarch64-linux-gnu-gcc, nor -mlittle-endian with aarch64_be-linux-gnu-gcc: In both cases, a .h file related to the 'alien' endianess will be missing.
That probably means that you should just use aarch64_be-linux-gnu-gcc for cross-compiling big-endian aarch64 Linux executables. But you will still not be able to run those executables on a little-endian aarch64 Linux system.
I need to use the TCC compiler to link object files generated by GCC. However, GCC in MinGW outputs object files in COFF format, and TCC only supports the ELF format. How can I make GCC generate ELF object files?
$ cat test.c
int main(void)
{
return 0;
}
$ gcc -c test.c
$ file test.o
test.o: MS Windows COFF Intel 80386 object file
$ tcc -c test.c
$ file test.o
test.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
However, GCC in MinGW outputs object files in COFF format
GCC can be configured to generate various outputs (including ELF) regardless of which host it runs on.
That is, a GCC running on Linux could be configured to generate COFF, and a GCC running on Windows could be configured to generate ELF32 or ELF64, for various processors (e.g. x86, or SPARC, or MIPS).
A compiler that runs on one kind of host, but generates code for a different kind, is called a cross-compiler.
TCC only supports the ELF format
This is not a meaningful statement: it could mean that you want GCC to generate ELF32 for i686 Linux, or ELF64 for SPARC Solaris, or any number of other processor/os/bit combinations.
You should figure out what target processor and operating system you want to run your final executable on, and then build (non-trivial) or download appropriate cross-compiler from Windows to that target.
file test.o
test.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
Ok, you want Windows to Linux/i386/ELF32 cross-compiler.
strip might help. strip accepts various object file formats for input and output type (the bfdname). strip --info for the supported formats.
strip -o outputname -O elf32-i386 objfile Doing so on a 64 bit executable, converted to 32bit control headers will lead to nothing but crash, so pick your output form carefully. Make sure you aren't changing assumed bitwidths / endians along with headers.
Not running MinGW, so, not tested, may not work for your needs, or worse, may jump and catch fire.
You want your compiler (MinGW) to generate binaries that are not of the type usable for your host system (Windows). This is called cross-compiling, and it is a somewhat involved subject -- because to create complete executables you will also need the various libraries: standard libraries, target OS libraries, third-party libraries... so it is not merely the subject of "how do I get the compiler to create ELF", but also "how do I get the whole supporting cast of ELF libs so I can link against them?".
OSDev has quite extensive documentation on the subject of setting up a cross-compiler; however, since you did not tell us what exactly your problem is, it is difficult to advise you further.
If what you want is generating Linux binaries, my advise would be to not bother with cross-compilation (which is a tricky subject -- and much better supported the other way around, i.e. targeting Windows from Linux), but rather install a Linux distribution in parallel to your Windows, and work natively with that.
I have generated an assembly file try.s with aarch64 instruction set.I want to compile this on an ARM8 (aarch64 processor) running ubuntu.
my native compiler is gcc(4.8) and i use the following command to compile
gcc -o try.o try.s
I am getting the following errors
Error : ARM register expected -- mov x10,x0
It seems like the aarch4 registers are not being recognized although i thought gcc 4.8 supported aarch64. Can someone tell me what am i missing or is there any special option i should include.Or suggest me a native compiler(not cross-compilers) for doing aarch64.I would also like to use gdb to debug this natively.
gcc is for a 32b targets. 'Xn' registers are not defined for a aarch32 instruction set. That's what compiler tells you.
Right toolchain is aarch64-elf-gcc.
PS: that's a good idea to make asm file extention .S (capital s)