Menu

#3517 SDCC does not build from source on ARM Macs

closed-fixed
Felix
None
Build
5
2023-05-30
2022-11-06
Free-PDK
No

SDCC does not build on ARM MACs anymore since the "support/gcc" complains about a missing target config: "*** Configuration aarch64-apple-darwin21.6.0 not supported".

Unfortunately disabling sdcpp seems to not work either since sdcc nowadays just calls sdcpp to compile everything. Is this intentional? Otherwise this project could be renamed to "sdcpp-gcc" then when in fact there is not sdcc compiler anymore which does not work without gcc?

Related

Wiki: SDCC 4.3.0 Release

Discussion

  • Benedikt Freisen

    SDCC has been using the GNU preprocessor for a very long time, but the version was updated from 4.6.3 to 12.1.0 recently.
    The lack of support for ARM Macs is definitely not intentional, but rather the result of a lack of suitable test systems.
    Can you provide the entire console output for analysis?

     
  • Free-PDK

    Free-PDK - 2022-11-06

    Ok, I understand that gcc is used for the preprocessor, but there is a "configure" option for SDCC which let's one disable sdcpp: "--disable-sdcpp". If you try to do this then compilation will not work and the resulting sdcc is broken since it relies on "sdcpp" which is called for various reasons. The "support/cpp/gcc" directory in sdcc source looks like the gcc is for "C++" support... but it seems it is mandatory for normal sdcc as well (the preprocess step?).

    The actual problem: The "configure" step in "support/cpp/gcc" fails (last line of output shows problem):

    % ./configure 
    checking build system type... aarch64-apple-darwin21.6.0
    checking host system type... aarch64-apple-darwin21.6.0
    checking target system type... aarch64-apple-darwin21.6.0
    checking LIBRARY_PATH variable... ok
    checking GCC_EXEC_PREFIX variable... ok
    checking whether to place generated files in the source directory... no
    checking whether a default linker was specified... no
    checking whether a default dsymutil was specified... no
    checking whether a default assembler was specified... no
    checking for gcc... gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables... 
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking for g++... g++
    checking whether we are using the GNU C++ compiler... yes
    checking whether g++ accepts -g... yes
    checking how to run the C++ preprocessor... g++ -E
    checking for grep that handles long lines and -e... /usr/bin/grep
    checking for egrep... /usr/bin/grep -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking minix/config.h usability... no
    checking minix/config.h presence... no
    checking for minix/config.h... no
    checking whether it is safe to define __EXTENSIONS__... yes
    checking how to run the C preprocessor... 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 ino_t... 8
    checking size of dev_t... 4
    checking size of void *... 8
    checking size of short... 2
    checking size of int... 4
    checking size of long... 8
    checking for long long... yes
    checking size of long long... 8
    checking for int8_t... yes
    checking for int16_t... yes
    checking for int32_t... yes
    checking for int64_t... yes
    checking for unsigned long long int... yes
    checking for long long int... yes
    checking for intmax_t... yes
    checking for intptr_t... yes
    checking for uint8_t... yes
    checking for uint16_t... yes
    checking for uint32_t... yes
    checking for uint64_t... yes
    checking for uintmax_t... yes
    checking for uintptr_t... yes
    checking for int64_t underlying type... long long
    checking for std::swap in <utility>... yes
    checking whether g++ is affected by placement new aliasing bug... yes
    checking whether g++ supports -W... yes
    checking whether g++ supports -Wall... yes
    checking whether g++ supports -Wnarrowing... yes
    checking whether g++ supports -Wwrite-strings... yes
    checking whether g++ supports -Wcast-qual... yes
    checking whether gcc supports -Wstrict-prototypes... yes
    checking whether gcc supports -Wmissing-prototypes... yes
    checking whether g++ supports -Wmissing-format-attribute... yes
    checking whether g++ supports -Woverloaded-virtual... yes
    checking whether gcc supports -Wold-style-definition... yes
    checking whether gcc supports -Wc++-compat... yes
    checking whether g++ supports -pedantic -Wlong-long -Wvariadic-macros -Woverlength-strings... yes
    checking whether gcc supports -fno-exceptions... yes
    checking whether gcc supports -fno-rtti... yes
    checking whether gcc supports -fasynchronous-unwind-tables... yes
    checking valgrind.h usability... no
    checking valgrind.h presence... no
    checking for valgrind.h... no
    checking for VALGRIND_DISCARD in <valgrind/memcheck.h>... no
    checking for VALGRIND_DISCARD in <memcheck.h>... no
    checking for multiarch configuration... auto
    configure: WARNING: decimal float is not supported for this target, ignored
    configure: WARNING: fixed-point is not supported for this target, ignored
    checking whether make sets $(MAKE)... yes
    checking for gawk... no
    checking for mawk... no
    checking for nawk... no
    checking for awk... awk
    checking whether ln -s works... yes
    checking whether ln works... yes
    checking for ranlib... ranlib
    checking for a BSD compatible install... /usr/bin/install -c
    checking for cmp's capabilities... gnucompare
    checking for mktemp... yes
    checking for makeinfo... makeinfo
    checking for modern makeinfo... yes
    checking for recent Pod::Man... yes
    checking for flex... flex
    checking for bison... bison
    checking for nm... nm
    checking for ar... ar
    checking for sphinx-build... texinfo
    checking for ANSI C header files... (cached) yes
    checking whether time.h and sys/time.h may both be included... yes
    checking whether string.h and strings.h may both be included... yes
    checking for sys/wait.h that is POSIX.1 compatible... yes
    checking whether termios.h defines TIOCGWINSZ... yes
    checking for limits.h... yes
    checking for stddef.h... yes
    checking for string.h... (cached) yes
    checking for strings.h... (cached) yes
    checking for stdlib.h... (cached) yes
    checking for time.h... yes
    checking for iconv.h... yes
    checking for fcntl.h... yes
    checking for ftw.h... yes
    checking for unistd.h... (cached) yes
    checking for sys/file.h... yes
    checking for sys/time.h... yes
    checking for sys/mman.h... yes
    checking for sys/resource.h... yes
    checking for sys/param.h... yes
    checking for sys/times.h... yes
    checking for sys/stat.h... (cached) yes
    checking for sys/locking.h... no
    checking for direct.h... no
    checking for malloc.h... no
    checking for langinfo.h... yes
    checking for ldfcn.h... no
    checking for locale.h... yes
    checking for wchar.h... yes
    checking for thread.h... no
    checking for pthread.h... yes
    checking for CHAR_BIT... yes
    checking whether byte ordering is bigendian... no
    checking how to run the C++ preprocessor... g++ -E
    checking for unordered_map... yes
    checking for tr1/unordered_map... no
    checking for ext/hash_map... yes
    checking dependency style of g++... gcc3
    checking for collect2 libraries... none required
    checking for library containing exc_resume... no
    checking for library containing kstat_open... no
    checking for library containing gethostbyname... none required
    checking for library containing socket... none required
    checking for library containing ldexp... none required
    checking for library containing dlopen... none required
    checking for inttypes.h... yes
    checking for zstd.h... no
    checking for library containing ZSTD_compress... no
    checking for times... yes
    checking for clock... yes
    checking for kill... yes
    checking for getrlimit... yes
    checking for setrlimit... yes
    checking for atoq... no
    checking for popen... yes
    checking for sysconf... yes
    checking for strsignal... yes
    checking for getrusage... yes
    checking for nl_langinfo... yes
    checking for gettimeofday... yes
    checking for mbstowcs... yes
    checking for wcswidth... yes
    checking for mmap... yes
    checking for posix_fallocate... no
    checking for setlocale... yes
    checking for clearerr_unlocked... yes
    checking for feof_unlocked... yes
    checking for ferror_unlocked... yes
    checking for fflush_unlocked... no
    checking for fgetc_unlocked... no
    checking for fgets_unlocked... no
    checking for fileno_unlocked... yes
    checking for fprintf_unlocked... no
    checking for fputc_unlocked... no
    checking for fputs_unlocked... no
    checking for fread_unlocked... no
    checking for fwrite_unlocked... no
    checking for getchar_unlocked... yes
    checking for getc_unlocked... yes
    checking for putchar_unlocked... yes
    checking for putc_unlocked... yes
    checking for madvise... yes
    checking for mallinfo... no
    checking for mallinfo2... no
    checking for fstatat... yes
    checking whether mbstowcs works... yes
    checking for ssize_t... yes
    checking for caddr_t... yes
    checking for sighander_t... no
    checking for sys/mman.h... (cached) yes
    checking for mmap... (cached) yes
    checking whether read-only mmap of a plain file works... yes
    checking whether mmap from /dev/zero works... no
    checking for MAP_ANON(YMOUS)... yes
    checking whether mmap with MAP_ANON(YMOUS) works... yes
    checking for pid_t... yes
    checking for vfork.h... no
    checking for fork... yes
    checking for vfork... yes
    checking for working fork... yes
    checking for working vfork... (cached) yes
    checking for ld used by GCC... /Applications/Xcode_14.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
    checking if the linker (/Applications/Xcode_14.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
    checking for shared library run path origin... done
    checking for iconv... yes
    checking how to link with libiconv... -liconv
    checking for iconv declaration... 
             extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
    checking for LC_MESSAGES... yes
    checking for nl_langinfo and CODESET... yes
    checking whether basename is declared... no
    checking whether strstr is declared... yes
    checking whether getenv is declared... yes
    checking whether atol is declared... yes
    checking whether atoll is declared... yes
    checking whether asprintf is declared... yes
    checking whether sbrk is declared... yes
    checking whether abort is declared... yes
    checking whether atof is declared... yes
    checking whether getcwd is declared... yes
    checking whether getwd is declared... yes
    checking whether madvise is declared... yes
    checking whether stpcpy is declared... yes
    checking whether strnlen is declared... yes
    checking whether strsignal is declared... yes
    checking whether strverscmp is declared... no
    checking whether strtol is declared... yes
    checking whether strtoul is declared... yes
    checking whether strtoll is declared... yes
    checking whether strtoull is declared... yes
    checking whether setenv is declared... yes
    checking whether unsetenv is declared... yes
    checking whether errno is declared... yes
    checking whether snprintf is declared... yes
    checking whether vsnprintf is declared... yes
    checking whether vasprintf is declared... yes
    checking whether malloc is declared... yes
    checking whether realloc is declared... yes
    checking whether calloc is declared... yes
    checking whether free is declared... yes
    checking whether getopt is declared... yes
    checking whether clock is declared... yes
    checking whether getpagesize is declared... yes
    checking whether ffs is declared... yes
    checking whether clearerr_unlocked is declared... yes
    checking whether feof_unlocked is declared... yes
    checking whether ferror_unlocked is declared... yes
    checking whether fflush_unlocked is declared... no
    checking whether fgetc_unlocked is declared... no
    checking whether fgets_unlocked is declared... no
    checking whether fileno_unlocked is declared... yes
    checking whether fprintf_unlocked is declared... no
    checking whether fputc_unlocked is declared... no
    checking whether fputs_unlocked is declared... no
    checking whether fread_unlocked is declared... no
    checking whether fwrite_unlocked is declared... no
    checking whether getchar_unlocked is declared... yes
    checking whether getc_unlocked is declared... yes
    checking whether putchar_unlocked is declared... yes
    checking whether putc_unlocked is declared... yes
    checking whether getrlimit is declared... yes
    checking whether setrlimit is declared... yes
    checking whether getrusage is declared... yes
    checking whether mallinfo is declared... no
    checking whether mallinfo2 is declared... no
    checking whether ldgetname is declared... no
    checking whether times is declared... yes
    checking whether sigaltstack is declared... yes
    checking for struct tms... yes
    checking for clock_t... yes
    checking for F_SETLKW... yes
    checking for O_CLOEXEC... yes
    checking for AF_UNIX... yes
    checking for AF_INET6... yes
    checking for _LK_LOCK... no
    checking if mkdir takes one argument... no
    *** Configuration aarch64-apple-darwin21.6.0 not supported
    

    In fact there is a GCC branch (not in main) which adds support for newer hardware / architectures like "aarch64" and "apple-darwin"

     
    • Benedikt Freisen

      Ok, I understand that gcc is used for the preprocessor, but there is a "configure" option for SDCC which let's one disable sdcpp: "--disable-sdcpp". If you try to do this then compilation will not work and the resulting sdcc is broken since it relies on "sdcpp" which is called for various reasons. The "support/cpp/gcc" directory in sdcc source looks like the gcc is for "C++" support... but it seems it is mandatory for normal sdcc as well (the preprocess step?).

      The support/cpp/gcc folder contains GCC's (C) (P)re-(P)rocessor. SDCC has no preprocessor without it.

      In fact there is a GCC branch (not in main) which adds support for newer hardware / architectures like "aarch64" and "apple-darwin"

      Thanks! That means that it can be added to SDCC sooner or later.

       
      • Philipp Klaus Krause

        In fact there is a GCC branch (not in main) which adds support for newer hardware / architectures like "aarch64" and "apple-darwin"

        Thanks! That means that it can be added to SDCC sooner or later.

        Though it seems quite inelegant that SDCC requires its host architectures to be supported by cpp first. After all, we use cpp to target other architectures only.

         
        • Benedikt Freisen

          Maybe that check is actually for a full GCC build for which the target architecture obviously has to be supported explicitly unless you build a cross-compiler.
          If that is the case, simply removing the check could solve the problem.

           
          • Free-PDK

            Free-PDK - 2022-11-07

            Great idea...
            I disabled the "exit 1" after the error message in file "support/cpp/gcc/config.gcc" line 3592:

            *)
                    echo "*** Configuration ${target} not supported" 1>&2
            #        exit 1
                    ;;
            esac
            

            Besides a few error messages from gcc's configure the compilation of sdcc worked without a problem:

            Error messages (which can be ignored):

            *** Configuration aarch64-apple-darwin21.6.0 not supported
            grep: ./config/aarch64/aarch64-cores.def: No such file or directory
            clang: error: no such file or directory: './config/aarch64/aarch64-option-extensions.def'
            clang: error: no input files
            grep: ./config/aarch64/aarch64-arches.def: No such file or directory
            grep: ./config/aarch64/aarch64-arches.def: No such file or directory
            clang: error: no such file or directory: './config/aarch64/aarch64-option-extensions.def'
            clang: error: no input files
            grep: ./config/aarch64/aarch64-cores.def: No such file or directory
            clang: error: no such file or directory: './config/aarch64/aarch64-option-extensions.def'
            clang: error: no input files
            

            After having a deeper look at configure.gcc I can see that there is some aarch64 and darwin support inside, but it looks like it is incomplete...

            Side note: The resulting SDCC reports itself as a MacOS PPC version (should be AArch64 or ARM):

            % sdcc --version
            SDCC : pdk13/pdk14/pdk15 4.2.9 #13745 (Mac OS X ppc)
            published under GNU General Public License (GPL)
            
             

            Last edit: Free-PDK 2022-11-07
  • Erik Petrich

    Erik Petrich - 2022-11-08

    I see the snapshots for actual MacOS PPC seem to be failing in the same way:

    *** Configuration powerpc-apple-macosx not supported
    
     
  • Philipp Klaus Krause

    What is particularly worrying about this bug is that it likely will make the build fail for future unknown host systems. So if we have this bug in a release that makes it into distros, and a dsitro sticks with the version for a while, we'll see the sdcc packages fail to build for that distro when the distro adds future architectures.
    This would also become a big problem without any distro involved: Some users prefer to stick to fixed, known-good-for-their-code SDCC versions, and there is always the risk of us at some point int he future not having the manpower to keep regular releases going (and this bug will be a constant drain on manpower if it requires maintenance for every future architecture).
    I'll add this bug to the pre-4.3.0 todo list.

     
  • Felix

    Felix - 2023-05-30
    • status: open --> closed-fixed
    • assigned_to: Felix
     
  • Felix

    Felix - 2023-05-30

    This is fixed in [r13746], ignoring "unsupported target" as discussed above.

     

    Related

    Commit: [r13746]


Log in to post a comment.

MongoDB Logo MongoDB