flang icon indicating copy to clipboard operation
flang copied to clipboard

error: aliases are not supported on darwin

Open dnoan opened this issue 4 years ago • 7 comments

Hello, I am trying to build Flang on macOS 11 ('Apple Silicon') however I get error: aliases are not supported on darwin when compiling files mth_128defs.c and mth_vreturns.c. I use https://github.com/michalpasztamobica/classic-flang-llvm-project/tree/release_110 for LLVM. Ping @michalpasztamobica

Is there any way to workaround this issue?

dnoan avatar Jan 15 '21 09:01 dnoan

Hi @dnoan , the branch is not official and still under review, have you tried the official one: https://github.com/flang-compiler/classic-flang-llvm-project/tree/release_100?

michalpasztamobica avatar Jan 15 '21 10:01 michalpasztamobica

Hi @michalpasztamobica , yes, I have tried the official branch. See https://github.com/flang-compiler/flang/issues/958 There is no official working compiler on Apple Silicon yet so I will have to resort to beta/experimental toolchains for the time being.

dnoan avatar Jan 15 '21 10:01 dnoan

@dnoan , I am sorry, but I do not have an Apple platform to reproduce the issue. I was testing the builds on x86 architectures and they worked fine. If that helps you can send me the list of tools and versions you are using (CMake, make, gcc/clang compilers or anything else you can think of for comparison)

Unfortunately, at the moment we do not have the bandwidth to support Apple Silicon, but we will be very grateful for your contribution to the project if you manage to find the solution on your own.

michalpasztamobica avatar Jan 19 '21 10:01 michalpasztamobica

@michalpasztamobica , I use cmake-3.18.2 and GNU Make 3.81. C/C++ compiler is Apple clang version 12.0.0 which must be based on LLVM 10. There is no working GCC on the ARM version of macOS (otherwise I would use GFORTRAN).

I realize that the Flang project doesn't have infrastructure support for ARM macOS. Looking at one of the problematic files (mth_vreturns.c), it has the following code:

#if !defined(TARGET_OSX_X8664) && !defined(TARGET_WIN_X8664)
#if defined(TARGET_LINUX_ARM64)
/* some code that doesn't compile */
#endif
/* some code that doesn't compile */
#endif

This will be evaluated wrongly on Apple Silicon. The main Flang project seems to lack arm64 macOS support completely.

I understand that you don't have resources to support Apple Silicon. This is sad because Flang is the closest thing to a working Fortran compiler on Apple Silicon. LLVM Flang may take years to complete and it is not even clear if GCC will ever be supported on newer macOS versions.

dnoan avatar Jan 19 '21 13:01 dnoan

@dnoan - can you send me (or point me to) your build log for the math library? make -j1 VERBOSE=1 would be best.

d-parks avatar Jan 19 '21 15:01 d-parks

@d-parks , it seems that the build system detects macOS 11 + Apple Silicon as Linux x64:

[ 47%] Building C object lib/common/CMakeFiles/common.dir/mth_vreturns.c.o cd /Users/dnoan/fortran/flang/runtime/libpgmath/build/lib/common && /Users/dnoan/fortran/flang-11/bin/clang -DHOST_LINUX -DMAXCPUS=256 -DMAXCPUSL=8 -DMAXCPUSR=8 -DPG_PIC -DTARGET_64 -DTARGET_LINUX -DTARGET_LINUX_64 -DTARGET_LINUX_GENERIC -DTARGET_LLVM -DTARGET_LLVM_64 -DTARGET_LLVM_LINUX64 -I/Users/dnoan/fortran/flang/runtime/libpgmath/lib/common -I/Users/dnoan/fortran/flang/runtime/libpgmath/lib/generic -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -fPIC -O3 -ffp-contract=fast -o CMakeFiles/common.dir/mth_vreturns.c.o -c /Users/dnoan/fortran/flang/runtime/libpgmath/lib/common/mth_vreturns.c

dnoan avatar Jan 19 '21 16:01 dnoan

@dnoan - TARGET_LLVM_LINUX64 and TARGET_LINUX_64 are just the object preprocessor macros that say we're building for a 64-bit OS.

d-parks avatar Jan 19 '21 17:01 d-parks