mailing list of musl libc
 help / color / mirror / code / Atom feed
From: argante <argante@pm.me>
To: "musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: using musl-cross-make to build host gcc
Date: Sun, 11 Nov 2018 11:11:44 +0000	[thread overview]
Message-ID: <Ghc1lapwtTIKZ0vS6bU2wBSDGgnpLX7SeaQAjSwacmqD-WYT1qHqoo4V2XkTco0KlfEMo11dK4EbFIilTuyN_A==@pm.me> (raw)

Hi,

I would like to compile gcc for my host using musl-cross-make. I copied statically linked tools (cp, mv, sed etc. + musl, zlib) to the new dir (system layout) and, of course musl-cross. Then chroot to dir and built necessary libraries (gmp, mpc, mpfr). I installed new libraries in /usr/local/{include,lib} and also copied them (.so and headers) in to cross/x86_64-linux-musl/{include,lib}. Then I built binutils, which I also installed in /usr/local.

I used all musl-cross-make patches for gcc. The compilation went without any problems. I installed gcc in /usr/local and removed the cross gcc.

After all I could compile binutils and libraries using the new compiler. Unfortunately, the compilation of gcc itself ends with a strange error.


checking how to run the C preprocessor... x86_64-linux-musl-gcc -E
checking for inline... inline
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking size of void *... 0
checking size of short... 0
checking size of int... 0
checking size of long... 0
checking for long long... yes
checking size of long long... configure: error: in `/tmp/ports/gcc/work/gcc-7.3.0/host-x86_64-linux-musl/gcc':
configure: error: cannot compute sizeof (long long)
See `config.log' for more details.
make[2]: *** [configure-stage1-gcc] Error 77
make[2]: Leaving directory `/tmp/ports/gcc/work/gcc-7.3.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/tmp/ports/gcc/work/gcc-7.3.0'
make: *** [all] Error 2


cannot compute sizeof (long long)???

# cat test.c
#include <stdio.h>
#include <stdint.h>

int main()
{

	printf("sizeof(char):		%d\n", sizeof(char));
	printf("sizeof(short):		%d\n", sizeof(short));
	printf("sizeof(int):		%d\n", sizeof(int));
	printf("sizeof(long long):	%d\n", sizeof(long long));
	printf("sizeof(int64_t):		%d\n", sizeof(int64_t));
	printf("sizeof(void *):		%d\n", sizeof(void *));

	return 0;
}
# ./a.out
sizeof(char):		1
sizeof(short):		2
sizeof(int):		4
sizeof(long long):	8
sizeof(int64_t):		8
sizeof(void *):		8



And my steps:

	patch 0001-ssp_nonshared.diff
	patch 0002-posix_memalign.diff
	patch 0003-cilkrts.diff
	patch 0004-libatomic-test-fix.diff
	patch 0005-libgomp-test-fix.diff
	patch 0006-libitm-test-fix.diff
	patch 0007-libvtv-test-fix.diff
	patch 0008-Revert-PR-driver-81523-Make-static-override-pie.diff
	patch 0009-Revert-RS6000-linux-startfile-endfile.diff
	patch 0010-static-pie-support.diff
	patch 0011-j2.diff
	patch 0012-s390x-muslldso.diff
	patch 0013-microblaze-pr65649.diff
	patch 0014-ldbl128-config.diff
	patch 0015-m68k.diff
	patch 0016-invalid_tls_model.diff

	for i in getcwd strtoul clock strncasecmp fnmatch waitpid basename \
		strchr snprintf rindex index memcpy mempcpy strcasecmp strsignal \
		vsprintf strndup bcmp tmpnam bzero stpncpy memchr insque ffs \
		vfork memmove stpcpy bsearch copysign strtod vsnprintf strncmp \
		strtol bcopy rename strstr strerror putenv strdup memset memcmp \
		vprintf calloc gettimeofday atexit getpagesize strverscmp random \
		setenv strrchr asprintf msdos vasprintf vfprintf getopt getopt1; do
		rm -f libiberty/${i}.c
		touch libiberty/${i}.c
	done

	# Prevent libffi from being installed
	sed -i -e 's/\(install.*:\) install-.*recursive/\1/' "${S}"/libffi/Makefile.in
	sed -i -e 's/\(install-data-am:\).*/\1/' "${S}"/libffi/include/Makefile.in

	config_arch_flags=
	config_arch_target_cflags=
	config_arch_target_ldflags=
	export libat_cv_have_ifunc=no

	./configure \
		CFLAGS="-g0 -Os" \
		CXXFLAGS="-g0 -Os" \
		LDFLAGS="-s" \
		--enable-languages=c,c++ \
		--disable-nls \
		--disable-multilib \
		--disable-werror \
		--prefix=/usr/local \
		--enable-tls \
		--disable-libmudflap \
		--disable-libsanitizer \
		--disable-gnu-indirect-function \
		--disable-libmpx \
		--enable-deterministic-archives \
		--enable-libstdcxx-time \
		--host=x86_64-linux-musl \
		--build=x86_64-linux-musl \
		--disable-libgomp \
		--enable-bootstrap

and make...


Any idea about what I'm doing wrong?

Best regards




             reply	other threads:[~2018-11-11 11:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-11 11:11 argante [this message]
2018-11-11 14:13 ` Markus Wichmann
2018-11-11 14:23   ` argante
2018-11-11 19:39     ` argante
2018-11-11 19:46     ` Michael Forney
2018-11-11 20:00       ` argante
2018-11-11 21:13         ` Michael Forney
2018-11-11 21:39           ` argante

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='Ghc1lapwtTIKZ0vS6bU2wBSDGgnpLX7SeaQAjSwacmqD-WYT1qHqoo4V2XkTco0KlfEMo11dK4EbFIilTuyN_A==@pm.me' \
    --to=argante@pm.me \
    --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).