unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#48913: i686-linux-gnu cross-compiler cannot find libgcc_s [core-updates]
@ 2021-06-08  8:41 Maxime Devos
  2021-06-08 14:23 ` Maxime Devos
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Maxime Devos @ 2021-06-08  8:41 UTC (permalink / raw)
  To: 48913

[-- Attachment #1: Type: text/plain, Size: 7704 bytes --]

I tested this on 683eb7c5b118440001b89944563603a39fc2ac05.
The problem does not occur on master.

How to reproduce:

  # --target=aarch64-linux-gnu also fails, but that's another issue
  ./pre-inst-env guix build --target=i686-linux-gnu hello --keep-failed

Error message (during 'configure' phase):

checking for i686-linux-gnu-gcc... i686-linux-gnu-gcc
checking whether the C compiler works... no
configure: error: in `/tmp/guix-build-hello-2.10.drv-0/hello-2.10':
configure: error: C compiler cannot create executables
See `config.log' for more details
error: in phase 'configure': uncaught exception:
%exception #<&invoke-error program: "/gnu/store/kpkbyk7jlw6n5z3jkbia9mcr0bhflzbf-bash-minimal-5.1.8/bin/bash" arguments: ("./configure" "CC_FOR_BUILD=gcc"
"CONFIG_SHELL=/gnu/store/kpkbyk7jlw6n5z3jkbia9mcr0bhflzbf-bash-minimal-5.1.8/bin/bash" "SHELL=/gnu/store/kpkbyk7jlw6n5z3jkbia9mcr0bhflzbf-bash-minimal-5.1.8/bin/bash" "
--prefix=/gnu/store/wmkbla5nncld4rdyqkwc9lw9kzypvdab-hello-2.10" "--enable-fast-install" "--build=x86_64-unknown-linux-gnu" "--host=i686-linux-gnu") exit-status: 77 term-signal: #f stop-signal: #f> 
phase `configure' failed after 3.1 seconds

From 'config.log':

  configure:4014: checking whether the C compiler works
configure:4036: i686-linux-gnu-gcc    conftest.c  >&5
i686-linux-gnu-ld: cannot find -lgcc_s
i686-linux-gnu-ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
configure:4040: $? = 1
configure:4078: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU Hello"
| #define PACKAGE_TARNAME "hello"
| #define PACKAGE_VERSION "2.10"
| #define PACKAGE_STRING "GNU Hello 2.10"
| #define PACKAGE_BUGREPORT "bug-hello@gnu.org"
| #define PACKAGE_URL "http://www.gnu.org/software/hello/"
| #define PACKAGE "hello"
| #define VERSION "2.10"
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:4083: error: in `/tmp/guix-build-hello-2.10.drv-0/hello-2.10':
configure:4085: error: C compiler cannot create executables

Issue:

Somehow, the C cross-compiler does not find "libgcc_s".
Look at CROSS_LIBRARY_PATH and LIBRARY_PATH in /tmp/[...]/environment-variables,
we have (line breaks added):

export CROSS_LIBRARY_PATH=
  /gnu/store/glc86jl13yj70k2h4mm3pqwff351mxav-glibc-cross-i686-linux-gnu-2.33/lib:
  /gnu/store/wk761j8qqq7yf949wyxjgcbqxcx574nf-glibc-cross-i686-linux-gnu-2.33-static/lib
export LIBRARY_PATH=
  /gnu/store/w6ydl1fjxhkc69cs90vmg3g48vwcy59w-binutils-cross-i686-linux-gnu-2.36.1/lib:
  /gnu/store/lv8zj6sl3fc6db2ljq10haba3sfhvq6b-bzip2-1.0.8/lib:
  /gnu/store/hhg5z17xyfj7zvg864br41nsj6g918ym-xz-5.2.5/lib:
  /gnu/store/pnj9pzyk4ajs9a245krx5l4sp4p8xwyk-file-5.39/lib:
  /gnu/store/0amam2n0vjb62zh6jssb9pjnwcf302hw-gawk-5.1.0/lib:
  /gnu/store/3fasjd1jnnm6vhyff5wb3kkahnxzbl49-binutils-2.36.1/lib:
  /gnu/store/mf4kmmhka2dagnna6a0h4fciz5ijaxsn-glibc-2.33/lib:
  /gnu/store/dj2p4mwp6gwbx8fpd6gqsj2c307mm6sp-glibc-2.33-static/lib:
  /gnu/store/dxplmvm0xf8z968m3lbwzizc95h9nldc-glibc-utf8-locales-2.33/lib

When I run "ls -l" on each of these directories, I notice none of these
have a "libgcc_s.so" file. So it's not very surprising GNU ld (via GCC) cannot find it.
Now, where could we find "libgcc_s.so"?

I found it in
  /gnu/store/6b4sgmqd3nrajbx47zryi0n4s08sfrb6-gcc-cross-i686-linux-gnu-8.5.0/i686-linux-gnu/lib/

By explicitely passing "-L/gnu/store/6b4sgmqd3nrajbx47zryi0n4s08sfrb6-gcc-cross-i686-linux-gnu-8.5.0/i686-linux-gnu/lib/",
the C program compiles. So, I guess we need to add that directory to CROSS_LIBRARY_PATH. Or ...

* Shouldn't this be present in the spec file?

Let's test.

/gnu/store/6b4sgmqd3nrajbx47zryi0n4s08sfrb6-gcc-cross-i686-linux-gnu-8.5.0/bin/i686-linux-gnu-gcc -dumpspecs

Output (only a part shown)
*lib:
%{!mandroid|tno-android-ld:-L/gnu/store/glc86jl13yj70k2h4mm3pqwff351mxav-glibc-cross-i686-linux-gnu-2.33/lib %{!static:-rpath=/gnu/store/glc86jl13yj70k2h4mm3pqwff351mxav-glibc-cross-i686-linux-gnu-
2.33/lib %{!static-libgcc:-rpath=/gnu/store/53i7hxqwf3apvz77bsapjvrigjiimg29-gcc-cross-i686-linux-gnu-8.5.0-lib/i686-linux-gnu/lib -lgcc_s}} %{pthread:-lpthread} %{shared:-lc}    %{!shared:%{profile:-
lc_p}%{!profile:-lc}};:%{shared:-lc}    %{!shared:%{profile:-lc_p}%{!profile:-lc}} %{!static: -ldl}}

Curiously, /gnu/store/53i7hxqwf3apvz77bsapjvrigjiimg29-gcc-cross-i686-linux-gnu-8.5.0-lib/i686-linux-gnu/lib
is actualy present! Let's compile in verbose mode.

$ i686-linux-gnu-gcc -v conftest.o

Output:
> Using built-in specs.
> COLLECT_GCC=i686-linux-gnu-gcc
> COLLECT_LTO_WRAPPER=/gnu/store/[...]-gcc-cross-i686-linux-gnu-8.5.0/libexec/gcc/i686-linux-gnu/8.5.0/lto-wrapper
> Target: i686-linux-gnu
> Configured with: 
> Thread model: posix
> gcc version 8.5.0 (GCC) 
> COMPILER_PATH=/gnu/store/[...]-gcc-cross-i686-linux-gnu-8.5.0/libexec/gcc/i686-linux-gnu/8.5.0/:/gnu/store/[...]-gcc-cross-i686-linux-gnu-8.5.0/libexec/gcc/i686-linux-gnu/8.5.0/:/gnu/store/[...]-
gcc-cross-i686-linux-gnu-8.5.0/libexec/gcc/i686-linux-gnu/:/gnu/store/[...]-gcc-cross-i686-linux-gnu-8.5.0-lib/lib/gcc/i686-linux-gnu/8.5.0/:/gnu/store/[...]-gcc-cross-i686-linux-gnu-8.5.0-
lib/lib/gcc/i686-linux-gnu/
> CROSS_LIBRARY_PATH=/gnu/store/[...]-glibc-cross-i686-linux-gnu-2.33/lib/:/gnu/store/[...]-glibc-cross-i686-linux-gnu-2.33-static/lib/:/gnu/store/[...]-gcc-cross-i686-linux-gnu-8.5.0-
lib/lib/gcc/i686-linux-gnu/8.5.0/:/gnu/store/[...]-glibc-cross-i686-linux-gnu-2.33/lib
> COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=pentiumpro'
> /gnu/store/[...]-gcc-cross-i686-linux-gnu-8.5.0/libexec/gcc/i686-linux-gnu/8.5.0/collect2 -plugin /gnu/store/[...]-gcc-cross-i686-linux-gnu-8.5.0/libexec/gcc/i686-linux-gnu/8.5.0/liblto_plugin.so
-plugin-opt=/gnu/store/[...]-gcc-cross-i686-linux-gnu-8.5.0/libexec/gcc/i686-linux-gnu/8.5.0/lto-wrapper -plugin-opt=-fresolution=/tmp/guix-build-hello-2.10.drv-0/ccxP5sep.res -plugin-opt=-pass-
through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --eh-
frame-hdr -m elf_i386 -dynamic-linker /gnu/store/[...]-glibc-cross-i686-linux-gnu-2.33/lib/ld-linux.so.2 /gnu/store/[...]-glibc-cross-i686-linux-gnu-2.33/lib/crt1.o /gnu/store/[...]-glibc-cross-i686-
linux-gnu-2.33/lib/crti.o /gnu/store/[...]-gcc-cross-i686-linux-gnu-8.5.0-lib/lib/gcc/i686-linux-gnu/8.5.0/crtbegin.o -L/gnu/store/[...]-glibc-cross-i686-linux-gnu-2.33/lib -L/gnu/store/[...]-glibc-
cross-i686-linux-gnu-2.33-static/lib -L/gnu/store/[...]-gcc-cross-i686-linux-gnu-8.5.0-lib/lib/gcc/i686-linux-gnu/8.5.0 -L/gnu/store/[...]-glibc-cross-i686-linux-gnu-2.33/lib conftest.o -lgcc --as-
needed -lgcc_s --no-as-needed -L/gnu/store/[...]-glibc-cross-i686-linux-gnu-2.33/lib -rpath=/gnu/store/[...]-glibc-cross-i686-linux-gnu-2.33/lib -rpath=/gnu/store/[...]-gcc-cross-i686-linux-gnu-8.5.0-
lib/i686-linux-gnu/lib -lgcc_s -lc -lgcc --as-needed -lgcc_s --no-as-needed /gnu/store/[...]-gcc-cross-i686-linux-gnu-8.5.0-lib/lib/gcc/i686-linux-gnu/8.5.0/crtend.o /gnu/store/[...]-glibc-cross-i686-
linux-gnu-2.33/lib/crtn.o
> i686-linux-gnu-ld: cannot find -lgcc_s
> i686-linux-gnu-ld: cannot find -lgcc_s

What went wrong here? I took a look at the folowing entry in CROSS_LIBRARY_PATH:
/gnu/store/[...]-gcc-cross-i686-linux-gnu-8.5.0-lib/lib/gcc/i686-linux-gnu/8.5.0/.
In this directory, there is a "libgcc.a", but not a "libgcc_s.so"! So, we have
a static libgcc library, but not a dynamic libgcc_s library!

To be investigated ... or worked around by tweaking CROSS_LIBRARY_PATH ...

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-07-04 20:34 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08  8:41 bug#48913: i686-linux-gnu cross-compiler cannot find libgcc_s [core-updates] Maxime Devos
2021-06-08 14:23 ` Maxime Devos
2021-06-08 15:25 ` Maxime Devos
2021-06-18  9:33   ` Ludovic Courtès
2021-06-19  7:37     ` Maxime Devos
2021-06-19 10:05     ` bug#49113: aarch64-linux-gnu cross-compiler fails to build [core-updates] Maxime Devos
2021-06-20 12:17       ` Maxime Devos
2021-07-03 16:12       ` Ludovic Courtès
2021-07-04 20:33         ` Ludovic Courtès
2021-06-19 11:05     ` bug#48913: i686-linux-gnu cross-compiler cannot find libgcc_s [core-updates] Maxime Devos
2021-06-19 11:59     ` Maxime Devos
2021-06-18  9:32 ` Ludovic Courtès
2021-07-03 13:40   ` Maxime Devos

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).