public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug build/31412] New: GCC 6 failed to build i386 glibc on Fedora 39
@ 2024-02-24 18:41 hjl.tools at gmail dot com
  2024-02-24 23:27 ` [Bug build/31412] " fw at deneb dot enyo.de
  2024-02-25 12:17 ` hjl.tools at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: hjl.tools at gmail dot com @ 2024-02-24 18:41 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31412

            Bug ID: 31412
           Summary: GCC 6 failed to build i386 glibc on Fedora 39
           Product: glibc
           Version: 2.40
            Status: NEW
          Severity: normal
          Priority: P2
         Component: build
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
                CC: carlos at redhat dot com, fweimer at redhat dot com
  Target Milestone: ---
            Target: i386

[hjl@gnu-cfl-3 tmp]$ cat x.c
#include <iostream>

int
main ()
{
  std::cout << "Hello, world!";
  return 0;
}
[hjl@gnu-cfl-3 tmp]$ /usr/gcc-6.4.1-x32/bin/g++ -m32 x.c -static
/usr/local/bin/ld: /lib/../lib/libc.a(offtime.o): in function `__offtime':
(.text+0x3c): undefined reference to `__divmoddi4'
/usr/local/bin/ld: (.text+0xa2): undefined reference to `__divmoddi4'
/usr/local/bin/ld: (.text+0x22e): undefined reference to `__divmoddi4'
collect2: error: ld returned 1 exit status
[hjl@gnu-cfl-3 tmp]$ /usr/gcc-7.4.1-x32/bin/g++ -m32 x.c -static
[hjl@gnu-cfl-3 tmp]$ 

Since /lib/libc.a on Fedora 39 was compiled with GCC 13, it uses __divmoddi4
which was added to GCC 7 and GCC 6 won't be able to create static binary on
Fedora 39.  Why is static linking required here?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/31412] GCC 6 failed to build i386 glibc on Fedora 39
  2024-02-24 18:41 [Bug build/31412] New: GCC 6 failed to build i386 glibc on Fedora 39 hjl.tools at gmail dot com
@ 2024-02-24 23:27 ` fw at deneb dot enyo.de
  2024-02-25 12:17 ` hjl.tools at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: fw at deneb dot enyo.de @ 2024-02-24 23:27 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31412

Florian Weimer <fw at deneb dot enyo.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fw at deneb dot enyo.de,
                   |                            |jakub at redhat dot com
              Flags|                            |security-

--- Comment #1 from Florian Weimer <fw at deneb dot enyo.de> ---
H.J., what do you mean by static linking in this context?

I think your GCC 6 environment is misconfigured. Shouldn't it use system
libgcc.a?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/31412] GCC 6 failed to build i386 glibc on Fedora 39
  2024-02-24 18:41 [Bug build/31412] New: GCC 6 failed to build i386 glibc on Fedora 39 hjl.tools at gmail dot com
  2024-02-24 23:27 ` [Bug build/31412] " fw at deneb dot enyo.de
@ 2024-02-25 12:17 ` hjl.tools at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: hjl.tools at gmail dot com @ 2024-02-25 12:17 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31412

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Florian Weimer from comment #1)
> H.J., what do you mean by static linking in this context?

$ gcc -static ....

> I think your GCC 6 environment is misconfigured. Shouldn't it use system
> libgcc.a?

[hjl@gnu-cfl-1 tmp]$ gcc -print-file-name=libgcc.a
/usr/lib/gcc/x86_64-redhat-linux/13/libgcc.a
[hjl@gnu-cfl-1 tmp]$ /usr/gcc-14.0.1-x32/bin/gcc -print-file-name=libgcc.a 
/usr/gcc-14.0.1-x32/lib/gcc/x86_64-pc-linux-gnu/14.0.1/libgcc.a
[hjl@gnu-cfl-1 tmp]$ /usr/gcc-6.3.1-x32/bin/gcc -print-file-name=libgcc.a 
/usr/gcc-6.3.1-x32/lib/gcc/x86_64-pc-linux-gnu/6.3.1/libgcc.a
[hjl@gnu-cfl-1 tmp]$ 

All versions of GCC should use /usr/lib/gcc/x86_64-redhat-linux/13/libgcc.a?
It won't work for GCC 14 or higher.  The configure.ac change:

ommit d337ceb76d898935560dc264cf2ad36b17017db7
Author: Florian Weimer <fweimer@redhat.com>
Date:   Mon Oct 26 09:41:10 2015 +0100

    Use the CXX compiler only if it can create dynamic and static programs

            * configure.ac (CXX): Clear the variable if the C++ toolchain does
            not support static linking.
            * configure: Regenerate.

diff --git a/configure.ac b/configure.ac
index e502aa5db2..3c7f6c0096 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,9 +57,26 @@ AC_PROG_CXX
 # It's useless to us if it can't link programs (e.g. missing -lstdc++).
 AC_CACHE_CHECK([whether $CXX can link programs], libc_cv_cxx_link_ok, [dnl
 AC_LANG_PUSH([C++])
+# Default, dynamic case.
 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
          [libc_cv_cxx_link_ok=yes],
          [libc_cv_cxx_link_ok=no])
+# Static case.
+old_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS -static"
+AC_LINK_IFELSE([AC_LANG_SOURCE([
+#include <iostream>
+
+int
+main()
+{
+  std::cout << "Hello, world!";
+  return 0;
+}
+])],
+         [],
+         [libc_cv_cxx_link_ok=no])
+LDFLAGS="$old_LDFLAGS"
 AC_LANG_POP([C++])])
 AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])

makes it impossible to properly build i386 glibc with GCC 6 on Fedora 39.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2024-02-25 12:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-24 18:41 [Bug build/31412] New: GCC 6 failed to build i386 glibc on Fedora 39 hjl.tools at gmail dot com
2024-02-24 23:27 ` [Bug build/31412] " fw at deneb dot enyo.de
2024-02-25 12:17 ` hjl.tools at gmail dot com

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).