mailing list of musl libc
 help / color / mirror / code / Atom feed
* musl-llvm-clang-libc++
@ 2015-01-06 14:31 Tomasz Sterna
  2015-01-06 14:55 ` musl-llvm-clang-libc++ Daniel Cegiełka
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Tomasz Sterna @ 2015-01-06 14:31 UTC (permalink / raw)
  To: musl

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

Hello.

You might be interested to know, that I managed to build a
musl + LLVM (clang, libc++) based, self hosted system.

The hardest part was to scrub libgcc and libstdc++ dependencies.
Using instructions from Wiki[1] and hints from this list[2] and LLVM
bugtracker[3] I finally managed to get a self-hosting system able to
rebuild itself clean without any GCC help.

It requires a bit arm-twisting to LLVM compiler and libs, but it looks
like it works just fine. The musl/libc++/clang++ env is able to build
working libc++ and clang++, which I consider GoodEnough(TM) test case.

If you want to toy around with it you can install it directly from repo.

# mkdir /mnt/test	# I usually mount a btrfs subvolume here
# apk.static --repository http://ftp.d-os.eu/latest/core --update-cache --allow-untrusted --root /mnt/test --initdb add dos-base dos-sdk libcxx-dev

It is based on great work of Alpine Linux.
Still heavily work-in-progress and very rough on edges, but I think it
may be very useful for people trying to get free of GNU libc, libstdc++
and GCC bits, so I decided to share early.
Also it is good to have some more eyes on as there is a lot of guesswork
there.

The apk sources with required patches and some quick notes are on
GitHub: https://github.com/D-os/aports/tree/master/core


[1] http://wiki.musl-libc.org/wiki/BuildingLLVM
[2] http://www.openwall.com/lists/musl/2014/04/22/2
[3] http://llvm.org/bugs/show_bug.cgi?id=7276

-- 
Tomasz Sterna                           :(){ :|:&};:
Instant Messaging Consultant   Open Source Developer 
http://abadcafe.pl/      http://xiaoka.com/portfolio


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: musl-llvm-clang-libc++
  2015-01-06 14:31 musl-llvm-clang-libc++ Tomasz Sterna
@ 2015-01-06 14:55 ` Daniel Cegiełka
  2015-01-06 15:06 ` musl-llvm-clang-libc++ Luca Barbato
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Daniel Cegiełka @ 2015-01-06 14:55 UTC (permalink / raw)
  To: musl

Nice work! :)
Daniel


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

* Re: musl-llvm-clang-libc++
  2015-01-06 14:31 musl-llvm-clang-libc++ Tomasz Sterna
  2015-01-06 14:55 ` musl-llvm-clang-libc++ Daniel Cegiełka
@ 2015-01-06 15:06 ` Luca Barbato
  2015-01-06 16:41   ` musl-llvm-clang-libc++ stephen Turner
  2015-01-06 16:43 ` musl-llvm-clang-libc++ Szabolcs Nagy
  2015-01-06 22:12 ` musl-llvm-clang-libc++ Richard Pennington
  3 siblings, 1 reply; 10+ messages in thread
From: Luca Barbato @ 2015-01-06 15:06 UTC (permalink / raw)
  To: musl

On 06/01/15 15:31, Tomasz Sterna wrote:
> Hello.
> 
> You might be interested to know, that I managed to build a
> musl + LLVM (clang, libc++) based, self hosted system.
> 
> The hardest part was to scrub libgcc and libstdc++ dependencies.
> Using instructions from Wiki[1] and hints from this list[2] and LLVM
> bugtracker[3] I finally managed to get a self-hosting system able to
> rebuild itself clean without any GCC help.
> 
> It requires a bit arm-twisting to LLVM compiler and libs, but it looks
> like it works just fine. The musl/libc++/clang++ env is able to build
> working libc++ and clang++, which I consider GoodEnough(TM) test case.
> 

Probably it is time to get all the information in a single place, it
isn't the first time somebody succeeds but I always see scattered
information.

lu



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

* Re: musl-llvm-clang-libc++
  2015-01-06 15:06 ` musl-llvm-clang-libc++ Luca Barbato
@ 2015-01-06 16:41   ` stephen Turner
  0 siblings, 0 replies; 10+ messages in thread
From: stephen Turner @ 2015-01-06 16:41 UTC (permalink / raw)
  To: musl

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

>
> Probably it is time to get all the information in a single place, it
> isn't the first time somebody succeeds but I always see scattered
> information.
>
> lu
>
>
I dont use clang but i would imagine if patches aren't available then
people would be asking for them soon. It might be nice to have all patches
hosted in one location too that doesn't serialize the web link making wget
difficult on a cli only system. The gregorr musl link typically does this
long serialized connection. what makes it worse is you cant script it
because the link changes from time to time.

example
https://bitbucket.org/GregorR/musl-cross/raw/69ea1932e1a8bb172c0a159dfceb70f822fc71d2/build.sh

thanks,
stephen

[-- Attachment #2: Type: text/html, Size: 1299 bytes --]

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

* Re: musl-llvm-clang-libc++
  2015-01-06 14:31 musl-llvm-clang-libc++ Tomasz Sterna
  2015-01-06 14:55 ` musl-llvm-clang-libc++ Daniel Cegiełka
  2015-01-06 15:06 ` musl-llvm-clang-libc++ Luca Barbato
@ 2015-01-06 16:43 ` Szabolcs Nagy
  2015-01-06 17:29   ` musl-llvm-clang-libc++ Szabolcs Nagy
  2015-01-06 17:50   ` musl-llvm-clang-libc++ Rich Felker
  2015-01-06 22:12 ` musl-llvm-clang-libc++ Richard Pennington
  3 siblings, 2 replies; 10+ messages in thread
From: Szabolcs Nagy @ 2015-01-06 16:43 UTC (permalink / raw)
  To: musl

* Tomasz Sterna <tomek@xiaoka.com> [2015-01-06 15:31:43 +0100]:
> You might be interested to know, that I managed to build a
> musl + LLVM (clang, libc++) based, self hosted system.
> 
> The hardest part was to scrub libgcc and libstdc++ dependencies.
> Using instructions from Wiki[1] and hints from this list[2] and LLVM
> bugtracker[3] I finally managed to get a self-hosting system able to
> rebuild itself clean without any GCC help.

nice

> It requires a bit arm-twisting to LLVM compiler and libs, but it looks
> like it works just fine. The musl/libc++/clang++ env is able to build
> working libc++ and clang++, which I consider GoodEnough(TM) test case.

i ran http://repo.or.cz/w/libc-test.git on it and it turned up
some float bugs:

- musl's FLT_ROUND is wrong: it should reflect the current rounding mode
(i found this because clang float.h was used when comiling the tests
instead of musl's which may or may not be a problem)

- clang does not support c99 fenv and -frounding-math flag so fenv tests
are broken, but i didnt see incorrect results because of this

- long double is broken for some reason: strtod, and most long double
math functions give bad results in some cases, needs more investigation..


> 
> If you want to toy around with it you can install it directly from repo.
> 
> # mkdir /mnt/test	# I usually mount a btrfs subvolume here
> # apk.static --repository http://ftp.d-os.eu/latest/core --update-cache --allow-untrusted --root /mnt/test --initdb add dos-base dos-sdk libcxx-dev
> 
> It is based on great work of Alpine Linux.
> Still heavily work-in-progress and very rough on edges, but I think it
> may be very useful for people trying to get free of GNU libc, libstdc++
> and GCC bits, so I decided to share early.
> Also it is good to have some more eyes on as there is a lot of guesswork
> there.
> 
> The apk sources with required patches and some quick notes are on
> GitHub: https://github.com/D-os/aports/tree/master/core
> 
> 
> [1] http://wiki.musl-libc.org/wiki/BuildingLLVM
> [2] http://www.openwall.com/lists/musl/2014/04/22/2
> [3] http://llvm.org/bugs/show_bug.cgi?id=7276
> 
> -- 
> Tomasz Sterna                           :(){ :|:&};:
> Instant Messaging Consultant   Open Source Developer 
> http://abadcafe.pl/      http://xiaoka.com/portfolio
> 




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

* Re: musl-llvm-clang-libc++
  2015-01-06 16:43 ` musl-llvm-clang-libc++ Szabolcs Nagy
@ 2015-01-06 17:29   ` Szabolcs Nagy
  2015-01-06 17:50   ` musl-llvm-clang-libc++ Rich Felker
  1 sibling, 0 replies; 10+ messages in thread
From: Szabolcs Nagy @ 2015-01-06 17:29 UTC (permalink / raw)
  To: musl

* Szabolcs Nagy <nsz@port70.net> [2015-01-06 17:43:13 +0100]:
> - long double is broken for some reason: strtod, and most long double
> math functions give bad results in some cases, needs more investigation..

turned out to be a x86_64 qemu bug

(it does not handle some x87 instuctions correctly
like fyl2x)


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

* Re: musl-llvm-clang-libc++
  2015-01-06 16:43 ` musl-llvm-clang-libc++ Szabolcs Nagy
  2015-01-06 17:29   ` musl-llvm-clang-libc++ Szabolcs Nagy
@ 2015-01-06 17:50   ` Rich Felker
  1 sibling, 0 replies; 10+ messages in thread
From: Rich Felker @ 2015-01-06 17:50 UTC (permalink / raw)
  To: musl

On Tue, Jan 06, 2015 at 05:43:13PM +0100, Szabolcs Nagy wrote:
> * Tomasz Sterna <tomek@xiaoka.com> [2015-01-06 15:31:43 +0100]:
> > You might be interested to know, that I managed to build a
> > musl + LLVM (clang, libc++) based, self hosted system.
> > 
> > The hardest part was to scrub libgcc and libstdc++ dependencies.
> > Using instructions from Wiki[1] and hints from this list[2] and LLVM
> > bugtracker[3] I finally managed to get a self-hosting system able to
> > rebuild itself clean without any GCC help.
> 
> nice
> 
> > It requires a bit arm-twisting to LLVM compiler and libs, but it looks
> > like it works just fine. The musl/libc++/clang++ env is able to build
> > working libc++ and clang++, which I consider GoodEnough(TM) test case.
> 
> i ran http://repo.or.cz/w/libc-test.git on it and it turned up
> some float bugs:
> 
> - musl's FLT_ROUND is wrong: it should reflect the current rounding mode
> (i found this because clang float.h was used when comiling the tests
> instead of musl's which may or may not be a problem)

This behavior is copied from GCC. We'll need to define a new ABI for
the header to provide a runtime-variable value I think. The definition
should probably be removed from bits files _except_ on archs without
fenv; then, the top-level float.h can define it to use the new
runtime-variable value unless it's already defined as a constant by
the bits file.

> - clang does not support c99 fenv and -frounding-math flag so fenv tests
> are broken, but i didnt see incorrect results because of this

GCC is pretty similar here. It doesn't properly support them (even
though it sort of claims to) but things "mostly work" unless you get
unlucky...

> - long double is broken for some reason: strtod, and most long double
> math functions give bad results in some cases, needs more investigation..

That's really ugly/bad... :( Hopefully we can find the cause and get
it fixed soon. Unless this is just a build failure, future
documentation versions (arg, docs are way out of date!) will probably
need to mention that non-latest clang doesn't work for x86[_64] due to
major floating point bugs.

Rich


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

* Re: musl-llvm-clang-libc++
  2015-01-06 14:31 musl-llvm-clang-libc++ Tomasz Sterna
                   ` (2 preceding siblings ...)
  2015-01-06 16:43 ` musl-llvm-clang-libc++ Szabolcs Nagy
@ 2015-01-06 22:12 ` Richard Pennington
  2015-01-06 23:43   ` musl-llvm-clang-libc++ Tomasz Sterna
  3 siblings, 1 reply; 10+ messages in thread
From: Richard Pennington @ 2015-01-06 22:12 UTC (permalink / raw)
  To: musl

On 01/06/2015 08:31 AM, Tomasz Sterna wrote:
> Hello.
>
> You might be interested to know, that I managed to build a
> musl + LLVM (clang, libc++) based, self hosted system.
>
Hi Tomasz,

Are you also using compiler-rt? I've had great luck with 
clang/LLVM/libc++/libc++abi/musl/compiler-rt. No GNU code at all.
It can build itself as well as binutils and GDB for ARM, i386, Mips, 
PowerPC, and x86_64.

-Rich


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

* Re: musl-llvm-clang-libc++
  2015-01-06 22:12 ` musl-llvm-clang-libc++ Richard Pennington
@ 2015-01-06 23:43   ` Tomasz Sterna
  2015-01-07  0:26     ` musl-llvm-clang-libc++ Richard Pennington
  0 siblings, 1 reply; 10+ messages in thread
From: Tomasz Sterna @ 2015-01-06 23:43 UTC (permalink / raw)
  To: musl

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

Dnia 2015-01-06, wto o godzinie 16:12 -0600, Richard Pennington pisze:
> Are you also using compiler-rt? I've had great luck with 
> clang/LLVM/libc++/libc++abi/musl/compiler-rt. No GNU code at all.
> It can build itself as well as binutils and GDB for ARM, i386, Mips, 
> PowerPC, and x86_64.

Yes. This is exactly my stack. :-)
I was pretty surprised that it works so well, with all the warnings "Not
tested under Linux, ymmv" sprinkled all over Apple submitted code.

I didn't try gdb yet.


P.S. binutils and gdb is "GNU code" ;-)
-- 
smoku @ http://abadcafe.pl/ @ http://xiaoka.com/

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: musl-llvm-clang-libc++
  2015-01-06 23:43   ` musl-llvm-clang-libc++ Tomasz Sterna
@ 2015-01-07  0:26     ` Richard Pennington
  0 siblings, 0 replies; 10+ messages in thread
From: Richard Pennington @ 2015-01-07  0:26 UTC (permalink / raw)
  To: musl

On 01/06/2015 05:43 PM, Tomasz Sterna wrote:
> Dnia 2015-01-06, wto o godzinie 16:12 -0600, Richard Pennington pisze:
>> Are you also using compiler-rt? I've had great luck with
>> clang/LLVM/libc++/libc++abi/musl/compiler-rt. No GNU code at all.
>> It can build itself as well as binutils and GDB for ARM, i386, Mips,
>> PowerPC, and x86_64.
> Yes. This is exactly my stack. :-)
> I was pretty surprised that it works so well, with all the warnings "Not
> tested under Linux, ymmv" sprinkled all over Apple submitted code.
>
> I didn't try gdb yet.
>
>
> P.S. binutils and gdb is "GNU code" ;-)

Hi Tomasz,

I meant no GNU code in the output binaries, but I'm sure you know that. ;-)

-Rich


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

end of thread, other threads:[~2015-01-07  0:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-06 14:31 musl-llvm-clang-libc++ Tomasz Sterna
2015-01-06 14:55 ` musl-llvm-clang-libc++ Daniel Cegiełka
2015-01-06 15:06 ` musl-llvm-clang-libc++ Luca Barbato
2015-01-06 16:41   ` musl-llvm-clang-libc++ stephen Turner
2015-01-06 16:43 ` musl-llvm-clang-libc++ Szabolcs Nagy
2015-01-06 17:29   ` musl-llvm-clang-libc++ Szabolcs Nagy
2015-01-06 17:50   ` musl-llvm-clang-libc++ Rich Felker
2015-01-06 22:12 ` musl-llvm-clang-libc++ Richard Pennington
2015-01-06 23:43   ` musl-llvm-clang-libc++ Tomasz Sterna
2015-01-07  0:26     ` musl-llvm-clang-libc++ Richard Pennington

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