Shell Binutils 2.36 compilation fails due to sed/sh error

Code:
mv -f .deps/libz_a-uncompr.Tpo .deps/libz_a-uncompr.Po
gcc -DPACKAGE_NAME=\"zlib\" -DPACKAGE_TARNAME=\"zlib\" -DPACKAGE_VERSION=\"1.1.4\" -DPACKAGE_STRING=\"zlib\ 1.1.4\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"zlib\" -DVERSION=\"1.1.4\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_STDLIB_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_GETPAGESIZE=1 -DHAVE_MMAP=1 -DHAVE_MEMCPY=1 -DHAVE_STRERROR=1 -DHAVE_UNISTD_H=1 -I. -I../../binutils-2.36/zlib      -g -O2 -MT libz_a-zutil.o -MD -MP -MF .deps/libz_a-zutil.Tpo -c -o libz_a-zutil.o `test -f 'zutil.c' || echo '../../binutils-2.36/zlib/'`zutil.c
mv -f .deps/libz_a-zutil.Tpo .deps/libz_a-zutil.Po
rm -f libz.a
ar cru libz.a libz_a-adler32.o libz_a-compress.o  libz_a-crc32.o libz_a-deflate.o  libz_a-gzread.o libz_a-gzclose.o  libz_a-gzwrite.o libz_a-gzlib.o  libz_a-infback.o libz_a-inffast.o  libz_a-inflate.o libz_a-inftrees.o  libz_a-trees.o libz_a-uncompr.o  libz_a-zutil.o
ranlib libz.a
true "AR_FLAGS=rc"  "CC_FOR_BUILD=gcc"  "CFLAGS=-g -O2"  "CXXFLAGS=-g -O2"  "CFLAGS_FOR_BUILD=-g -O2"  "CFLAGS_FOR_TARGET=-g -O2"  "INSTALL=/usr/bin/install -c"  "INSTALL_DATA=/usr/bin/install -c -m 644"  "INSTALL_PROGRAM=/usr/bin/install -c"  "INSTALL_SCRIPT=/usr/bin/install -c"  "LDFLAGS="  "LIBCFLAGS=-g -O2"  "LIBCFLAGS_FOR_TARGET=-g -O2"  "MAKE=make"  "MAKEINFO=/home/hoshi/OSDev/binutils-2.36/missing makeinfo --split-size=5000000 --split-size=5000000 "  "PICFLAG="  "PICFLAG_FOR_TARGET="  "SHELL=/bin/sh"  "EXPECT=expect"  "RUNTEST=runtest"  "RUNTESTFLAGS="  "exec_prefix="  "infodir=/share/info"  "libdir=/lib"  "prefix="  "tooldir=/x86_64-unknown-freebsd13.0"  "AR=ar"  "AS=as"  "CC=gcc"  "CXX=g++"  "LD=/usr/local/bin/ld"  "LIBCFLAGS=-g -O2"  "NM=nm"  "PICFLAG="  "RANLIB=ranlib"  "DESTDIR=" DO=all multi-do # make
creating bfdver.h
/usr/local/bin/gsed -e s/NN/32/g <  > elf32-target.h
/bin/sh: Syntax error: redirection unexpected (expecting word)
*** Error code 2
Stop.
make[2]: stopped in /usr/home/hoshi/OSDev/build-binutils/bfd
*** Error code 1
Stop.
make[1]: stopped in /usr/home/hoshi/OSDev/build-binutils
*** Error code 1
Stop.
make: stopped in /usr/home/hoshi/OSDev/build-binutils

This is what I get under default FreeBSD 13.0 configuration, I tried changing shell to bash or using gsed but it didn't help, maybe I have something misconfigured.
I need to compile binutils and gcc for crosscompilation (I'm writing my own operating system).
What can I do to get this configured and compile binutils AND gcc correctly?

Flags:
Code:
../binutils-2.36/configure --target=$TARGET --prefix="$PREFIX" --disable-multilib --disable-nls --disable-werror;
 
There's no need to compile binutils or GCC from source. Just use the ports/packages.
 
Back
Top