Skip to content

clang/flang-new compilation issues on Linux on loongarch64 #4907

@azuresky01

Description

@azuresky01

Hello,

@XiWeiGu When I try to build OpenBLAS with clang/flang-new on Debian sid, I found compilation failed with both gmake and cmake. See below.

System details: Loongson 3A6000 CPU, Debian sid, kernel 6.11.0, clang 18.1.8, flang-new 18.1.8 (or clang 19.1.0 and flang-new 19.1.0), cmake 3.30.3.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

gmake:

building command: CC=clang-18 FC=flang-new-18 make

result:

...
make[1]: Entering directory '/home/loongson/test/build_OpenBLAS/kernel'
make[1]: warning: -j8 forced in makefile: resetting jobserver mode.
clang-18 -c -O2 -DSMALL_MATRIX_OPT -DMAX_STACK_ALLOC=2048 -Wall -march=loongarch64 -mabi=lp64d -DF_INTERFACE_GFORT -fPIC -DSMP_SERVER -DNO_WARMUP -DMAX_CPU_NUMBER=8 -DMAX_PARALLEL_NUMBER=1 -DBUILD_SINGLE=1 -DBUILD_DOUBLE=1 -DBUILD_COMPLEX=1 -DBUILD_COMPLEX16=1 -DVERSION=\"0.3.28.dev\" -UASMNAME -UASMFNAME -UNAME -UCNAME -UCHAR_NAME -UCHAR_CNAME -DASMNAME=samax_k -DASMFNAME=samax_k_ -DNAME=samax_k_ -DCNAME=samax_k -DCHAR_NAME=\"samax_k_\" -DCHAR_CNAME=\"samax_k\" -DNO_AFFINITY -I.. -UDOUBLE  -UCOMPLEX -UCOMPLEX -UDOUBLE  -DUSE_ABS -UUSE_MIN ../kernel/loongarch64/amax_lasx.S -o samax_k.o
../kernel/loongarch64/amax_lasx.S:232:10: error: expected newline
    .end samax_k ; .section .note.GNU-stack,"",@progbits
         ^
make[1]: *** [Makefile.L1:556: samax_k.o] Error 1
make[1]: Leaving directory '/home/loongson/test/build_OpenBLAS/kernel'
make: *** [Makefile:199: libs] Error 1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

cmake:

building commands: CC=clang-18 FC=flang-new-18 cmake -B build and then cmake --build build

result:

[  0%] Building Fortran object CMakeFiles/LAPACK_OVERRIDES.dir/lapack-netlib/SRC/la_constants.f90.o
flang-new: error: unknown argument: '-mabi=lp64d'
flang-new: error: unknown argument: '-mabi=lp64d'
gmake[2]: *** [CMakeFiles/LAPACK_OVERRIDES.dir/build.make:5548: CMakeFiles/LAPACK_OVERRIDES.dir/lapack-netlib/SRC/la_constants.f90.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:378: CMakeFiles/LAPACK_OVERRIDES.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

if replace flang-new-18 with gfortran, the result is:

...
[ 77%] Building C object driver/others/CMakeFiles/driver_others.dir/parameter.c.o
[ 77%] Built target driver_others
[ 77%] Building C object kernel/CMakeFiles/kernel.dir/CMakeFiles/lsame.c.o
[ 77%] Building C object kernel/CMakeFiles/kernel.dir/CMakeFiles/scabs1.c.o
[ 77%] Building C object kernel/CMakeFiles/kernel.dir/CMakeFiles/dcabs1.c.o
[ 77%] Building ASM object kernel/CMakeFiles/kernel.dir/CMakeFiles/samax_k.S.o
/home/loongson/test/build_OpenBLAS/kernel/loongarch64/amax_lasx.S:232:10: error: expected newline
    .end samax_k ; .section .note.GNU-stack,"",@progbits
         ^
gmake[2]: *** [kernel/CMakeFiles/kernel.dir/build.make:117: kernel/CMakeFiles/kernel.dir/CMakeFiles/samax_k.S.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:594: kernel/CMakeFiles/kernel.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions