SDCC 4.5.0 is failing to build for me, with the following error:
...
echo timestamp > s-alltree
echo timestamp > s-omp-device-properties-h
echo timestamp > s-mlib
g++ -std=c++11 -c -DBASEVER="\"12.1.0\"" -DDATESTAMP="\"\"" -DREVISION="\"\"" -DDEVPHASE="\"\"" -DPKGVERSION="\"(GCC) \"" -DBUGURL="\"<http://sourceforge.net/
tracker/?atid=100599&group_id=599&func=browse>\"" -march=x86-64 -fPIC -DPIC -pipe -fPIC -Os -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-ta
bles -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-ove
rlength-strings -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I. -I./build -I./../include -I./../libcpp/include -I. -I. -I././support/util -I. \
-o build/genversion.o genversion.cc
as: line 114: exec: -I: invalid option
exec: usage: exec [-cl] [-a name] [command [argument ...]] [redirection ...]
genversion.cc:89:1: fatal error: error writing to -: Broken pipe
89 | }
| ^
compilation terminated.
make[3]: *** [Makefile:2420: build/genversion.o] Error 1
make[3]: *** Waiting for unfinished jobs....
/bin/sh ./../move-if-change tmp-optionlist optionlist
echo timestamp > s-options
make[3]: Leaving directory '/usr/src/sdcc-4.5.0/support/cpp/gcc'
make[2]: *** [Makefile:1531: all-gcc] Error 2
make[2]: Leaving directory '/usr/src/sdcc-4.5.0/support/cpp'
make[1]: *** [Makefile:917: all] Error 2
make[1]: Leaving directory '/usr/src/sdcc-4.5.0/support/cpp'
make: *** [Makefile:150: sdcc-libs] Error 2
The problem seems to be:
$ grep ^ORIGINAL_AS support/cpp/gcc/as
ORIGINAL_AS_FOR_TARGET=""
Flags passed to this subdir's buildsystem:
=== configuring in support/cpp (/usr/src/sdcc-4.5.0/support/cpp)
configure: running /bin/sh ./configure --disable-option-checking '--prefix=/usr' '--sysconfdir=/etc' '--localstatedir=/var' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--build=x86_64-pc-linux-musl' 'build_alias=x86_64-pc-linux-musl' 'CFLAGS=-march=x86-64 -fPIC -DPIC -pipe -fPIC -Os -std=gnu11 -Wno-unused' 'LDFLAGS=-s -Wl,-znoseparate-code -Wl,--as-needed' 'CPPFLAGS=' 'CXXFLAGS=-march=x86-64 -fPIC -DPIC -pipe -fPIC -Os' 'docdir=${datarootdir}/doc/${PACKAGE}' --cache-file=/dev/null --srcdir=.
Setting DEFAULT_ASSEMBLER allowed the build to succeed.
$ grep -n AS_FOR_TARGET support/cpp/configure.ac
94:m4_pattern_allow([^AS_FOR_TARGET$])dnl
3385:ACX_CHECK_INSTALLED_TARGET_TOOL(AS_FOR_TARGET, as)
3403:GCC_TARGET_TOOL(as, AS_FOR_TARGET, AS, [gas/as-new])
3443:COMPILER_AS_FOR_TARGET='$(AS_FOR_TARGET)'
3449: COMPILER_AS_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/as'
3456:AC_SUBST(COMPILER_AS_FOR_TARGET)
Likely the problem comes from ACX_CHECK_INSTALLED_TARGET_TOOL and possibly the specific build configuration.
Host, build and target are set to x86_64-pc-linux-musl.
@felixs is currently looking into rebasing sdcpp on cpp from the current upstream GCC release. I hope this issue can be solved during that, before the SDCC 4.6.0 release.