ABI incompatibility when building util-linux
Hi,
When compiling the util-linux-2.12q sources, I get the following linker ABI incompatibility error:
[alex@euskadi util-linux-2.12q]$ make
make[1]: Entering directory `/home/alex/Projects/util-linux-2.12q/po'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/alex/Projects/util-linux-2.12q/po'
make[1]: Entering directory `/home/alex/Projects/util-linux-2.12q/lib'
mips64-linux-gnu-gcc -c -O2 -pipe -march=rm9000 -mabi=32 -static -mips4 -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -Wl,-t -Wl,-EB -O2 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" err.c -o err.o
mips64-linux-gnu-gcc: -t: linker input file unused because linking not done
mips64-linux-gnu-gcc: -EB: linker input file unused because linking not done
mips64-linux-gnu-gcc -c -O2 -pipe -march=rm9000 -mabi=32 -static -mips4 -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -Wl,-t -Wl,-EB -O2 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" my_reboot.c -o my_reboot.o
mips64-linux-gnu-gcc: -t: linker input file unused because linking not done
mips64-linux-gnu-gcc: -EB: linker input file unused because linking not done
mips64-linux-gnu-gcc -c -O2 -pipe -march=rm9000 -mabi=32 -static -mips4 -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -Wl,-t -Wl,-EB -O2 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" setproctitle.c -o setproctitle.o
mips64-linux-gnu-gcc: -t: linker input file unused because linking not done
mips64-linux-gnu-gcc: -EB: linker input file unused because linking not done
mips64-linux-gnu-gcc -c -O2 -pipe -march=rm9000 -mabi=32 -static -mips4 -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -Wl,-t -Wl,-EB -O2 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" env.c -o env.o
mips64-linux-gnu-gcc: -t: linker input file unused because linking not done
mips64-linux-gnu-gcc: -EB: linker input file unused because linking not done
mips64-linux-gnu-gcc -c -O2 -pipe -march=rm9000 -mabi=32 -static -mips4 -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -Wl,-t -Wl,-EB -O2 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" carefulputc.c -o carefulputc.o
mips64-linux-gnu-gcc: -t: linker input file unused because linking not done
mips64-linux-gnu-gcc: -EB: linker input file unused because linking not done
mips64-linux-gnu-gcc -c -O2 -pipe -march=rm9000 -mabi=32 -static -mips4 -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -Wl,-t -Wl,-EB -O2 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" xstrncpy.c -o xstrncpy.o
mips64-linux-gnu-gcc: -t: linker input file unused because linking not done
mips64-linux-gnu-gcc: -EB: linker input file unused because linking not done
mips64-linux-gnu-gcc -c -O2 -pipe -march=rm9000 -mabi=32 -static -mips4 -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -Wl,-t -Wl,-EB -O2 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" md5.c -o md5.o
mips64-linux-gnu-gcc: -t: linker input file unused because linking not done
mips64-linux-gnu-gcc: -EB: linker input file unused because linking not done make[1]: Leaving directory `/home/alex/Projects/util-linux-2.12q/lib'
make[1]: Entering directory `/home/alex/Projects/util-linux-2.12q/getopt'
mips64-linux-gnu-gcc -c -O2 -pipe -march=rm9000 -mabi=32 -static -mips4 -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -Wl,-t -Wl,-EB -O2 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" getopt.c -o getopt.o
mips64-linux-gnu-gcc: -t: linker input file unused because linking not done
mips64-linux-gnu-gcc: -EB: linker input file unused because linking not done mips64-linux-gnu-ld -V -static -t -EB getopt.o -o getopt
GNU ld version 2.13-mips64linux-031001 20020920
Supported emulations:
elf32btsmipn32
elf32ltsmipn32
elf32btsmip
elf32ltsmip
elf64btsmip
elf64ltsmip
mips64-linux-gnu-ld: mode elf32btsmipn32
getopt.o
mips64-linux-gnu-ld: getopt.o: ABI is incompatible with that of the selected emulation File in wrong format: failed to merge target specific data of file getopt.o
mips64-linux-gnu-ld: warning: cannot find entry symbol __start; defaulting to 00000000100000a0 getopt.o: In function `our_malloc':getopt.o(.text+0x18): undefined reference to `malloc'
make[1]: *** [getopt] Segmentation fault
make[1]: *** Deleting file `getopt'
make[1]: Leaving directory `/home/alex/Projects/util-linux-2.12q/getopt'
make: *** [all] Error 1
If I try with -melf32btsmip, I get the following error:
[alex@euskadi util-linux-2.12q]$ make
make[1]: Entering directory `/home/alex/Projects/util-linux-2.12q/po'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/alex/Projects/util-linux-2.12q/po'
make[1]: Entering directory `/home/alex/Projects/util-linux-2.12q/lib'
mips64-linux-gnu-gcc -c -O2 -pipe -march=rm9000 -mabi=32 -static -mips4 -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -Wl,-t -Wl,-EB -Wl,-melf32btsmip -O2 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" err.c -o err.o
mips64-linux-gnu-gcc: -t: linker input file unused because linking not done
mips64-linux-gnu-gcc: -EB: linker input file unused because linking not done
mips64-linux-gnu-gcc: -melf32btsmip: linker input file unused because linking not done
mips64-linux-gnu-gcc -c -O2 -pipe -march=rm9000 -mabi=32 -static -mips4 -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -Wl,-t -Wl,-EB -Wl,-melf32btsmip -O2 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" my_reboot.c -o my_reboot.o
mips64-linux-gnu-gcc: -t: linker input file unused because linking not done
mips64-linux-gnu-gcc: -EB: linker input file unused because linking not done
mips64-linux-gnu-gcc: -melf32btsmip: linker input file unused because linking not done
mips64-linux-gnu-gcc -c -O2 -pipe -march=rm9000 -mabi=32 -static -mips4 -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -Wl,-t -Wl,-EB -Wl,-melf32btsmip -O2 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" setproctitle.c -o setproctitle.o
mips64-linux-gnu-gcc: -t: linker input file unused because linking not done
mips64-linux-gnu-gcc: -EB: linker input file unused because linking not done
mips64-linux-gnu-gcc: -melf32btsmip: linker input file unused because linking not done
mips64-linux-gnu-gcc -c -O2 -pipe -march=rm9000 -mabi=32 -static -mips4 -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -Wl,-t -Wl,-EB -Wl,-melf32btsmip -O2 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" env.c -o env.o
mips64-linux-gnu-gcc: -t: linker input file unused because linking not done
mips64-linux-gnu-gcc: -EB: linker input file unused because linking not done
mips64-linux-gnu-gcc: -melf32btsmip: linker input file unused because linking not done
mips64-linux-gnu-gcc -c -O2 -pipe -march=rm9000 -mabi=32 -static -mips4 -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -Wl,-t -Wl,-EB -Wl,-melf32btsmip -O2 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" carefulputc.c -o carefulputc.o
mips64-linux-gnu-gcc: -t: linker input file unused because linking not done
mips64-linux-gnu-gcc: -EB: linker input file unused because linking not done
mips64-linux-gnu-gcc: -melf32btsmip: linker input file unused because linking not done
mips64-linux-gnu-gcc -c -O2 -pipe -march=rm9000 -mabi=32 -static -mips4 -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -Wl,-t -Wl,-EB -Wl,-melf32btsmip -O2 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" xstrncpy.c -o xstrncpy.o
mips64-linux-gnu-gcc: -t: linker input file unused because linking not done
mips64-linux-gnu-gcc: -EB: linker input file unused because linking not done
mips64-linux-gnu-gcc: -melf32btsmip: linker input file unused because linking not done
mips64-linux-gnu-gcc -c -O2 -pipe -march=rm9000 -mabi=32 -static -mips4 -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -Wl,-t -Wl,-EB -Wl,-melf32btsmip -O2 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" md5.c -o md5.o
mips64-linux-gnu-gcc: -t: linker input file unused because linking not done
mips64-linux-gnu-gcc: -EB: linker input file unused because linking not done
mips64-linux-gnu-gcc: -melf32btsmip: linker input file unused because linking not done make[1]: Leaving directory `/home/alex/Projects/util-linux-2.12q/lib'
make[1]: Entering directory `/home/alex/Projects/util-linux-2.12q/getopt'
mips64-linux-gnu-gcc -c -O2 -pipe -march=rm9000 -mabi=32 -static -mips4 -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -Wl,-t -Wl,-EB -Wl,-melf32btsmip -O2 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" getopt.c -o getopt.o
mips64-linux-gnu-gcc: -t: linker input file unused because linking not done
mips64-linux-gnu-gcc: -EB: linker input file unused because linking not done
mips64-linux-gnu-gcc: -melf32btsmip: linker input file unused because linking not done mips64-linux-gnu-ld -V -static -t -EB -melf32btsmip getopt.o -o getopt
GNU ld version 2.13-mips64linux-031001 20020920
Supported emulations:
elf32btsmipn32
elf32ltsmipn32
elf32btsmip
elf32ltsmip
elf64btsmip
elf64ltsmip
mips64-linux-gnu-ld: mode elf32btsmip
getopt.o
mips64-linux-gnu-ld: warning: cannot find entry symbol __start; defaulting to 00000000004000b0 getopt.o: In function `our_malloc':getopt.o(.text+0x18): undefined reference to `malloc'getopt.o(.text+0x4c): undefined reference to `dcgettext'getopt.o(.text+0x5c): undefined reference to `stderr'getopt.o(.text+0x78): undefined reference to `fprintf'getopt.o(.text+0x8c): undefined reference to `exit'
getopt.o: In function `our_realloc':getopt.o(.text+0xbc): undefined reference to `realloc'getopt.o(.text+0xfc): undefined reference to `dcgettext'getopt.o(.text+0x10c): undefined reference to `stderr'getopt.o(.text+0x128): undefined reference to `fprintf'getopt.o(.text+0x13c): undefined reference to `exit'
getopt.o: In function `normalize':getopt.o(.text+0x1b0): undefined reference to `strlen'getopt.o(.text+0x1f0): undefined reference to `strcpy'getopt.o(.text+0x23c): undefined reference to `strlen'getopt.o(.text+0x304): undefined reference to __ctype_b_loc' getopt.o(.text+0x3b0): undefined reference to free'
getopt.o: In function `generate_output':getopt.o(.text+0x3d8): undefined reference to `opterr'getopt.o(.text+0x430): undefined reference to `optind'getopt.o(.text+0x43c): undefined reference to `opterr'getopt.o(.text+0x46c): undefined reference to getopt_long_only' getopt.o(.text+0x4cc): undefined reference to printf'getopt.o(.text+0x4e4): undefined reference to `strchr'getopt.o(.text+0x504): undefined reference to `optarg'getopt.o(.text+0x540): undefined reference to `printf'getopt.o(.text+0x554): undefined refermake[1]: *** Deleting file `getopt' make[1]: *** [getopt] Interrupt
make: *** [all] Interrupt
This package compiles completely if I use an -mabi=n32 flag for gcc, but the executable won't run on our -mabi=32 compiled kernel.
Can anybody help with the following:
1) What's the difference between -mabi=32 and -mabi=n32?
2) What should I do to compile util-linux with -mabi=32?
Thanks,
Alex
Quoted 4 lines · Alex Gonzalez
Hi,
When compiling the util-linux-2.12q sources, I get the following linker ABI incompatibility error:
[snip]
Quoted 3 lines
mips64-linux-gnu-gcc -c -O2 -pipe -march=rm9000 -mabi=32 -static -mips4 -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -Wl,-t -Wl,-EB -O2 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\"
getopt.c-o getopt.o
mips64-linux-gnu-gcc: -t: linker input file unused because linking not done
mips64-linux-gnu-gcc: -EB: linker input file unused because linking not done
The compiler is broken and fails to recognize -Wl,-t -Wl,-EB as linker options.
Quoted 2 lines
mips64-linux-gnu-ld -V -static -t -EB getopt.o -o getopt GNU ld version 2.13-mips64linux-031001 20020920
This toolchain is very old, and unlikely to work correctly for mips64.
[snip]
Quoted 3 lines
Can anybody help with the following:
1) What's the difference between -mabi=32 and -mabi=n32?
n32 means 64bit wide registers and 32bit address space. It runs only on a 64bit kernel.
Quoted 1 line
2) What should I do to compile util-linux with -mabi=32?
Use either a mips-linux targeted toolchain (instead of mips64-linux), or upgrade to gcc 3.3/binutils 2.15, which fixed some known bugs in that area.
Thiemo
Quoted 4 lines · Thiemo Seufer
n32 means 64bit wide registers and 32bit address space. It runs only on a 64bit kernel.
A bit off topic, but it reminded me nonetheless. Anyone trying to build a new version of procpcs (>3.4.2) under mips64 will likely need this patch.
Unsure what the reasoning behind this bit was in procps, but it assumes that n32 is usable on a mips64 system (atleast, my understanding of the conditional is that), and thus defines KLONG to long long on mips64, which breaks 'ps' on these systems (you get a nice sigsev).
Thought it'd be useful to pass along.
--Kumba
Signature · 1 line
"Such is oft the course of deeds that move the wheels of the world: small hands do them because they must, while the eyes of the great are elsewhere." --Elrond
proc/procps.h +1 -1
@@ -31,7 +31,7 @@// // Unknown: PA-RISC and zSeries // -#if defined(k64test) || defined(_ABIN32) +#if defined(k64test)#define KLONG long long // not typedef; want "unsigned KLONG" to work#define KLF "L"#define STRTOUKL strtoull
Quoted 5 lines · Thiemo Seufer
Quoted 4 lines · Alex Gonzalez
Hi,
When compiling the util-linux-2.12q sources, I get the following linker ABI incompatibility error:
Quoted 7 lines
[snip]
Quoted 3 lines
mips64-linux-gnu-gcc -c -O2 -pipe -march=rm9000 -mabi=32 -static -mips4 -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -Wl,-t -Wl,-EB -O2 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\"
getopt.c-o getopt.o
mips64-linux-gnu-gcc: -t: linker input file unused because linking not done
mips64-linux-gnu-gcc: -EB: linker input file unused because linking not doneThe compiler is broken and fails to recognize -Wl,-t -Wl,-EB as linker options.
Actually, the compiler's fine. It's always issued this warning for linker options, whether or not they are input files.
Quoted 4 lines
Quoted 2 lines
mips64-linux-gnu-ld -V -static -t -EB getopt.o -o getopt GNU ld version 2.13-mips64linux-031001 20020920
This toolchain is very old, and unlikely to work correctly for mips64.
It should be binary compatible with current toolchains, more or less; I've used it before.
The problem is in Alex's environment. Alex, whatever you're setting to force use of the cross compilers, it's wrong. You should _never_ link directly with ld. That's the error here.
Signature · 2 lines
Daniel Jacobowitz CodeSourcery, LLC