mailing list of musl libc
 help / color / mirror / code / Atom feed
* Using Musl with LLVM/Clang
@ 2015-05-25 20:32 Lucas Simões
  2015-05-26  1:33 ` Shiz
  0 siblings, 1 reply; 8+ messages in thread
From: Lucas Simões @ 2015-05-25 20:32 UTC (permalink / raw)
  To: musl, Paulo Castro

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

Hi everyone,

Me and my friend CC'd on this email are trying to use musl as libc to
compile some programs on ArchLinux.
We've successfuly used musl with GCC using yours' musl-gcc script, on the
other hand we couldn't find a way to use it altogether with Clang.

Do you guys have any idea on which flags needed to achieve this?

Thank you very much and sorry about the silly question, we couldn't find it
anywhere on the web.

Lucas

Please CC to simoes.lucas.silva@gmail.com and p.oliveira.castro@gmail.com

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

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

* Re: Using Musl with LLVM/Clang
  2015-05-25 20:32 Using Musl with LLVM/Clang Lucas Simões
@ 2015-05-26  1:33 ` Shiz
  2015-05-26  1:37   ` Rich Felker
  0 siblings, 1 reply; 8+ messages in thread
From: Shiz @ 2015-05-26  1:33 UTC (permalink / raw)
  To: musl; +Cc: Paulo Castro, simoes.lucas.silva

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

There’s sadly no trivial clang wrapper script as of yet, but you can look at the ELLCC project[1],
which distributes prebuilt musl-powered LLVM toolchains. Wrapping clang with a musl-gcc like script
would be absolutely desirable, but I’m unsure how possible that is given clang’s apparent lack of specs files[2].

-S

[1]: http://ellcc.org/
[2]: http://clang.llvm.org/docs/DriverInternals.html#relation-to-gcc-driver-concepts

> On 25 May 2015, at 22:32, Lucas Simões <simoes.lucas.silva@gmail.com> wrote:
> 
> Hi everyone,
> 
> Me and my friend CC'd on this email are trying to use musl as libc to compile some programs on ArchLinux.
> We've successfuly used musl with GCC using yours' musl-gcc script, on the other hand we couldn't find a way to use it altogether with Clang.
> 
> Do you guys have any idea on which flags needed to achieve this?
> 
> Thank you very much and sorry about the silly question, we couldn't find it anywhere on the web.
> 
> Lucas
> 
> Please CC to simoes.lucas.silva@gmail.com and p.oliveira.castro@gmail.com


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

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

* Re: Using Musl with LLVM/Clang
  2015-05-26  1:33 ` Shiz
@ 2015-05-26  1:37   ` Rich Felker
  2015-05-26  1:53     ` Shiz
  0 siblings, 1 reply; 8+ messages in thread
From: Rich Felker @ 2015-05-26  1:37 UTC (permalink / raw)
  To: musl

On Tue, May 26, 2015 at 03:33:19AM +0200, Shiz wrote:
> There’s sadly no trivial clang wrapper script as of yet, but you can look at the ELLCC project[1],
> which distributes prebuilt musl-powered LLVM toolchains. Wrapping clang with a musl-gcc like script
> would be absolutely desirable, but I’m unsure how possible that is given clang’s apparent lack of specs files[2].

The main reason we need a specfile for gcc rather than just -nostdinc
and -nostdlib is that the latter does not suppress search of the
default library paths, just the libraries, i.e. it removes the -l's
but not the -L's. If you can find a way to remove the default -L's for
clang then it should be easy.

Rich


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

* Re: Using Musl with LLVM/Clang
  2015-05-26  1:37   ` Rich Felker
@ 2015-05-26  1:53     ` Shiz
  2015-05-26  7:48       ` Justin Cormack
  0 siblings, 1 reply; 8+ messages in thread
From: Shiz @ 2015-05-26  1:53 UTC (permalink / raw)
  To: musl; +Cc: Paulo Castro, simoes.lucas.silva

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

> On 26 May 2015, at 03:37, Rich Felker <dalias@libc.org> wrote:
> 
> The main reason we need a specfile for gcc rather than just -nostdinc
> and -nostdlib is that the latter does not suppress search of the
> default library paths, just the libraries, i.e. it removes the -l's
> but not the -L's. If you can find a way to remove the default -L's for
> clang then it should be easy.
> 
> Rich

Sadly, after looking at the clang driver source[1], there seems to be no
such option: it unconditionally adds the library paths. Unless there’s
some way to influence ToolChain.getFilePaths(), it doesn’t seem like it
can be done without modifying the clang source code.

-S

[1]: https://github.com/llvm-mirror/clang/blob/9a5a6f0e149ba035168641ca6dc4e3b3e5aa29b5/lib/Driver/Tools.cpp#L8009

[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

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

* Re: Using Musl with LLVM/Clang
  2015-05-26  1:53     ` Shiz
@ 2015-05-26  7:48       ` Justin Cormack
  2015-05-27  0:23         ` Lucas Simões
  0 siblings, 1 reply; 8+ messages in thread
From: Justin Cormack @ 2015-05-26  7:48 UTC (permalink / raw)
  To: musl; +Cc: Paulo Castro, simoes.lucas.silva

On 26 May 2015 at 02:53, Shiz <hi@shiz.me> wrote:
>> On 26 May 2015, at 03:37, Rich Felker <dalias@libc.org> wrote:
>>
>> The main reason we need a specfile for gcc rather than just -nostdinc
>> and -nostdlib is that the latter does not suppress search of the
>> default library paths, just the libraries, i.e. it removes the -l's
>> but not the -L's. If you can find a way to remove the default -L's for
>> clang then it should be easy.
>>
>> Rich
>
> Sadly, after looking at the clang driver source[1], there seems to be no
> such option: it unconditionally adds the library paths. Unless there’s
> some way to influence ToolChain.getFilePaths(), it doesn’t seem like it
> can be done without modifying the clang source code.

You can use clang with --sysroot, if everything is under the same root path.

In theory if clang had support you could just use -target or just
rename the compiler and it would just compile for Musl, according to
the docs http://clang.llvm.org/docs/CrossCompilation.html but I am
guessing that needs some upstream support, would be nice to add.

Justin


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

* Re: Using Musl with LLVM/Clang
  2015-05-26  7:48       ` Justin Cormack
@ 2015-05-27  0:23         ` Lucas Simões
  2015-05-27  1:20           ` Richard Pennington
  2015-05-27  1:38           ` Shiz
  0 siblings, 2 replies; 8+ messages in thread
From: Lucas Simões @ 2015-05-27  0:23 UTC (permalink / raw)
  To: Justin Cormack, musl; +Cc: Paulo Castro

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

Thank you for the quick response guys!
That's really sad, I was truly hoping to find a way to use musl out of the
box with Clang (on my Arch)
Guess I'll just have to check the toolchains on this ELLCC project

Em ter, 26 de mai de 2015 às 04:48, Justin Cormack <
justin@specialbusservice.com> escreveu:

> On 26 May 2015 at 02:53, Shiz <hi@shiz.me> wrote:
> >> On 26 May 2015, at 03:37, Rich Felker <dalias@libc.org> wrote:
> >>
> >> The main reason we need a specfile for gcc rather than just -nostdinc
> >> and -nostdlib is that the latter does not suppress search of the
> >> default library paths, just the libraries, i.e. it removes the -l's
> >> but not the -L's. If you can find a way to remove the default -L's for
> >> clang then it should be easy.
> >>
> >> Rich
> >
> > Sadly, after looking at the clang driver source[1], there seems to be no
> > such option: it unconditionally adds the library paths. Unless there’s
> > some way to influence ToolChain.getFilePaths(), it doesn’t seem like it
> > can be done without modifying the clang source code.
>
> You can use clang with --sysroot, if everything is under the same root
> path.
>
> In theory if clang had support you could just use -target or just
> rename the compiler and it would just compile for Musl, according to
> the docs http://clang.llvm.org/docs/CrossCompilation.html but I am
> guessing that needs some upstream support, would be nice to add.
>
> Justin
>

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

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

* Re: Using Musl with LLVM/Clang
  2015-05-27  0:23         ` Lucas Simões
@ 2015-05-27  1:20           ` Richard Pennington
  2015-05-27  1:38           ` Shiz
  1 sibling, 0 replies; 8+ messages in thread
From: Richard Pennington @ 2015-05-27  1:20 UTC (permalink / raw)
  To: musl; +Cc: Lucas Simões, Justin Cormack, Paulo Castro

On 05/26/2015 07:23 PM, Lucas Simões wrote:
> Thank you for the quick response guys!
> That's really sad, I was truly hoping to find a way to use musl out of 
> the box with Clang (on my Arch)
> Guess I'll just have to check the toolchains on this ELLCC project
>
Hi Lucas,

I did make some modifications to clang to make it easier (for me at 
least) to cross compile stuff, including musl, libc++, etc.My changes 
are pretty simple, but involve adding configuration files for different 
architectures. Most recently, I was playing with ARM Cortex-M3 
(http://ellcc.org/blog/?p=23234), but similar stuff can be used for 
several different targets 
(http://ellcc.org/viewvc/svn/ellcc/trunk/libecc/config/). I did it 
because I like to compile from the command line without a bunch of 
options for #includes, etc, because I'm essentially lazy. If you decide 
to try ELLCC, don't hesitate to ask for help if you encounter any problems.

-Rich (not *that* rich)


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

* Re: Using Musl with LLVM/Clang
  2015-05-27  0:23         ` Lucas Simões
  2015-05-27  1:20           ` Richard Pennington
@ 2015-05-27  1:38           ` Shiz
  1 sibling, 0 replies; 8+ messages in thread
From: Shiz @ 2015-05-27  1:38 UTC (permalink / raw)
  To: musl; +Cc: Justin Cormack, Paulo Castro

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

> On 27 May 2015, at 02:23, Lucas Simões <simoes.lucas.silva@gmail.com> wrote:
> 
> Thank you for the quick response guys!
> That's really sad, I was truly hoping to find a way to use musl out of the box with Clang (on my Arch)
> Guess I'll just have to check the toolchains on this ELLCC project

As a recent update, I’ve managed to get a musl-clang like script working
with some tips from the IRC channel. It’s far from done, but if you
want you can check out a preview version[1][2] of it. Note that it
requires manually editing the two scripts to edit in your libc and ld.so
locations. Place them anywhere in your $PATH and you /should/ be good to,
provided both clang and ld are also in your $PATH.

I’ve only tested it on my own setup, so I welcome any breakage reports. :)

-S

[1]: http://txt.shiz.me/ZWQwZjgxOW, save as musl-clang
[2]: http://txt.shiz.me/NGRhZDg2Yz, save as ld.musl-clang

[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

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

end of thread, other threads:[~2015-05-27  1:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-25 20:32 Using Musl with LLVM/Clang Lucas Simões
2015-05-26  1:33 ` Shiz
2015-05-26  1:37   ` Rich Felker
2015-05-26  1:53     ` Shiz
2015-05-26  7:48       ` Justin Cormack
2015-05-27  0:23         ` Lucas Simões
2015-05-27  1:20           ` Richard Pennington
2015-05-27  1:38           ` Shiz

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