From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12573 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Generating headers for a specific target Date: Thu, 1 Mar 2018 16:20:47 -0500 Message-ID: <20180301212047.GY1436@brightrain.aerifal.cx> References: <4A4C5FE4-F3DF-4A19-9D9B-EC7452756F10@gmail.com> <20180301205926.GX1436@brightrain.aerifal.cx> <2BD9F715-9AF2-4E4B-A923-2D9C1DB2C207@gmail.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1519939145 27652 195.159.176.226 (1 Mar 2018 21:19:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 1 Mar 2018 21:19:05 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-12589-gllmg-musl=m.gmane.org@lists.openwall.com Thu Mar 01 22:19:01 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1erVbN-000694-Bz for gllmg-musl@m.gmane.org; Thu, 01 Mar 2018 22:18:57 +0100 Original-Received: (qmail 20237 invoked by uid 550); 1 Mar 2018 21:21:00 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 20214 invoked from network); 1 Mar 2018 21:20:59 -0000 Content-Disposition: inline In-Reply-To: <2BD9F715-9AF2-4E4B-A923-2D9C1DB2C207@gmail.com> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:12573 Archived-At: On Thu, Mar 01, 2018 at 10:12:26PM +0100, EJ wrote: > Hi Rich, > > > On 1 Mar 2018, at 21:59, Rich Felker 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