https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65632
Bug ID: 65632 Summary: gcc-4.8.4 fails to build native gcc for Gentoo/FreeBSD using crosscompiler on Gentoo/Linux Product: gcc Version: 4.8.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: bootstrap Assignee: unassigned at gcc dot gnu.org Reporter: dark_templar at hotbox dot ru I'm using Gentoo/Linux to crosscompile base system for Gentoo/FreeBSD. In the process I've hit two issues with gcc while building compiler for system with already built crosscompiler. First one is that gcc tries to use malloc.h while on FreeBSD it produces error using #error directive. Second one is that it produces is caused by using unavailable *_unlocked functions. I've made a workaround patch for problem one and found a patch for problem two. Errors: i686-gentoo-freebsd9.2-g++ -c -DGENERATOR_FILE -O2 -pipe -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -I. -I/usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/gcc -I/usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/gcc/. -I/usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/gcc/../include -I/usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/gcc/../libcpp/include -I/usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/gcc/../libdecnumber -I/usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/gcc/../libdecnumber/dpd -I../libdecnumber -I/usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/gcc/../libbacktrace /usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/ gcc-4.8.4/work/gcc-4.8.4/gcc/gengtype.c -o gengtype.o In file included from /usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/gcc/system.h:460:0, from /usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/gcc/gengtype.c:25: /usr/i686-gentoo-freebsd9.2/usr/include/malloc.h:3:2: error: #error "<malloc.h> has been replaced by <stdlib.h>" #error "<malloc.h> has been replaced by <stdlib.h>" ^ In file included from /usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/gcc/gengtype.c:25:0: /usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/gcc/gengtype.c: In function ‘void error_at_line(const fileloc*, const char*, ...)’: /usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/gcc/system.h:93:53: error: ‘fputc_unlocked’ was not declared in this scope # define fputc(C, Stream) fputc_unlocked (C, Stream) ^ /usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/gcc/gengtype.c:117:3: note: in expansion of macro ‘fputc’ fputc ('\n', stderr); ^ /usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/gcc/gengtype.c: In function ‘bool is_file_equal(outf_p)’: /usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/gcc/system.h:130:47: error: ‘fgetc_unlocked’ was not declared in this scope # define fgetc(Stream) fgetc_unlocked (Stream) ^ /usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/gcc/gengtype.c:2303:12: note: in expansion of macro ‘fgetc’ ch = fgetc (newfile); ^ /usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/gcc/gengtype.c: In function ‘void close_output_files()’: /usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/gcc/system.h:165:77: error: ‘fwrite_unlocked’ was not declared in this scope # define fwrite(Ptr, Size, N, Stream) fwrite_unlocked (Ptr, Size, N, Stream) ^ /usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/gcc/gengtype.c:2343:8: note: in expansion of macro ‘fwrite’ if (fwrite (of->buf, 1, of->bufused, newfile) != of->bufused) ^ Makefile:1070: recipe for target 'gengtype.o' failed gmake[2]: *** [gengtype.o] Error 1 gmake[2]: Leaving directory '/usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/build/gcc' Makefile:3906: recipe for target 'all-gcc' failed gmake[1]: *** [all-gcc] Error 2 gmake[1]: Leaving directory '/usr/i686-gentoo-freebsd9.2/tmp/portage/sys-devel/gcc-4.8.4/work/build' Makefile:854: recipe for target 'all' failed gmake: *** [all] Error 2 Bug in gentoo bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=545072