Jump to content

Running SystemC on new Apple M1 silicon


William Lock
 Share

Recommended Posts

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. 

Link to comment
Share on other sites

  • 3 weeks later...

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.

Link to comment
Share on other sites

  • 3 weeks later...

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 3 months later...

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?

Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...