ld unrecognized emulation mode /tmp/ccK2pwtc.o on ubuntu - gcc

I'm using the following machine:
Linux version 5.4.0-42-generic (buildd#lgw01-amd64-038) (gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)) #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020
The program
int main() {
return 0;
}
when compiled
gcc -Wl,-m main.c
returns
/usr/bin/ld: unrecognised emulation mode: /tmp/ccJI1LRo.o
Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu elf_l1om elf_k1om i386pep i386pe
collect2: error: ld returned 1 exit status
I am not sure where to start as to knowing why.
Also, gcc and ld versions:
> gcc --version
gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> ld --version
GNU ld (GNU Binutils for Ubuntu) 2.34
Copyright (C) 2020 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

The -Wl,-m argument specifies that gcc should pass the -m argument to the linker.
When the linker is called, the -m option is used, and it's followed by a intermediate object file that's been compiled (/tmp/ccJI1LRo.o), as opposed to a supported emulation, which leads to the error message you've encountered.
The linker's -m option requires an argument for specifying an emulation. The output in your question lists supported emulations.

Related

nano.specs not found in arm-none-eabi-gcc

I am using Ubuntu 20.04.3 LTS and I need to use arm-none-eabi-gcc version 4.8.2 ( I know it is old, but i have to use this version)
So I successfully install this library with below files:
binutils-arm-none-eabi_2.24-2ubuntu2+4_amd64.deb
gcc-arm-none-eabi_4.8.2-14ubuntu1+6_amd64.deb
libcloog-isl4_0.18.2-1_amd64.deb
libisl10_0.12.2-1_amd64.deb
libnewlib-arm-none-eabi_2.1.0-3_all.deb
libnewlib-dev_2.1.0-3_all.deb
multiarch-support_2.27-3ubuntu1_amd64.deb
libmpfr4_3.1.6-1_amd64.deb
Than I checked my gcc-arm-none-eabi version like this :
arm-none-eabi-gcc --version
arm-none-eabi-gcc (4.8.2-14ubuntu1+6) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Than I am trying to compile the source code for stm32f4 with makefile.
If I use the -specs=nano.specs in makefile I get below error:
arm-none-eabi-gcc: error: nano.specs: No such file or directory
But if I dont use -specs=nano.specs command in makefile I can compile successfuly, but I need to use -specs=nano.specs command how can I solve this problem ?

Building GLib on POWER9

I tried building GLib 2.67.0 on a POWER9 machine. meson build failed with the following error message:
subprojects/libffi/src/meson.build:71:2: ERROR: Problem encountered: Unsupported pair: system "linux", cpu family "ppc64"
If it helps, here are some details:
$ uname -a
Linux tellico-master0 4.14.0-115.10.1.el7a.ppc64le #1 SMP Wed Jun 26 09:32:17 UTC 2019 ppc64le ppc64le ppc64le GNU/Linux
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.6 (Maipo)
$ gcc --version
gcc (Spack GCC) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Are there any known workarounds for this?

GCC / clang default error flag

I am usually coding on OSX and compile all my program with : -Wall -Wextra -Werror
I download on another laptop nixos and when i want to compile the same project, i have -Wunused-result error.
I can disable it with : -Wno-unused-result but why this flag error appear on this os ?
I found nowhere a default flag configuration file or environment variable.
For curious the program i'm trying to compile is : libft.
If you're compiling on OSX and haven't installed gcc, Apple has provided clang pretending to be gcc. The pretense isn't very good, since there are a lot of differences in warnings (and exit-codes). You can see what you are running using
gcc --version
and (for instance ‐ I have installed gcc using MacPorts under /opt):
$ path -lL gcc
-rwxr-xr-x 3 root admin 1131416 Jun 10 2016 /opt/local/bin/gcc
-rwxr-xr-x 1 root wheel 18176 Jul 8 22:52 /usr/bin/gcc
$ /opt/local/bin/gcc --version
gcc (MacPorts gcc5 5.4.0_0) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ /usr/bin/gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
As you can see, /usr/bin/gcc is really clang, and (barring Apple improving things further), will produce similar messages.

problem compiling vp8 for debugging on Cygwin

I have the following versions of Cygwin, yasm, gcc, and gdb:
CYGWIN_NT-5.1 Thorondor 1.7.7(0.230/5/3) 2010-08-31 09:58 i686 Cygwin
yasm 1.1.0.2352
gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
GNU gdb 6.8.0.20080328-cvs (cygwin-special)
I've compiled vp8 using the following commands:
$ ./configure --enable-debug
$ make
However when I try to debug using GDB, I get the following error:
$ gdb simple_decoder.exe
GNU gdb 6.8.0.20080328-cvs (cygwin-special)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/
gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show
copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
Dwarf Error: bad offset (0x4c4000) in compilation unit header (offset
0x0 + 6) [in module /cygdrive/
c/work/vp8/csim/build/simple_decoder.exe]
(gdb) q
Can someone help me out with this?
Thanks,
Arjun
Your compiler and binutils are too old. This was solved circa 2000, the fault comes from the linker (see http://gcc.gnu.org/ml/gcc-bugs/2000-06/msg00768.html)

gcc generates 32bit code on sparc

I have a Solaris sparc machine and when i build my programs, it generates 32bit code which should be 64bit. How to check the cause?
$uname -a
SunOS sol 5.10 Generic_118833-33 sun4u sparc SUNW,Sun-Fire-V240
$/usr/sfw/bin/gcc --version
gcc (GCC) 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$/usr/sfw/bin/gcc test.c
$file a.out
a.out: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, not stripped, no debugging information available
$
OSNews - SPARC Optimizations With GCC
The creation of 64-bit code requires using the -m64 flag (-m32 for 32-bit code is implied by default).
(Yes, this is different than GCC for x86_64, which defaults to -m64 unless overridden with -m32.)
You should be able to force a 64-bit build using the -m64 option.
If that fails, you can download and install a prebuilt GCC package with 64-bit SPARC support for Solaris 10 from SunFreeware.com (download, gunzip, install with pkgadd -d gcc-...-sparc-local) which will run from /usr/local/bin/gcc.

Resources