Re: cross compile dietlibc (on x86_64 for arm)
Giorgio Dal Molin <[email protected]> Wed, 24 Jan 2018 10:38:41 +0100 (CET)
| Newsgroups | gmane.linux.lib.dietlibc |
|---|---|
| Message-ID | <[email protected]> |
Hi, thank you for the answer, > On January 24, 2018 at 10:21 AM Felix von Leitner <[email protected]> wrote: > > > > I'm trying to cross compile dietlibc for arm: > > > # make ARCH=arm CROSS="arm-cortexa15-linux-gnueabihf-" EXTRACFLAGS="-O2 -Wall -march=armv7-a -mfloat-abi=hard -mfpu=neon-vfpv4 -mabi=aapcs-linux -mtune=cortex-a15 -fno-stack-protector -std=gnu99" all > > ... > > ... > > bin-x86_64/diet arm-cortexa15-linux-gnueabihf-gcc -D__dietlibc__ -pipe -nostdinc -D_REENTRANT -O2 -Wall -march=armv7-a -mfloat-abi=hard -mfpu=neon-vfpv4 -mabi=aapcs-linux -mtune=cortex-a15 -fno-stack-protector -std=gnu99 -O2 -fomit-frame-pointer -fstrict-aliasing -O0 -g -Wall -march=armv7-a -mfloat-abi=hard -mfpu=neon-vfpv4 -mabi=aapcs-linux -mtune=cortex-a15 -fno-stack-protector -std=gnu99 -W -Wall -Wextra -Wchar-subscripts -Wmissing-prototypes -Wmissing-declarations -Wno-switch -Wno-unused -Wredundant-decls -Wshadow -o bin-arm/elftrunc contrib/elftrunc.c > > make[4]: bin-x86_64/diet: Command not found > > make[4]: *** [Makefile:352: bin-arm/elftrunc] Error 127 > > > The failing make target is in the root Makefile: > > > ... > > $(OBJDIR)/elftrunc: $(OBJDIR)/diet contrib/elftrunc.c > > bin-$(MYARCH)/diet $(CCC) $(CFLAGS) -o $@ contrib/elftrunc.c > > ... > > > here $(OBJDIR)/elftrunc depends on $(OBJDIR)/diet but in the recipe bin-$(MYARCH)/diet > > is used. > > > Do I have to build the dietlibc src tree natively first and then cross ? > > Yes and no. > At this point the library itself has already been built. > So you can start cross-compiling dietlibc binaries with it. > > However, for convenience, you'd probably want to use the diet binary for > that, which you'd need in a version for the build host architecture to > run it. So I recommend building a native dietlibc, too, so you can use > its diet wrapper program. > Actually I already compile/install dietlibc natively before cross compiling it, say under the prefix '/tmp/my_prj/native/opt/diet'; the problem is I cannot use the 'diet' there because it is installed under the BINDIR '...opt/diet/bin' and not '.../opt/diet/bin-x86_64'. Anyway, this is just a little inconvenience as long as it's OK to build two different versions of the lib in the same tree. My current solution is: # make EXTRACFLAGS="-O2 -Wall -march=native" all # make ARCH=arm CROSS="arm-cortexa15-linux-gnueabihf-" EXTRACFLAGS="-O2 -Wall -march=armv7-a -mfloat-abi=hard -mfpu=neon-vfpv4 -mabi=aapcs-linux -mtune=cortex-a15 -fno-stack-protector -std=gnu99" all install