Issues building grub for powerpc64le, could not force big-endian

  • Open
  • quality assurance status badge
Details
3 participants
  • Danny Milosavljevic
  • Christopher Baines
  • Maxime Devos
Owner
unassigned
Submitted by
Christopher Baines
Severity
normal
C
C
Christopher Baines wrote on 15 Mar 2022 22:11
(address . bug-guix@gnu.org)
87pmmm6hfj.fsf@cbaines.net
grub can't be built for powerpc64le, I believe the same failure occurs
with native builds or cross compilation from x86_64. I think this might
have always been the case.

This is the error from the build log:

checking for options to get big-endian compilation... no
configure: error: could not force big-endian

Looking in the config.log file, it tries a bunch of options with
different errors, but this one stands out:

cc1: error: '-m32' not supported in this configuration

I know very little about gcc, but I think this might relate to the
multilib thing, which I'm guessing is disabled for the gcc in use here.

Any ideas about this issue?

Thanks,

Chris
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmIxA0BfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9XfwURAAh15HZWfCOSjG5Ru4+HXxk2E/4c/wcNGb
0K4BMTWKBMMhCv1UgSBS2x+ry+xRIHG6l9sYYZkdx0KiqPtiHvD1kGUn32PNvpEb
HNioVVPk3LsJ/n1aiY5BbeqG7DIUui3JVfD23aDZHWRgGWAFqm3ori61My0LQTyN
qulu6pUAHrNroGjPNOGbSivY35WfmunoTkCefN3YI6Zr7Uh9jFGuH8yyGxoqZsoP
zx5mUDhhTCPJ2ZfBac4JbdIuf9+5PW2DVcSjzk7cU6SDmqP8jh8FQog+8YiDe9mC
nfz36chZ8p0oxq6DHvdrF9dkoVcSEp04qRFV+dP4K2XSXEkHZHKGL9l/3PJyu6Uv
9R1gjO4lBJd8WCAfiGVi7xYV5mP2KtyUkulyIuuTrjX2Z6DUfHIStUnavV1VFUp7
IBoU+pU6ma9pLwvZUkfMAr+iKzk3MBOcs8P+uB1+p6gkn4SgGd/eOXRp/+cdJ0OB
xroR+Qlll5w0oBd3KpiJiKQmGVTV4LKw5cPwrnDJplgUm6PRlPF3IWsllEmjZcM3
4u6XP/EjJyFJPiOdJmujzyVbLq+fsOjggKl/hsn5Yt7QLUTXyFXXtUUW2oI4pK6s
TlHmRsYKqmGyLKRsQ9QCJ4ehMfSykGiBEKqQyNMlri1tuTcGeZo0p39Cw+9fsZ7M
+iZ5K0sjjSk=
=+vN6
-----END PGP SIGNATURE-----

D
D
Danny Milosavljevic wrote on 30 Mar 2022 19:41
(name . Christopher Baines)(address . mail@cbaines.net)(address . 54407@debbugs.gnu.org)
20220330194113.6a8c5a3b@scratchpost.org
Hi,

On Tue, 15 Mar 2022 21:11:37 +0000
Christopher Baines <mail@cbaines.net> wrote:

Toggle quote (17 lines)
> grub can't be built for powerpc64le, I believe the same failure occurs
> with native builds or cross compilation from x86_64. I think this might
> have always been the case.
>
> This is the error from the build log:
>
> checking for options to get big-endian compilation... no
> configure: error: could not force big-endian
>
> Looking in the config.log file, it tries a bunch of options with
> different errors, but this one stands out:
>
> cc1: error: '-m32' not supported in this configuration
>
> I know very little about gcc, but I think this might relate to the
> multilib thing, which I'm guessing is disabled for the gcc in use here.

-m32 is to compile 32 bit object files with a compiler that usually compiles 64 bit objects.
If you want to use any libraries, then those have to be available as a 32 bit version somewhere.

The Guix gcc package recipe disables this (and I think that was the right call to make).

There are not a lot of use cases for using "-m32" anyway since on x86_64 the generated instructions are already just as compact as the x86 (32 bit) ones if the immediate operand is not too big.

Not sure what the configure script is doing there.

But there are a few programs that need 32 bit compilers--BIOS-based bootloaders are one of them (since they start up in ancient 8088 real mode).
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAmJEljkACgkQ5xo1VCww
uqXaSggAir3FjzAZBIxDyHu+X5kIK49I9Myas6cpEW4Eui/7xY9GYQ9YtXv2aENi
PekTlNpVSb/4uMCQXci4nK3s3SL7Dm/02XjTLTjODSBoltx1UJVWO8He60+/YnP0
2sCBX68bIGz4C2SQnKzocPtG27qajMg6Ayp3XGt7FfJRp518/xAuyZ7EP6z9xlFJ
WPmr088nNqJYsI15Lgoz5PuQHZ2wzhGOWEJb+6x5Vpmcr9odb0GSWkGVOPhLCZQZ
XWY6d83nfNkDF9bTH6wKYXWEKeWwKh8/tDt4dZ4dAQv4Q2QmOGHKkt2ZTuSrvc0o
epEieOtYYvWdap54bxSZJGp9vXqk7Q==
=Nwpi
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 30 Mar 2022 19:46
7b43424a2ca7b3048fc2652cbee4f71390ce9151.camel@telenet.be
Christopher Baines schreef op di 15-03-2022 om 21:11 [+0000]:
Toggle quote (22 lines)
> grub can't be built for powerpc64le, I believe the same failure
> occurs
> with native builds or cross compilation from x86_64. I think this
> might
> have always been the case.
>
> This is the error from the build log:
>
>   checking for options to get big-endian compilation... no
>   configure: error: could not force big-endian
>
> Looking in the config.log file, it tries a bunch of options with
> different errors, but this one stands out:
>
>   cc1: error: '-m32' not supported in this configuration
>
> I know very little about gcc, but I think this might relate to the
> multilib thing, which I'm guessing is disabled for the gcc in use
> here.
>
> Any ideas about this issue?

Maybe you could add a gcc compiling for 32-bit ppc (maybe without a
glibc since this is grub) and patch the configuration script to use the
32-bit ppc gcc instead of using the 64-bit ppc+-m32?

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYkSXjxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7qwsAP94BmoO/V+Wrqmp48M9iBrJ8/ii
JQgZyfu8KDVpx14W+gEA2qwEddrRcCEtWuK6624UMduWkzpDuzoV1L+ZUS8higQ=
=umyR
-----END PGP SIGNATURE-----


C
C
Christopher Baines wrote on 4 Apr 2022 21:37
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 54407@debbugs.gnu.org)
87h777q5s8.fsf@cbaines.net
Maxime Devos <maximedevos@telenet.be> writes:

Toggle quote (27 lines)
> Christopher Baines schreef op di 15-03-2022 om 21:11 [+0000]:
>> grub can't be built for powerpc64le, I believe the same failure
>> occurs
>> with native builds or cross compilation from x86_64. I think this
>> might
>> have always been the case.
>>
>> This is the error from the build log:
>>
>>   checking for options to get big-endian compilation... no
>>   configure: error: could not force big-endian
>>
>> Looking in the config.log file, it tries a bunch of options with
>> different errors, but this one stands out:
>>
>>   cc1: error: '-m32' not supported in this configuration
>>
>> I know very little about gcc, but I think this might relate to the
>> multilib thing, which I'm guessing is disabled for the gcc in use
>> here.
>>
>> Any ideas about this issue?
>
> Maybe you could add a gcc compiling for 32-bit ppc (maybe without a
> glibc since this is grub) and patch the configuration script to use the
> 32-bit ppc gcc instead of using the 64-bit ppc+-m32?

I've had a go at this, using something like what I've included below,
but I haven't stumbled upon the right options yet, or a way to work out
why gcc still thinks "-m32 not supported".

(define multilib-gcc
(package
(inherit gcc)
(name "foo-gcc")
(arguments
(substitute-keyword-arguments (package-arguments gcc)
((#:phases phases)
`(modify-phases ,phases
(add-after 'unpack 'fix-genmultilib
(lambda _
;; patch-shebang doesn't work here because there are actually
;; several scripts inside this script, each with a #!/bin/sh
;; that needs patching.
(substitute* "gcc/genmultilib"
(("#!/bin/sh") (string-append "#!" (which "sh"))))))))
((#:configure-flags flags)
`(append (list
"--with-endian=little,big"
"--enable-multilib"
"--with-multilib-list=mx32,m64,m32"
)
(delete "--disable-multilib" ,flags)))))))
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmJMATdfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9XfvdQ//c9sQYvGWLHqVGFIhsRzdakO1rhQUr/4j
HuB+Zo+da1klZYUpHphqqelRaRKhr1aDBX+pbTPv3bBhrPf/YiJ6Q5J4E68iCST5
rU/KpQywkU+LoNgh28GhijDzg8dXWeFUbNNOL945w6hpinWIbURYFwWdVU2B8iHl
tXpBKVaJCLgc9nIjTeC62HVNgGXsncQS/r4yvqb5h+Lq+Cz367kG4WaxqKDBcYCm
YOwqWV1T8m6tNHzZTRac1Noh8ExaEbZTYrgT7iHRlQBjbvVB10jrWd1ZuQ7EXNJb
nwhR8Btdya0rMSAVo8rGDuNKLHmOAVh2x1yHgi/BYciuGzxem8zFAIdWmuu7bne8
5Tvnti6xP1iJCrbBkqY+0iYzs7HGUFejhJIxU3hg9tV9TzIao4jThE+yyHRht0BB
/5knr56AYcmQn/SUptemnZrA+cIFoRuDIqyerkT1s4FiHbd0YRDgNFEks0gjw5tt
Jn9EVD1VgzWqcDDJ/C8fwSe6Dct3G5KX8rCjgHWQBchvL5mqe/HkCANiHc1QGz60
7EzLspsThuG6HkE6PP3V3JUqcz1CdA+iYrNyxKW434pN4HNSG7eIEk6Md0Gcm8LX
ifIZON9/V0Tkn5eapMQdimeli3lmTkh2NktSU+zxReX7LZ3t5U3IQOomTJ8khNLJ
XlphoSMeRoY=
=aklY
-----END PGP SIGNATURE-----

M
M
Maxime Devos wrote on 18 Aug 2022 10:11
(name . Christopher Baines)(address . mail@cbaines.net)(address . 54407@debbugs.gnu.org)
06836df5-5df9-ea3a-eae1-dd38088867f3@telenet.be
On 04-04-2022 21:37, Christopher Baines wrote:
Toggle quote (6 lines)
>> Maybe you could add a gcc compiling for 32-bit ppc (maybe without a
>> glibc since this is grub) and patch the configuration script to use the
>> 32-bit ppc gcc instead of using the 64-bit ppc+-m32?
> I've had a go at this, using something like what I've included below,
> but I haven't stumbled upon the right options yet, or a way to work out
> why gcc still thinks "-m32 not supported". [...]
I was thinking of skipping the multilib and maybe skipping support for
multiple endians, something like:
Toggle quote (14 lines)
> (use-modules (guix utils) (guix packages) (guix gexp))
> (define (ppc-32bit-gcc)
>   (if (%current-target-system)
>       (error "not supported -- TODO make a cross-compiler to 32-bit
> ppc here with cross-gcc")
>       (package
>         (inherit (@ (gnu packages gcc) gcc))
>         (arguments
>           (substitute-keyword-arguments
>             (package-arguments (@ (gnu packages gcc) gcc))
>             ((#:system _) "ppc-linux")
>             ((#:configure-flags flags)
>              (pk 'f #~(append (list "--with-endian=big") #$flags))))))))
> (ppc-32bit-gcc)
(currently compiling, let's see if if it works ...)
Greetings,
Maxime.
Attachment: file
Attachment: OpenPGP_signature
M
M
Maxime Devos wrote on 18 Aug 2022 10:14
(name . Christopher Baines)(address . mail@cbaines.net)(address . 54407@debbugs.gnu.org)
6f27a1de-1308-dc63-09a1-665fb5ec4735@telenet.be
On 18-08-2022 10:11, Maxime Devos wrote:
Toggle quote (28 lines)
>
>
> On 04-04-2022 21:37, Christopher Baines wrote:
>>> Maybe you could add a gcc compiling for 32-bit ppc (maybe without a
>>> glibc since this is grub) and patch the configuration script to use the
>>> 32-bit ppc gcc instead of using the 64-bit ppc+-m32?
>> I've had a go at this, using something like what I've included below,
>> but I haven't stumbled upon the right options yet, or a way to work out
>> why gcc still thinks "-m32 not supported". [...]
>
> I was thinking of skipping the multilib and maybe skipping support for
> multiple endians, something like:
>
>> (use-modules (guix utils) (guix packages) (guix gexp))
>> (define (ppc-32bit-gcc)
>>   (if (%current-target-system)
>>       (error "not supported -- TODO make a cross-compiler to 32-bit
>> ppc here with cross-gcc")
>>       (package
>>         (inherit (@ (gnu packages gcc) gcc))
>>         (arguments
>>           (substitute-keyword-arguments
>>             (package-arguments (@ (gnu packages gcc) gcc))
>>             ((#:system _) "ppc-linux")
>>             ((#:configure-flags flags)
>>              (pk 'f #~(append (list "--with-endian=big") #$flags))))))))
>> (ppc-32bit-gcc)
> (currently compiling, let's see if if it works ...)
The #:system doesn't work, trying
Toggle quote (14 lines)
> (use-modules (guix utils) (guix packages) (guix gexp))
> (define (ppc-32bit-gcc)
>   (if (%current-target-system)
>       (error "not supported -- TODO make a cross-compiler to 32-bit
> ppc here with cross-gcc")
>       (package
>         (inherit (@ (gnu packages gcc) gcc))
>         (arguments
>           (substitute-keyword-arguments
>             (cons* #:system "powerpc-linux" (package-arguments (@ (gnu
> packages gcc) gcc)))
>             ((#:configure-flags flags)
>              (pk 'f #~(append (list "--with-endian=big") #$flags))))))))
> (ppc-32bit-gcc)
instead.
Attachment: file
Attachment: OpenPGP_signature
M
M
Maxime Devos wrote on 18 Aug 2022 10:33
(name . Christopher Baines)(address . mail@cbaines.net)(address . 54407@debbugs.gnu.org)
d2071a2d-6cc4-3670-b17e-f052f8c5cab7@telenet.be
Doesn't work for me:
Toggle quote (4 lines)
> while setting up the build environment: a `powerpc-linux' is required
> to build
> `/gnu/store/gmq50nq4xf4wa0msqms140s3jkk5v47q-guile-bootstrap-2.0.drv',
> but I am a `x86_64-linux'
even though QEMU has been set up, though that's more a local
configuration problem than a problem in gcc package.
Greetings,
Maxime.
Attachment: OpenPGP_signature
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 54407@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 54407
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch