mailing list of musl libc
 help / color / mirror / code / Atom feed
* musl + PowerPC + GCC 5
@ 2016-12-14 10:02 A. Wilcox
  2016-12-14 10:53 ` Szabolcs Nagy
  0 siblings, 1 reply; 5+ messages in thread
From: A. Wilcox @ 2016-12-14 10:02 UTC (permalink / raw)
  To: musl

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hello,

I am currently attempting to build GCC 5 for PowerPC, linked to musl.
 Note that this is not a cross-build, or a 'host is not target' build,
or anything resembling that.  I have the cross-compiler from PowerPC
glibc to PowerPC musl already completed.  I have built all the other
necessary utilities using it that I need (bash, coreutils, etc).  I
can chroot to the target and run programs linked to musl.

However, I cannot for the life of me compile GCC with --host musl
- --target musl.  I've done this successfully with x86_32, x86_64,
ARMv7, and MIPS, so I know that it is indeed possible to do this with
other architectures.  But it doesn't seem possible on PowerPC.

Compiler output is:

powerpc-foxkit-linux-musl-gcc   -g -O2 -mlong-double-64 -ggdb
- -fno-omit-frame-pointer -pipe -O2  -g -O2 -mlong-double-64 -ggdb
- -fno-omit-frame-pointer -pipe -DIN_GCC    -W -Wall -Wno-narrowing
- -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
- -Wold-style-definition  -isystem ./include   -fPIC -mlong-double-128
- -mno-minimal-toc -g -DIN_LIBGCC2 -fbuilding-libgcc
- -fno-stack-protector   -fPIC -mlong-double-128 -mno-minimal-toc -I.
- -I. -I../.././gcc
- -I/usr/src/sys-devel/gcc-5.4.0-r2/work/gcc-5.4.0/libgcc
- -I/usr/src/sys-devel/gcc-5.4.0-r2/work/gcc-5.4.0/libgcc/.
- -I/usr/src/sys-devel/gcc-5.4.0-r2/work/gcc-5.4.0/libgcc/../gcc
- -I/usr/src/sys-devel/gcc-5.4.0-r2/work/gcc-5.4.0/libgcc/../include
- -I/usr/src/sys-devel/gcc-5.4.0-r2/work/gcc-5.4.0/libgcc/../libdecnumber/
dpd
- -I/usr/src/sys-devel/gcc-5.4.0-r2/work/gcc-5.4.0/libgcc/../libdecnumber
- -DHAVE_CC_TLS
 -o _sd_to_tf.o -MT _sd_to_tf.o -MD -MP -MF _sd_to_tf.dep
- -DFINE_GRAINED_LIBRARIES -DL_sd_to_tf -DWIDTH=32 -c
/usr/src/sys-devel/gcc-5.4.0-r2/work/gcc-5.4.0/libgcc/dfp-bit.c
In file included from
/usr/src/sys-devel/gcc-5.4.0-r2/work/gcc-5.4.0/libgcc/dfp-bit.c:40:0:
/usr/src/sys-devel/gcc-5.4.0-r2/work/gcc-5.4.0/libgcc/dfp-bit.h:288:2:
error: #error "unknown long double size, cannot define BFP_FMT"
 #error "unknown long double size, cannot define BFP_FMT"
  ^
make[2]: *** [Makefile:684: _sd_to_tf.o] Error 1


If you will notice, there's... some wacky stuff going on.  Note how
- -mlong-double-64 is shown twice and -mlong-double-128 is shown once.
I have specified dozens of different ./configure lines in a vain
attempt to force it to use the long-double-64 that musl requires.

GCC 6 is not an option for me due to multiple C++ breakages.

As this requires almost two hours to get to the failure point
(building on native hardware, a dual 970fx @ 1.8GHz), it has begun to
annoy me trying dozens of different options and waiting days to find
it still failing.

If anyone can point me to somewhere that specifies the *actual*
parameters I need to make GCC 5 build correctly when --host and
- --target are powerpc-linux-musl, it would be deeply appreciated.

For interest, this is the current ./configure line I am passing
(though as I said before, I've tried dozens):

/usr/src/sys-devel/gcc-5.4.0-r2/work/gcc-5.4.0/configure
- --host=powerpc-foxkit-linux-musl --target=powerpc-foxkit-linux-musl
- --build=powerpc-unknown-linux-gnu --prefix=/usr
- --bindir=/usr/powerpc-foxkit-linux-musl/gcc-bin/5.4.0
- --includedir=/usr/lib/gcc/powerpc-foxkit-linux-musl/5.4.0/include
- --datadir=/usr/share/gcc-data/powerpc-foxkit-linux-musl/5.4.0
- --mandir=/usr/share/gcc-data/powerpc-foxkit-linux-musl/5.4.0/man
- --infodir=/usr/share/gcc-data/powerpc-foxkit-linux-musl/5.4.0/info
- --with-gxx-include-dir=/usr/lib/gcc/powerpc-foxkit-linux-musl/5.4.0/incl
ude/g++-v5
- --enable-languages=c,c++,fortran --enable-secureplt --disable-werror
- --with-system-zlib --enable-nls --without-included-gettext
- --enable-checking=release --with-bugurl=http://bts.adelielinux.org/
- --with-pkgversion="Adélie 5.4.0-r2" --enable-libstdcxx-time
- --enable-shared --enable-threads=posix --disable-multilib
- --disable-altivec --disable-fixed-point --with-long-double-64
- --enable-targets=all --disable-libgcj --enable-libgomp
- --disable-libmudflap --enable-libssp --disable-libcilkrts
- --disable-libmpx --disable-vtable-verify --disable-libvtv --enable-lto
- --without-isl --disable-libsanitizer

And this is the CFLAGS I am using:

CFLAGS="-O2 -mlong-double-64 -ggdb -fno-omit-frame-pointer -pipe"

though I have tried with and without -pipe, -fno-omit-frame-pointer,
and -mlong-double-64, and each combination thereof.


Thank you for any pointers in advance...

Best,
- --arw

- -- 
A. Wilcox (awilfox)
Project Lead, Adélie Linux
http://adelielinux.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJYURi6AAoJEMspy1GSK50UcboP+QFLSd8R3XMp1pLEHglVL03D
2vRIWLw2806/IXntLum2WKO4oR2tokT0GMHUXUsgX4UEBVkagU/EJnDIMygDKSjS
QCCX1DWzJ5SvGn8onGP3ly6tO4L/4AwcOpoSjs0B5kdKa7MzlDxN5NMERxEL36hB
FrXVvR7UVqVMqc479KCWsIBdqef4EIu0RbWY5/LWoCuJq126OcxRHvzdixyYttdZ
OVNVXYEZS1FZJc6xk0Ji+fSwaNjr8VkvyPXc+CSlQhcTvHYKUofKBdaUJ9d4oKjH
JRQHuLmgAhJNWT/7FijCyDSPc05U913d0uBiNZzqNYNmpbsXFEE5qOO4cMgHCEeE
WrebJkSLXxRmPjzv++YKgGzw9T3hwVZnP4DvStVXQ8z4t9QO/fRUfK59UDQzrm7c
yGSEf+gopqReJQ3uAGIlVEmR/xiG74b/8ZPb9cuMBMAox8SUjzbLTLvobi/dUmqP
kIaEoz0uS7HYJ7iB0Fx8FZrFgWCjHuVChyKMW8mKJcTV0C4ml/Q3DdonRsvdLcMg
XE2jO03JvgAkCpARfW5WEJvgoRcAFJIkUBobkAbPjq2GpVHJm4pJ8FrrM4UQHLIj
wXqAvQ2IIomAReVtJrehGFfAWiZfL6dO7jMsR7vXS2g8lc5UZgW7erYxKHgYUpJD
3I91a/5WPlRBqsouwpBe
=ZkA/
-----END PGP SIGNATURE-----


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

* Re: musl + PowerPC + GCC 5
  2016-12-14 10:02 musl + PowerPC + GCC 5 A. Wilcox
@ 2016-12-14 10:53 ` Szabolcs Nagy
  2016-12-15  4:11   ` A. Wilcox
  0 siblings, 1 reply; 5+ messages in thread
From: Szabolcs Nagy @ 2016-12-14 10:53 UTC (permalink / raw)
  To: musl

* A. Wilcox <awilfox@adelielinux.org> [2016-12-14 04:02:39 -0600]:
> Compiler output is:
> 
> powerpc-foxkit-linux-musl-gcc   -g -O2 -mlong-double-64 -ggdb
> - -fno-omit-frame-pointer -pipe -O2  -g -O2 -mlong-double-64 -ggdb
> - -fno-omit-frame-pointer -pipe -DIN_GCC    -W -Wall -Wno-narrowing
> - -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
> - -Wold-style-definition  -isystem ./include   -fPIC -mlong-double-128
> - -mno-minimal-toc -g -DIN_LIBGCC2 -fbuilding-libgcc
> - -fno-stack-protector   -fPIC -mlong-double-128 -mno-minimal-toc -I.
> - -I. -I../.././gcc
> - -I/usr/src/sys-devel/gcc-5.4.0-r2/work/gcc-5.4.0/libgcc
> - -I/usr/src/sys-devel/gcc-5.4.0-r2/work/gcc-5.4.0/libgcc/.
> - -I/usr/src/sys-devel/gcc-5.4.0-r2/work/gcc-5.4.0/libgcc/../gcc
> - -I/usr/src/sys-devel/gcc-5.4.0-r2/work/gcc-5.4.0/libgcc/../include
> - -I/usr/src/sys-devel/gcc-5.4.0-r2/work/gcc-5.4.0/libgcc/../libdecnumber/
> dpd
> - -I/usr/src/sys-devel/gcc-5.4.0-r2/work/gcc-5.4.0/libgcc/../libdecnumber
> - -DHAVE_CC_TLS
>  -o _sd_to_tf.o -MT _sd_to_tf.o -MD -MP -MF _sd_to_tf.dep
> - -DFINE_GRAINED_LIBRARIES -DL_sd_to_tf -DWIDTH=32 -c
> /usr/src/sys-devel/gcc-5.4.0-r2/work/gcc-5.4.0/libgcc/dfp-bit.c
> In file included from
> /usr/src/sys-devel/gcc-5.4.0-r2/work/gcc-5.4.0/libgcc/dfp-bit.c:40:0:
> /usr/src/sys-devel/gcc-5.4.0-r2/work/gcc-5.4.0/libgcc/dfp-bit.h:288:2:
> error: #error "unknown long double size, cannot define BFP_FMT"
>  #error "unknown long double size, cannot define BFP_FMT"
>   ^
> make[2]: *** [Makefile:684: _sd_to_tf.o] Error 1
> 

this happens when 128bit float to decimal float conversion code
is compiled: then libc sprintf with BFP_FMT is used to do the
conversion and for that libc LDBL_MANT_DIG is checked and musl
has no support for this.

i think the simplest fix is to config with --disable-decimal-float

the second simplest fix is to patch the ifdef logic (e.g. define
BFP_FMT "%Le") but then the conversion code would be broken at
runtime: the code is compiled with -mlong-double-128 and musl
expects 64 bit long double. (most likely the bootstrap process
does not depend on this to work so this is a workaround hack
that only breaks 128bit float to decimal conversion.)

the correct way on musl is to build libgcc without -mlong-double-128
and without all the 128bit (TF mode) float stuff, but this may need
some configure and build system changes as i don't immediately see
an option to turn tf mode things off.


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

* Re: musl + PowerPC + GCC 5
  2016-12-14 10:53 ` Szabolcs Nagy
@ 2016-12-15  4:11   ` A. Wilcox
  2016-12-15 10:59     ` Szabolcs Nagy
  0 siblings, 1 reply; 5+ messages in thread
From: A. Wilcox @ 2016-12-15  4:11 UTC (permalink / raw)
  To: musl

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

On 14/12/16 04:53, Szabolcs Nagy wrote:
> * A. Wilcox <awilfox@adelielinux.org> [2016-12-14 04:02:39 -0600]:
> i think the simplest fix is to config with --disable-decimal-float

/usr/src/sys-devel/gcc-5.4.0-r2/work/gcc-5.4.0/configure
--host=powerpc-foxkit-linux-musl --target=powerpc-foxkit-linux-musl
--prefix=/usr --bindir=/usr/powerpc-foxkit-linux-musl/gcc-bin/5.4.0
--includedir=/usr/lib/gcc/powerpc-foxkit-linux-musl/5.4.0/include
--datadir=/usr/share/gcc-data/powerpc-foxkit-linux-musl/5.4.0
--mandir=/usr/share/gcc-data/powerpc-foxkit-linux-musl/5.4.0/man
--infodir=/usr/share/gcc-data/powerpc-foxkit-linux-musl/5.4.0/info
--with-gxx-include-dir=/usr/lib/gcc/powerpc-foxkit-linux-musl/5.4.0/include/g++-v5
--enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls
--without-included-gettext --enable-checking=release
--enable-libstdcxx-time --enable-shared --enable-threads=posix
--disable-multilib --disable-altivec --disable-fixed-point
--disable-decimal-float --disable-libgcj --enable-libgomp
--disable-libmudflap --enable-libssp --disable-libcilkrts
--disable-libmpx --disable-vtable-verify --disable-libvtv --enable-lto
--without-isl --disable-libsanitizer

Note "--disable-decimal-float".  I receive the same error.

> the second simplest fix is to patch the ifdef logic (e.g. define
> BFP_FMT "%Le") but then the conversion code would be broken at
> runtime: the code is compiled with -mlong-double-128 and musl
> expects 64 bit long double. (most likely the bootstrap process
> does not depend on this to work so this is a workaround hack
> that only breaks 128bit float to decimal conversion.)

That sounds unacceptable for production code.  I do not understand the
inner workings of floating point though.

> the correct way on musl is to build libgcc without -mlong-double-128
> and without all the 128bit (TF mode) float stuff, but this may need
> some configure and build system changes as i don't immediately see
> an option to turn tf mode things off.

I cannot seem to disable -mlong-double-128 no matter what I patch. :(

Regards,
--arw


-- 
A. Wilcox (awilfox)
Open-source programmer (C, C++, Python)
https://code.foxkit.us/u/awilfox/


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: musl + PowerPC + GCC 5
  2016-12-15  4:11   ` A. Wilcox
@ 2016-12-15 10:59     ` Szabolcs Nagy
  2016-12-15 18:58       ` Rich Felker
  0 siblings, 1 reply; 5+ messages in thread
From: Szabolcs Nagy @ 2016-12-15 10:59 UTC (permalink / raw)
  To: musl

* A. Wilcox <AWilcox@Wilcox-Tech.com> [2016-12-14 22:11:49 -0600]:
> On 14/12/16 04:53, Szabolcs Nagy wrote:
> > * A. Wilcox <awilfox@adelielinux.org> [2016-12-14 04:02:39 -0600]:
> > i think the simplest fix is to config with --disable-decimal-float
> 
> Note "--disable-decimal-float".  I receive the same error.
> 

yeah, libgcc insists on using decimal float if the
compiler you build it with supports it.. (which is xgcc
when you cross compile so things work, but if you build
natively the config flags don't affect the outcome).
try to configure with

libgcc_cv_dfp=no

> > the second simplest fix is to patch the ifdef logic (e.g. define
> > BFP_FMT "%Le") but then the conversion code would be broken at
> > runtime: the code is compiled with -mlong-double-128 and musl
> > expects 64 bit long double. (most likely the bootstrap process
> > does not depend on this to work so this is a workaround hack
> > that only breaks 128bit float to decimal conversion.)
> 
> That sounds unacceptable for production code.  I do not understand the
> inner workings of floating point though.
> 

note that without -mlong-double-128 the broken functions
are never generated, and since musl does not support 128bit
long double, with -mlong-double-128 broken decimal conversion
will be the least of your problems.

> > the correct way on musl is to build libgcc without -mlong-double-128
> > and without all the 128bit (TF mode) float stuff, but this may need
> > some configure and build system changes as i don't immediately see
> > an option to turn tf mode things off.
> 
> I cannot seem to disable -mlong-double-128 no matter what I patch. :(
> 

there is this:
http://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/gcc/gcc-6.2/0045-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
but it needs more work. (the makefile should be modified too)


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

* Re: musl + PowerPC + GCC 5
  2016-12-15 10:59     ` Szabolcs Nagy
@ 2016-12-15 18:58       ` Rich Felker
  0 siblings, 0 replies; 5+ messages in thread
From: Rich Felker @ 2016-12-15 18:58 UTC (permalink / raw)
  To: musl

On Thu, Dec 15, 2016 at 11:59:01AM +0100, Szabolcs Nagy wrote:
> * A. Wilcox <AWilcox@Wilcox-Tech.com> [2016-12-14 22:11:49 -0600]:
> > On 14/12/16 04:53, Szabolcs Nagy wrote:
> > > * A. Wilcox <awilfox@adelielinux.org> [2016-12-14 04:02:39 -0600]:
> > > i think the simplest fix is to config with --disable-decimal-float
> > 
> > Note "--disable-decimal-float".  I receive the same error.
> > 
> 
> yeah, libgcc insists on using decimal float if the
> compiler you build it with supports it.. (which is xgcc
> when you cross compile so things work, but if you build
> natively the config flags don't affect the outcome).
> try to configure with
> 
> libgcc_cv_dfp=no

I don't think this should be an issue unless you're lying to
configure:

1. If you have --build=powerpc-linux-musl and the gcc on your system
   is actually musl-targeted, it won't have decimal float (because
   it's presently impossible to build a gcc where that's working) and
   it should detect that and work.

2. If you have --build=powerpc-linux-gnu, then you're cross compiling
   and/or building across compiler, so xgcc or powerpc-linux-musl-gcc
   should be used in place of gcc to build target libs.

Only in the case where you told it build=musl but it's really
build=gnu should this break...

Rich


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

end of thread, other threads:[~2016-12-15 18:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-14 10:02 musl + PowerPC + GCC 5 A. Wilcox
2016-12-14 10:53 ` Szabolcs Nagy
2016-12-15  4:11   ` A. Wilcox
2016-12-15 10:59     ` Szabolcs Nagy
2016-12-15 18:58       ` Rich Felker

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

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).