Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sun, 11 Nov 2018 11:11:44 +0000
From: argante <argante@...me>
To: "musl@...ts.openwall.com" <musl@...ts.openwall.com>
Subject: using musl-cross-make to build host gcc

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


Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.