unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#46253: powerpc64le: gcc-final: "configure: error: cannot compute sizeof (long long)"
@ 2021-02-02  9:07 Chris Marusich
  2021-02-04  8:26 ` Chris Marusich
  2021-02-07  0:53 ` Chris Marusich
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Marusich @ 2021-02-02  9:07 UTC (permalink / raw)
  To: 46253; +Cc: Léo Le Bouter

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

Hi,

On powerpc64le-linux, using commit
a1cdd9de3cffb5677fc1570d9a7992bf0cbd2f34 (which is on the wip-ppc64le
branch), gcc-final fails to build with the following error:

--8<---------------cut here---------------start------------->8---
checking size of long long... configure: error: in `/tmp/guix-build-gcc-7.5.0.drv-0/build/gcc':
configure: error: cannot compute sizeof (long long)
See `config.log' for more details.
--8<---------------cut here---------------end--------------->8---

The file /tmp/guix-build-gcc-7.5.0.drv-0/build/gcc/config.log contains a
little more info.  It says:

--8<---------------cut here---------------start------------->8---
configure:6087: checking size of long long
configure:6092: g++ -std=gnu++98 -o conftest -g    -Wl,-rpath=/gnu/store/mzdwhzgk63ys7ypadfxgk1v2nh83gvwi-glibc-2.31/lib -Wl,-dynamic-linker -Wl,/gnu/store/mzdwhzgk63ys7ypadfxgk1v2nh83gvwi-glibc-2.31/lib/ld64.so.2 -L/gnu/store/4ya8f2bqqvaa0lw06zqskby6x8djcac7-libstdc++-7.5.0/lib -L/gnu/store/1lwsfgsv6ka9dljwczvjrp4rg7s150v5-zlib-1.2.11/lib -Wl,-rpath=/gnu/store/1lwsfgsv6ka9dljwczvjrp4rg7s150v5-zlib-1.2.11/lib conftest.cpp  >&5
powerpc64le-guix-linux-gnu-ld: cannot find -lstdc++
collect2: error: ld returned 1 exit status
configure:6092: $? = 1
configure: program exited with status 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define __EXTENSIONS__ 1
| #define _ALL_SOURCE 1
| #define _GNU_SOURCE 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define _TANDEM_SOURCE 1
| #define SIZEOF_VOID_P 0
| #define SIZEOF_SHORT 0
| #define SIZEOF_INT 0
| #define SIZEOF_LONG 0
| #define HAVE_LONG_LONG 1
| /* end confdefs.h.  */
| #include <stdio.h>
| #ifdef HAVE_SYS_TYPES_H
| # include <sys/types.h>
| #endif
| #ifdef HAVE_SYS_STAT_H
| # include <sys/stat.h>
| #endif
| #ifdef STDC_HEADERS
| # include <stdlib.h>
| # include <stddef.h>
| #else
| # ifdef HAVE_STDLIB_H
| #  include <stdlib.h>
| # endif
| #endif
| #ifdef HAVE_STRING_H
| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
| #  include <memory.h>
| # endif
| # include <string.h>
| #endif
| #ifdef HAVE_STRINGS_H
| # include <strings.h>
| #endif
| #ifdef HAVE_INTTYPES_H
| # include <inttypes.h>
| #endif
| #ifdef HAVE_STDINT_H
| # include <stdint.h>
| #endif
| #ifdef HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| static long int longval () { return (long int) (sizeof (long long)); }
| static unsigned long int ulongval () { return (long int) (sizeof (long long)); }
| #include <stdio.h>
| #include <stdlib.h>
| int
| main ()
| {
| 
|   FILE *f = fopen ("conftest.val", "w");
|   if (! f)
|     return 1;
|   if (((long int) (sizeof (long long))) < 0)
|     {
|       long int i = longval ();
|       if (i != ((long int) (sizeof (long long))))
| 	return 1;
|       fprintf (f, "%ld", i);
|     }
|   else
|     {
|       unsigned long int i = ulongval ();
|       if (i != ((long int) (sizeof (long long))))
| 	return 1;
|       fprintf (f, "%lu", i);
|     }
|   /* Do not output a trailing newline, as this causes \r\n confusion
|      on some platforms.  */
|   return ferror (f) || fclose (f) != 0;
| 
|   ;
|   return 0;
| }
configure:6096: error: in `/tmp/guix-build-gcc-7.5.0.drv-0/build/gcc':
configure:6100: error: cannot compute sizeof (long long)
--8<---------------cut here---------------end--------------->8---

Any ideas?  Perhaps we need to configure gcc in a special way for
powerpc64le-linux?

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* bug#46253: powerpc64le: gcc-final: "configure: error: cannot compute sizeof (long long)"
  2021-02-02  9:07 bug#46253: powerpc64le: gcc-final: "configure: error: cannot compute sizeof (long long)" Chris Marusich
@ 2021-02-04  8:26 ` Chris Marusich
  2021-02-07  0:53 ` Chris Marusich
  1 sibling, 0 replies; 3+ messages in thread
From: Chris Marusich @ 2021-02-04  8:26 UTC (permalink / raw)
  To: 46253-close; +Cc: Léo Le Bouter

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

Hi,

This is fixed in the following commit:

https://git.savannah.gnu.org/cgit/guix.git/commit/?h=wip-ppc64le&id=ffcc950261c829e76f2faf6c8ea03d3fc56a20e1

The problem was in the config.log, but I didn't see it at first:

"powerpc64le-guix-linux-gnu-ld: cannot find -lstdc++"

Léo mentioned that it was probably a linking problem, and when I checked
his commits in his own Git repository, I found this, which solved the
problem:

https://gitlab.com/lle-bout/guix/-/commit/070e06e8be6090a7682288c24b5686f1b578c001

However, that commit would have changed the way we link gcc-final with
libstdc++ on all architectures.  I have made a similar change that
accomplishes the same thing, but only for powerpc64le-linux (or other
Guix system types beginning with "powerpc64").  On existing Guix system
types, we will continue to link the same as before.

Using commit ffcc950261c829e76f2faf6c8ea03d3fc56a20e1, I was successful
in building gcc-final. I'm closing this bug report.

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* bug#46253: powerpc64le: gcc-final: "configure: error: cannot compute sizeof (long long)"
  2021-02-02  9:07 bug#46253: powerpc64le: gcc-final: "configure: error: cannot compute sizeof (long long)" Chris Marusich
  2021-02-04  8:26 ` Chris Marusich
@ 2021-02-07  0:53 ` Chris Marusich
  1 sibling, 0 replies; 3+ messages in thread
From: Chris Marusich @ 2021-02-07  0:53 UTC (permalink / raw)
  To: 46253; +Cc: Léo Le Bouter

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

Chris Marusich <cmmarusich@gmail.com> writes:

> configure:6100: error: cannot compute sizeof (long long)

It was mentioned on IRC that a better way to fix this would be to
configure libstdc++ to install to /lib instead of /lib64, since in Guix
we install libraries to /lib by convention, even on 64-bit systems.

See: https://logs.guix.gnu.org/guix/2021-02-06.log

I looked into this a bit more after that.  It turns out that we do
something like that already, in the original gcc package definition, for
existing architectures.  However, Léo pointed out that on the rs6000
architecture (i.e., powerpc), the gcc/config/rs6000 directory's build
logic hard-codes some /lib64 references.  I have added a phase that
replaces those hard-coded references. I should also mention that I did
try to use the --libdir configure flag to tell libstdc++ to install to
/lib64, but it didn't work; libstdc++ just ignored the flag and still
installed its libraries in /lib64.  Replacing the hard-coded references
fixed it, though.

In addition, I discovered that the libstdc++ package does not actually
re-use the package arguments from gcc.  Therefore, it was necessary to
add a similar phase in the make-libstdc++ procedure.

Although it is possible that, to resolve this specific bug (gcc-final:
"configure: error: cannot compute sizeof (long long)"), only the
make-libstdc++ change is necessary, it seems prudent to go ahead and
also make the change described above for gcc, to avoid future problems.
I have pushed both changes to wip-ppc64le in commit
db761a593992aea441055bda260461f4302a4667 on the wip-ppc64le branch.


-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

end of thread, other threads:[~2021-02-07  0:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02  9:07 bug#46253: powerpc64le: gcc-final: "configure: error: cannot compute sizeof (long long)" Chris Marusich
2021-02-04  8:26 ` Chris Marusich
2021-02-07  0:53 ` Chris Marusich

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