mailing list of musl libc
 help / color / mirror / code / Atom feed
* Generating headers for a specific target
@ 2018-03-01 20:49 EJ
  2018-03-01 20:59 ` Rich Felker
  0 siblings, 1 reply; 4+ messages in thread
From: EJ @ 2018-03-01 20:49 UTC (permalink / raw)
  To: musl

Hello,

Is there a way to generate the headers for a specific target without having access to the target or a cross-compiler for the target?

I’m not interested in compiling must, just in a complete set of header files.

Thanks.

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

* Re: Generating headers for a specific target
  2018-03-01 20:49 Generating headers for a specific target EJ
@ 2018-03-01 20:59 ` Rich Felker
  2018-03-01 21:12   ` EJ
  0 siblings, 1 reply; 4+ messages in thread
From: Rich Felker @ 2018-03-01 20:59 UTC (permalink / raw)
  To: musl

On Thu, Mar 01, 2018 at 09:49:42PM +0100, EJ wrote:
> Hello,
> 
> Is there a way to generate the headers for a specific target without
> having access to the target or a cross-compiler for the target?
> 
> I’m not interested in compiling must, just in a complete set of header files.

Yes, with a few caveats. Keep in mind that for archs with subarchs,
there will be preprocessor conditionals in the bits headers which
depend on predefined macros from the compiler, so you can't
use/process the headers without knowing the values of those macros.

With that said, something like this should work from a clean tree:

	make includedir=/where/you/want/them ARCH=whatever install-headers

or out-of-tree in a clean dir:

	make -f /path/to/musl/Makefile srcdir=/path/to/musl \
	includedir=/where/you/want/them ARCH=whatever install-headers

filling in ARCH=whatever with the musl name for the target arch (not
including the subarch part).

The above make invocations are not entirely documented/public
interfaces, but are probably 90% so and unlikely to change/break in
practice. It might be a good idea to check that they still work with
new versions when upgrading musl though.

Rich


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

* Re: Generating headers for a specific target
  2018-03-01 20:59 ` Rich Felker
@ 2018-03-01 21:12   ` EJ
  2018-03-01 21:20     ` Rich Felker
  0 siblings, 1 reply; 4+ messages in thread
From: EJ @ 2018-03-01 21:12 UTC (permalink / raw)
  To: musl

Hi Rich,

> On 1 Mar 2018, at 21:59, Rich Felker <dalias@libc.org> wrote:
> 
> On Thu, Mar 01, 2018 at 09:49:42PM +0100, EJ wrote:
>> Hello,
>> 
>> Is there a way to generate the headers for a specific target without
>> having access to the target or a cross-compiler for the target?
>> 
>> I’m not interested in compiling must, just in a complete set of header files.
> 
> Yes, with a few caveats. Keep in mind that for archs with subarchs,
> there will be preprocessor conditionals in the bits headers which
> depend on predefined macros from the compiler, so you can't
> use/process the headers without knowing the values of those macros.

Understood. I’m still planning to run the headers through a properly
configured compiler fornt-end, so that shouldn’t be a problem.

> With that said, something like this should work from a clean tree:
> 
> 	make includedir=/where/you/want/them ARCH=whatever install-headers
> 
> or out-of-tree in a clean dir:
> 
> 	make -f /path/to/musl/Makefile srcdir=/path/to/musl \
> 	includedir=/where/you/want/them ARCH=whatever install-headers
> 
> filling in ARCH=whatever with the musl name for the target arch (not
> including the subarch part).

The above works like a charm.

> The above make invocations are not entirely documented/public
> interfaces, but are probably 90% so and unlikely to change/break in
> practice. It might be a good idea to check that they still work with
> new versions when upgrading musl though.

Understandable.

Thanks for your quick and informative response!



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

* Re: Generating headers for a specific target
  2018-03-01 21:12   ` EJ
@ 2018-03-01 21:20     ` Rich Felker
  0 siblings, 0 replies; 4+ messages in thread
From: Rich Felker @ 2018-03-01 21:20 UTC (permalink / raw)
  To: musl

On Thu, Mar 01, 2018 at 10:12:26PM +0100, EJ wrote:
> Hi Rich,
> 
> > On 1 Mar 2018, at 21:59, Rich Felker <dalias@libc.org> wrote:
> > 
> > On Thu, Mar 01, 2018 at 09:49:42PM +0100, EJ wrote:
> >> Hello,
> >> 
> >> Is there a way to generate the headers for a specific target without
> >> having access to the target or a cross-compiler for the target?
> >> 
> >> I’m not interested in compiling must, just in a complete set of header files.
> > 
> > Yes, with a few caveats. Keep in mind that for archs with subarchs,
> > there will be preprocessor conditionals in the bits headers which
> > depend on predefined macros from the compiler, so you can't
> > use/process the headers without knowing the values of those macros.
> 
> Understood. I’m still planning to run the headers through a properly
> configured compiler fornt-end, so that shouldn’t be a problem.
> 
> > With that said, something like this should work from a clean tree:
> > 
> > 	make includedir=/where/you/want/them ARCH=whatever install-headers
> > 
> > or out-of-tree in a clean dir:
> > 
> > 	make -f /path/to/musl/Makefile srcdir=/path/to/musl \
> > 	includedir=/where/you/want/them ARCH=whatever install-headers
> > 
> > filling in ARCH=whatever with the musl name for the target arch (not
> > including the subarch part).
> 
> The above works like a charm.
> 
> > The above make invocations are not entirely documented/public
> > interfaces, but are probably 90% so and unlikely to change/break in
> > practice. It might be a good idea to check that they still work with
> > new versions when upgrading musl though.
> 
> Understandable.
> 
> Thanks for your quick and informative response!

No problem. Also note that, if you are building compilers, you can
pause in the middle to build & install the musl headers; the
musl-cross-make repo has an example of how to do this with gcc, which
is roughly:

1. GCC: make all-gcc
2. musl: configure (using xgcc) and make install-headers
3. GCC: make all-target-libgcc with disable_shared forced
4. musl: make, make install to build sysroot
5. GCC: make all

Rich


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

end of thread, other threads:[~2018-03-01 21:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-01 20:49 Generating headers for a specific target EJ
2018-03-01 20:59 ` Rich Felker
2018-03-01 21:12   ` EJ
2018-03-01 21:20     ` 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).