ahgamut / superconfigure

wrap autotools configure scripts to build with Cosmopolitan Libc
The Unlicense
159 stars 22 forks source link

Floating point libraries #4

Closed JoshuaWierenga closed 8 months ago

JoshuaWierenga commented 8 months ago

Is there any interest in either decimal floats with libdfp or 128 bit binary floats with libquadmath? I wanted to mess around with them so have a proof of concept port to cosmo for them at https://github.com/JoshuaWierenga/superconfigure/tree/libdfp. They are a bit rough though. Especially libquadmath, where gcc's build system wanted to build a new compiler to build it with but then does not pass though the includes of the host compiler so it just errors out. I ended up copying just enough files into a different folder to build it directly with cosmocc. I also do not have any specific programs in mind that use them that could be added though which does reduce their usefulness. I am open to suggestions on both better ways to build them and on applications.

ahgamut commented 8 months ago

where gcc's build system wanted to build a new compiler to build it with but then does not pass though the includes of the host compiler so it just errors out

IIRC libquadmath and libgcc are built with xgcc, the intermediate compiler executable built during the process, and xgcc uses different include locations.

for libquadmath I've tried building it within this repo before. My preference would be to build libquadmath via removing the --disable-libquadmath in gcc-11.2-patched/superconfigure instead of using a separate folder.

I haven't used libdfp before; the build instructions specifically say to build with glibc, I'm not sure how much code would need to be patched.

If you can get libquadmath to build as part of the gcc build process, and then libdfp based on that, that would be pretty cool. I'd prefer that the releases page only provides binaries, so we'd have to build some executables that use these libraries.

JoshuaWierenga commented 8 months ago

I will try switching from compiler-rt back to libgcc and then building both it and libquadmath with xgcc. Hopefully, I can either set it's include directories in some way or just stop building after it is built and swap it out for the cosmocc scripts. On the topic of actual programs using libquadmath, there are way fewer than I thought with most I could find being more maths libraries, forks of GCC for random devices, and compilers/runtimes for various languages including Fortran, Julia and Perl. So unless you know of a program that uses 128-bit maths that I missed, getting one of those languages working might be the best use of it. Does apperl still work?

ahgamut commented 8 months ago

Can't think of any programs off the top of my head. If there aren't that many directions for 128-bit maths with libquadmath.a, then I'll close the issue for now. I'll reopen if I find a bunch of interesting software to compile with libdfp.