You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to compile a program written in Fortran through xmake using GFortran provided by homebrew (package gcc, version of gfortran 14.1.0) gives the following error:
The problem is the -m32 flag. Forcing x86_64 architecture avoids the problem.
The problem seems to be (at least in part) in toolchains/gfortran/xmake.lua, which only recognizes "x86_64", and "x64", while I think the native Apple architecture should be internally recognized as arm64.
I tried to create an alternate toolchain by copying the content of xmake.lua and adding "arm64" to have: local march = toolchain:is_arch("x86_64", "x64", "arm64") and "-m64" or "-m32"
The -m64 compilation flag was then added but it seems that some other process still added -m32, so both flags ended up being present and the compilation failed.
Note: compiling the source file above hello.f90 simply with gfortran hello.f90 or gfortran -m64 hello.f90 gives no error.
Looking at the gcc toolchain for comparison, this problem may affect other build processes, since "arm64" was not present there too.
The text was updated successfully, but these errors were encountered:
Xmake Version
2.9.1
Operating System Version and Architecture
macOS Sonoma 14.4.1, Apple M3 Pro
Describe Bug
Trying to compile a program written in Fortran through xmake using GFortran provided by homebrew (package gcc, version of gfortran 14.1.0) gives the following error:
Expected Behavior
Compilation runs smoothly.
Project Configuration
Fortran source file (
hello.f90
)xmake.lua:
commands:
Additional Information and Error Logs
The problem is the
-m32
flag. Forcingx86_64
architecture avoids the problem.The problem seems to be (at least in part) in
toolchains/gfortran/xmake.lua
, which only recognizes "x86_64", and "x64", while I think the native Apple architecture should be internally recognized asarm64
.I tried to create an alternate toolchain by copying the content of xmake.lua and adding "arm64" to have:
local march = toolchain:is_arch("x86_64", "x64", "arm64") and "-m64" or "-m32"
The
-m64
compilation flag was then added but it seems that some other process still added-m32
, so both flags ended up being present and the compilation failed.Note: compiling the source file above
hello.f90
simply withgfortran hello.f90
orgfortran -m64 hello.f90
gives no error.Looking at the gcc toolchain for comparison, this problem may affect other build processes, since "arm64" was not present there too.
The text was updated successfully, but these errors were encountered: