richfelker / musl-cross-make

Simple makefile-based build for musl cross compiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No rule on some target

CuckooEXE opened this issue · comments

Hi!

I've encountered a peculiar bug when trying to make musl-cross-make. I'm building a project that relies on the compiler generated by musl-cross-make, so my Makefile will build it, you can see the relevant portions here:

MUSLDIR    := $(CURDIR)/musl-cross-make/output
CC         := $(MUSLDIR)/bin/$(ARCH)-gcc
dependencies: $(CC)


# Clean the dependencies - Use this sparingly, musl-cross-make takes  along time to build
clean-dependencies: 
	rm -rf musl-cross-make

# Build musl-cross-make
$(CC): 
	-git clone https://github.com/richfelker/musl-cross-make.git -j`nproc`
	$(MAKE) -C musl-cross-make/ TARGET=$(ARCH) install

This was working when I would build with make ARCH=x86_64-linux-musl dependencies. When I tried to build for armeb-linux-musleabihf, I got an error (below). When I cleaned up my directory and tried building for x86_64-linux-musl I got the same error. Any insight on how to fix this?

The log below is the second time I run make ARCH=x86_64-linux-musl dependencies, the first time generates a large output, of course, of everything building fine until I get to the below:

git clone https://github.com/richfelker/musl-cross-make.git -j`nproc`
fatal: destination path 'musl-cross-make' already exists and is not an empty directory.
make: [Makefile:38: /home/kali/Desktop/Stage0/musl-cross-make/output/bin/x86_64-linux-musl-gcc] Error 128 (ignored)
make -C musl-cross-make/ TARGET=x86_64-linux-musl install
make[1]: Entering directory '/home/kali/Desktop/Stage0/musl-cross-make'
cd build/local/x86_64-linux-musl && make OUTPUT=/home/kali/Desktop/Stage0/musl-cross-make/output install
make[2]: Entering directory '/home/kali/Desktop/Stage0/musl-cross-make/build/local/x86_64-linux-musl'
ln -sf lib obj_sysroot/lib32
ln -sf lib obj_sysroot/lib64
cd obj_musl && make MULTILIB_OSDIRNAMES= INFO_DEPS= infodir= ac_cv_prog_lex_root=lex.yy MAKEINFO=false DESTDIR=/home/kali/Desktop/Stage0/musl-cross-make/build/local/x86_64-linux-musl/obj_sysroot install-headers
make[3]: Entering directory '/home/kali/Desktop/Stage0/musl-cross-make/build/local/x86_64-linux-musl/obj_musl'
make[3]: *** No rule to make target '../src_musl/arch/x86_64-linux-musl/bits/alltypes.h.in', needed by 'obj/include/bits/alltypes.h'.  Stop.
make[3]: Leaving directory '/home/kali/Desktop/Stage0/musl-cross-make/build/local/x86_64-linux-musl/obj_musl'
make[2]: *** [Makefile:231: obj_sysroot/.lc_headers] Error 2
make[2]: Leaving directory '/home/kali/Desktop/Stage0/musl-cross-make/build/local/x86_64-linux-musl'
make[1]: *** [Makefile:185: install] Error 2
make[1]: Leaving directory '/home/kali/Desktop/Stage0/musl-cross-make'
make: *** [Makefile:39: /home/kali/Desktop/Stage0/musl-cross-make/output/bin/x86_64-linux-musl-gcc] Error 2

This:

git clone https://github.com/richfelker/musl-cross-make.git -j`nproc`
fatal: destination path 'musl-cross-make' already exists and is not an empty directory.

suggests you didn't actually rm -rf it. I don't know what kind of stale tree state you have left around but presumably you deleted part but not all of the tree and cloning failed to get it back because of what was still there.

FYI there is no need or reason to wipe the mcm directory between builds for different targets. If you want (e.g. to rebuild same target you already built from scratch) you can wipe the build and optionally output directories for it. But if you're building a different target it will happily build alongside the existing one without deleting anything.