William Lock Posted May 17, 2021 Report Share Posted May 17, 2021 Managed to run SystemC on new Apple M1 silicon, following are the steps 1. modify configure file, add the following code highlighted in red # check CPU architecture case ${target_cpu} in #( x86_64|amd64) : TARGET_ARCH="${TARGET_ARCH}64" CPU_ARCH="x86_64" QT_ARCH="x86_64" ;; #( x*86|i*86) : CPU_ARCH="i386" QT_ARCH="iX86" ;; #( powerpc64) : TARGET_ARCH="${TARGET_ARCH}ppc64" CPU_ARCH="ppc64" QT_ARCH="pthreads" ;; #( powerpc) : TARGET_ARCH="${TARGET_ARCH}ppc" CPU_ARCH="ppc" QT_ARCH="powerpc-apple-macosx" ;; #( arm) : TARGET_ARCH="${TARGET_ARCH}arm" CPU_ARCH="arm64" QT_ARCH="pthreads" ;; #( *) : as_fn_error $? "\"sorry...architecture not supported\"" "$LINENO" 5 ;; 2. install g++ using homebrew brew install gcc 3. setting CXX and point to the homebrew g++-11 in step 2, run configure export CXX=g++-11 ./configure 4. make all 5. make check I would like to encourage others to share their experience of porting systemC to this new mac silicon. Canny, maehne and danciac 3 Quote Link to comment Share on other sites More sharing options...
David Black Posted May 18, 2021 Report Share Posted May 18, 2021 Have you tried the cmake approach? mkdir build; cd build; cmake ..; make; make install Quote Link to comment Share on other sites More sharing options...
William Lock Posted May 18, 2021 Author Report Share Posted May 18, 2021 Hi David, I did not have much luck with cmake approach. William Quote Link to comment Share on other sites More sharing options...
danciac Posted June 6, 2021 Report Share Posted June 6, 2021 Thanks William for this, worked as a charm for me. I've made similar changes to the configure for SystemC AMS and succeeded in building it too. Too bad a google search on build systemc apple m1 doesn't point to this, would have saved me some time. Quote Link to comment Share on other sites More sharing options...
maehne Posted June 7, 2021 Report Share Posted June 7, 2021 Thanks @William Lock, for sharing your experience of building SystemC on macOS for the Apple M1 architecture. I opened an issue on the LWG’s internal tracker to update our build scripts so that it will work out of the box in the future. Shashank V M and David Black 1 1 Quote Link to comment Share on other sites More sharing options...
Michael Lebert Posted June 26, 2021 Report Share Posted June 26, 2021 Hi William, When I open the configure.ac file it does not look like in your example (at least not if I open it with TextEdit on Mac) # check CPU architecture AS_CASE([${target_cpu}], dnl [x86_64|amd64], dnl [TARGET_ARCH="${TARGET_ARCH}64" CPU_ARCH="x86_64" QT_ARCH="x86_64"], [x*86|i*86], dnl [CPU_ARCH="i386" QT_ARCH="iX86"], [powerpc64], dnl [TARGET_ARCH="${TARGET_ARCH}ppc64" CPU_ARCH="ppc64" QT_ARCH="pthreads"], [powerpc], dnl [TARGET_ARCH="${TARGET_ARCH}ppc" CPU_ARCH="ppc" QT_ARCH="powerpc-apple-macosx"], [AC_MSG_ERROR("sorry...architecture not supported")]) So trying to translate from your example I ended up with something that looks like below # check CPU architecture AS_CASE([${target_cpu}], dnl [x86_64|amd64], dnl [TARGET_ARCH="${TARGET_ARCH}64" CPU_ARCH="x86_64" QT_ARCH="x86_64"], [x*86|i*86], dnl [CPU_ARCH="i386" QT_ARCH="iX86"], [powerpc64], dnl [TARGET_ARCH="${TARGET_ARCH}ppc64" CPU_ARCH="ppc64" QT_ARCH="pthreads"], [powerpc], dnl [TARGET_ARCH="${TARGET_ARCH}ppc" CPU_ARCH="ppc" QT_ARCH="powerpc-apple-macosx"], [arm], dnl [TARGET_ARCH="${TARGET_ARCH}arm" CPU_ARCH="arm64" QT_ARCH="pthreads"], [AC_MSG_ERROR("sorry...architecture not supported")]) but hen running ./configure I always end up with "sorry...architecture not supported".... so something I apparently do wrong but I can't understand what. below what happens when I run ./configure: michaellebert@Michaels-Mini systemc-2.3.3 % ./configure checking build system type... arm-apple-darwin20.5.0 checking host system type... arm-apple-darwin20.5.0 checking target system type... arm-apple-darwin20.5.0 checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe 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 we are using the GNU C++ compiler... yes checking whether g++-11 accepts -g... yes checking for style of include used by make... GNU checking dependency style of g++-11... gcc3 checking whether we are using a Clang/LLVM C++ compiler... no checking for gcc... g++-11 checking whether we are using the GNU C compiler... yes checking whether g++-11 accepts -g... yes checking for g++-11 option to accept ISO C89... unsupported checking whether g++-11 understands -c and -o together... yes checking dependency style of g++-11... gcc3 checking whether we are using a Clang/LLVM C compiler... no checking for ar... ar checking the archiver (ar) interface... ar checking dependency style of g++-11... gcc3 checking whether ln -s works... yes configure: error: "sorry...architecture not supported" michaellebert@Michaels-Mini systemc-2.3.3 % BR//Michael Lebert Quote Link to comment Share on other sites More sharing options...
maehne Posted June 28, 2021 Report Share Posted June 28, 2021 You should not edit the configure file directly, but rather the file configure.ac. After that, you'll have to run the config/bootstrap to regenerate the build system. For this to work, you'll have to install GNU libtool, GNU automake, and GNU autoconf, e.g., through MacPorts. Quote Link to comment Share on other sites More sharing options...
Canny Posted October 15, 2021 Report Share Posted October 15, 2021 Hi @William Lock and all, Thanks for your instruction and I am able to build it on my macbook pro m1. However, I encounter problem with "make check" as all tests are failed. I also tried running the test in examples separately and it also failed with fault "zsh: segmentation fault ./simple_async". Do you know anything about it? Quote Link to comment Share on other sites More sharing options...
Canny Posted October 16, 2021 Report Share Posted October 16, 2021 I managed to fix the problem. The root cause sem_init in sc_host_semaphore is deprecated in macOS Big Sur. So use sem_open instead will fix it. Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted October 16, 2021 Report Share Posted October 16, 2021 A better solution is to compile for C++11 (or later) instead, where sem_* APIs are not required. David Black and maehne 2 Quote Link to comment Share on other sites More sharing options...
William Lock Posted January 13, 2022 Author Report Share Posted January 13, 2022 Hi all, @David Black during the past winter break, I managed to get cmake to work on M1. I will share CMakeLists.txt. As @Philipp A Hartmann also pointed out earlier, CMAKE_CXX_STANDARD is required to set to 11 or above. CMakeLists.txt Quote Link to comment Share on other sites More sharing options...
Leonidas Posted March 13, 2022 Report Share Posted March 13, 2022 Hi all, I have followed your instructions by modifying the configure file to install systemC and make check passes all tests. However, I am somewhat of a beginner when it comes to CMake and was wondering if anyone could provide a basic CMakeLists.txt file I could use for a basic hello world program. I have tried multiple ways and I always either get a linker problem where the library is not found or a segmentation error when executing the executable. Nevertheless, thank you for your amazing help on tackling this issue. Best regards, Leo CMakeLists.txt Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.