mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: j-core@lists.j-core.org, musl@lists.openwall.com
Subject: Re: [J-core] [musl] updated cross-compiler build system
Date: Sun, 1 May 2016 13:15:55 -0400	[thread overview]
Message-ID: <20160501171554.GI21636@brightrain.aerifal.cx> (raw)
In-Reply-To: <20160501153804.GP22574@port70.net>

On Sun, May 01, 2016 at 05:38:04PM +0200, Szabolcs Nagy wrote:
> * Rich Felker <dalias@libc.org> [2016-05-01 01:45:02 -0400]:
> > I've just pushed the new overhaul of musl-cross-make, my cross
> > compiler build system:
> > 
> > https://github.com/richfelker/musl-cross-make
> > 
> > This should make it faster (single-stage), safer (https and hash
> > checking), simpler (built-in fetching of gmp & friends), and cleaner
> > to build and install cross compilers that can be used to target J-core
> > Linux. The sh2eb-linux-muslfdpic target profile in the sample
> > config.mak(.dist) file is all you need to select and use. As usual it
> > also should work for all other (non J-core) musl targets too.
> > 
> > I've tested it pretty extensively on two systems I use for builds, but
> > as this is a big change/overhaul there might be things that break. Let
> > me know how using it goes.
> 
> nice
> 
> i made some mods:
> 
> changed $$(LC_ROOT) to $${LC_ROOT} because it seems to
> be passed to bash in config.status (as $$(, \$( and  $(
> and the last one executes LC_ROOT as a command, this
> might be an autoconf bug: it does not escape the args
> correctly)

I noticed that too but didn't get around to looking into the details
since nothing broke. The whole point though is to _avoid_ it getting
expanded in places like config.status -- I was trying to keep the
absolute path to the top-level dir from getting saved anywhere in the
build tree, so that it can safely be moved. Do you know if your change
preserves this property?

> for me make fails in bfd/doc despite MAKINFO=false, but
> the export AM_MAKEFLAGS=INFO_DEPS= hack fixed it.

Uhg, yes, I just installed texinfo on my VPS and forgot to check the
case where it's missing.

> src_mpfr dep was wrong.

Thanks.

> i like saving the build log, but 2>&1 might not be what
> everybody wants.

Indeed; see below for more thoughts on it:

> and linux headers are often needed to build things so
> there could be an install target for it:

I was thinking of this too, but it would be nice to be able to get
just the headers rather than the whole Linux source tree. I think one
or more musl-based distros might already have a stripped-down package
we could fetch, if the hosting is suitable.

> install-linuxheaders: install-toolchain
> 	case $(TARGET) in \
> 	i*86* | x86_64* | x32*) A=x86 ;; \
> 	arm*) A=arm ;; \
> 	aarch64*) A=arm64 ;; \
> 	mips*) A=mips ;; \
> 	or1k*) A=openrisc ;; \
> 	sh* | j[24]*) A=sh ;; \
> 	powerpc* | ppc*) A=powerpc ;; \
> 	microblaze*) A=microblaze ;; \
> 	esac; \
> 	$(MAKE) -C ../src_linux headers_install ARCH=$$A \
> 		CROSS_COMPILE=$(DESTDIR)$(OUTPUT)/$(TARGET)- \
> 		INSTALL_HDR_PATH=$(DESTDIR)$(OUTPUT)/$(TARGET)

AFAIK you don't need CROSS_COMPILE= to install headers, and in
principle it shouldn't be there because the install targets are not
intended to depend on each other. But you do need to install to a
staging dir and then copy to the final dest; the broken
headers_install target in Linux rm's the scsi headers (eew) provided
by libc and fails to provide replacements.

> diff --git a/Makefile b/Makefile
> index e85ccba..adac3c1 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -130,7 +130,7 @@ $(BUILD_DIR)/config.mak: | $(BUILD_DIR)
>  	"-include ../config.mak"
>  
>  all: | $(SRC_DIRS) $(BUILD_DIR) $(BUILD_DIR)/Makefile $(BUILD_DIR)/config.mak
> -	cd $(BUILD_DIR) && $(MAKE) $@
> +	cd $(BUILD_DIR) && $(MAKE) $@ 2>&1 |tee -a build.log

Logging should probably either be left to the user or sent to a file
specific to the build directory rather than saved in the top-level
directory. The supported/intended use for the future is that you can
omit TARGET= in config.mak and instead have conditionals for he
settings you want for different targets, then do things like:

make TARGET=i486-linux-musl all

and have that build end up in its own isolated dir. It shouldn't be
hard to add "make TARGETS='a b c ...'" support too if desired using
another level of recursion, or even make target tuple names act as
make targets when $(TARGET) is unset.

> @@ -55,13 +55,13 @@ src_musl: | $(MUSL_SRCDIR)
>  	ln -sf $(MUSL_SRCDIR) $@
>  
>  src_gmp: | $(GMP_SRCDIR)
> -	ln -sf "$(GMP_SRCDIR)" $@
> +	ln -sf $(GMP_SRCDIR) $@
>  
>  src_mpc: | $(MPC_SRCDIR)
> -	ln -sf "$(MPC_SRCDIR)" $@
> +	ln -sf $(MPC_SRCDIR) $@
>  
> -src_mpfr: | $(GMP_SRCDIR)
> -	ln -sf "$(MPFR_SRCDIR)" $@
> +src_mpfr: | $(MPFR_SRCDIR)
> +	ln -sf $(MPFR_SRCDIR) $@

The dep was wrong, but the quoting was intentional, albeit untested.
The idea was to make broken symlinks that would then ENOENT out if the
caller does not want to provide these libs (i.e. wants to use the
system ones). But apparently symlink(2) fails with ENOENT in this
case, so I need a new solution...
 
Rich


  reply	other threads:[~2016-05-01 17:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-01  5:45 Rich Felker
2016-05-01 15:38 ` Szabolcs Nagy
2016-05-01 17:15   ` Rich Felker [this message]
2016-05-01 21:55     ` Re: [J-core] [musl] " Szabolcs Nagy
     [not found]     ` <5726965F.1060406@landley.net>
2016-05-02  2:58       ` Rich Felker
2016-05-02  4:31         ` Rob Landley
2016-05-02 15:52     ` question: use of musl-libc anonymous

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160501171554.GI21636@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=j-core@lists.j-core.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).