accellera-official / systemc

SystemC Reference Implementation
https://systemc.org/overview/systemc/
Apache License 2.0
476 stars 152 forks source link

configure error on Mac M1/Ventura #36

Closed JetForMe closed 1 year ago

JetForMe commented 1 year ago

I just tried building, following the instructions in INSTALL.md. I get "sorry...architecture not supported". This is with Xcode 14.1 on macOS 13.0.1 on M1 (ARM).

24408 16:15: systemc/ (master) $ config/bootstrap 
configure.ac:110: installing 'config/ar-lib'
configure.ac:95: installing 'config/compile'
configure.ac:59: installing 'config/install-sh'
configure.ac:59: installing 'config/missing'
examples/sysc/Makefile.am: installing 'config/depcomp'
parallel-tests: installing 'config/test-driver'
configure.ac:58: warning: The macro `AC_CANONICAL_SYSTEM' is obsolete.
configure.ac:58: You should run autoupdate.
./lib/autoconf/general.m4:2081: AC_CANONICAL_SYSTEM is expanded from...
configure.ac:58: the top level
configure.ac:270: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
configure.ac:270: You should run autoupdate.
aclocal.m4:122: AC_PROG_LIBTOOL is expanded from...
configure.ac:270: the top level
configure.ac:565: warning: AC_OUTPUT should be used without arguments.
configure.ac:565: You should run autoupdate.
24409 16:15: systemc/ (master) $ autoupdate
24410 16:15: systemc/ (master) $ config/bootstrap 
configure.ac:90: installing 'config/compile'
configure.ac:54: installing 'config/missing'
examples/sysc/Makefile.am: installing 'config/depcomp'
24410 16:15: objdir/ (master) $ ../configure --prefix=/usr/local/systemc
checking build system type... arm-apple-darwin22.1.0
checking host system type... arm-apple-darwin22.1.0
checking target system type... arm-apple-darwin22.1.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... ../config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking how to create a pax tar archive... gnutar
checking whether make supports nested variables... (cached) yes
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 the compiler supports GNU C++... yes
checking whether clang++ accepts -g... yes
checking for clang++ option to enable C++11 features... none needed
checking whether make supports the include directive... yes (GNU style)
checking dependency style of clang++... gcc3
checking whether we are using a Clang/LLVM C++ compiler... yes
checking for gcc... clang++
checking whether the compiler supports GNU C... yes
checking whether clang++ accepts -g... yes
checking for clang++ option to enable C11 features... unsupported
checking for clang++ option to enable C99 features... unsupported
checking for clang++ option to enable C89 features... unsupported
checking whether clang++ understands -c and -o together... yes
checking dependency style of clang++... gcc3
checking whether we are using a Clang/LLVM C compiler... yes
checking for ar... ar
checking the archiver (ar) interface... ar
checking dependency style of clang++... gcc3
checking whether ln -s works... yes
configure: error: "sorry...architecture not supported"

The same result came from brew install --build-from-source systemc.

lanphon commented 1 year ago

Would you please have a try to build it with CMake instead of config/bootstrap? On my M1 Air systemc could work well with camke building framework, after setting the CMAKE_CXX_STANDARD to 17.

JetForMe commented 1 year ago

mkdir build && cd build && cmake .. && make seemed to build things successfully. I’m not really sure how to use SystemC yet, so I cd'd into build/examples/sysc/risc_cpu, ran make and executed the resulting binary. I tried risc_cpu and simple_fifo, and both output "Segmentation fault: 11" upon execution.

lanphon commented 1 year ago

Please first update the top CMakeLists.txt, updating the CMAKE_CXX_STANDARD to 17. The error of "Segmentation fault: 11" should disappear, since this is a known bug of systemc on macOS already.

JetForMe commented 1 year ago

Ah, thank you, that fixed the seg fault. Now I get this output, is this correct?

$ ./simple_fifo 

        SystemC 2.3.4_pub_rev_20191203-Accellera --- Dec  6 2022 03:33:56
        Copyright (c) 1996-2019 by all Contributors,
        ALL RIGHTS RESERVED

V<9>isit www<1>.a<9>ccellera<1>.o<9>rg and s<1>ee<9> what Sy<1>st<9>emC can <1>do<9> for you<1> today!<1>
lanphon commented 1 year ago

that should be OK, congratulations for you.

JetForMe commented 1 year ago

Thanks for the help! Perhaps the INSTALL.md document should be updated to recommend Cmake.