Compiling OpenBLAS from source produces strange error message

Create issue
Issue #2400 resolved
Former user created an issue

Trying to compile OpenBLAS from the included tarball (0.2.19.a) produces a strange error message (gcc 9.3.1):

gcc -g -std=gnu99 -O2 -fopenmp -Wall -O2 -DMAX_STACK_ALLOC=2048 -Wall -m64 -DF_INTERFACE_GFORT -fPIC -DSMP_SERVER -DNO_WARMUP -DMAX_CPU_NUMBER=24 -DASMNAME= -DASMFNAME=_ -DNAME=_ -DCNAME= -DCHAR_NAME=\"_\" -DCHAR_CNAME=\"\" -DNO_AFFINITY -I.. -rdynamic -w -o linktest linktest.c ../libopenblas_nehalemp-r0.2.19.so -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../..  -lgfortran -lm -lquadmath -lm -lc  NAME=/data/rhaas/postdoc/gr/cactus/CactusAMReX/configs/amrex/lib/libthorn_OpenBLAS.a  && echo OK.
gcc: error: NAME=/data/rhaas/postdoc/gr/cactus/CactusAMReX/configs/amrex/lib/libthorn_OpenBLAS.a: No such file or directory
make[5]: *** [Makefile:134: ../libopenblas_nehalemp-r0.2.19.so] Error 1

As far as I can tell the incorrect string may (though I have no idea really) produced by c_check and in particular the line:

    $link = `$compiler_name -c ctest2.c -o ctest2.o 2>&1 && $compiler_name $openmp -v ctest2.o -o ctest2 2>&1 && rm -f ctest2.o ctest2 ctest2.exe`;

which sets $link to the output of gcc -v for a compiler call. Possibly this goes away when updating the tarball.

Comments (7)

  1. Roland Haas

    The NAME=... nonsense comes from gcc -v apparently outputting MAKEFLAGS=… which has NAME= in it. $linker is:

    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
    OFFLOAD_TARGET_NAMES=nvptx-none:hsa
    OFFLOAD_TARGET_DEFAULT=1
    Target: x86_64-linux-gnu
    Configured with: ../src/configure -v --with-pkgversion='Debian 9.3.0-13' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-F9gimE/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex
    Thread model: posix
    gcc version 9.3.0 (Debian 9.3.0-13)
    MAKEFLAGS=s -j12  -- TARGET= ONLY_CBLAS=0 TARGET_CORE= USE_OPENMP= BINARY= CFLAGS=-g\ -std=gnu99\ -O2\ -fopenmp\ -Wall HOST_CFLAGS=-march=native\ -DGEMM_MULTITHREAD_THRESHOLD=4\ -DNO_PARALLEL_MAKE=0 HOSTCC=gcc FC=gfortran CC=gcc USESTHORNS= THORN=OpenBLAS NAME=/data/rhaas/postdoc/gr/cactus/CactusAMReX/configs/amrex/lib/libthorn_OpenBLAS.a CONFIG=/data/rhaas/postdoc/gr/cactus/CactusAMReX/configs/amrex/config-data SRCDIR=/data/rhaas/postdoc/gr/cactus/CactusAMReX/arrangements/ExternalLibraries/OpenBLAS/src TOP=/data/rhaas/postdoc/gr/cactus/CactusAMReX/configs/amrex CCTK_HOME=/data/rhaas/postdoc/gr/cactus/CactusAMReX CCTK_TARGET=make.checked
    COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/
    LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/
    Reading specs from /usr/lib/gcc/x86_64-linux-gnu/9/libgomp.spec
    COLLECT_GCC_OPTIONS='-g' '-std=gnu99' '-O2' '-fopenmp' '-Wall' '-v' '-o' 'ctest2' '-mtune=generic' '-march=x86-64' '-pthread'
     /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/cc2KnInP.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -o ctest2 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o /usr/lib/gcc/x86_64-linux-gnu/9/crtoffloadbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. ctest2.o -lgomp -lgcc --push-state --as-needed -lgcc_s --pop-state -lpthread -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o /usr/lib/gcc/x86_64-linux-gnu/9/crtoffloadend.o
    COLLECT_GCC_OPTIONS='-g' '-std=gnu99' '-O2' '-fopenmp' '-Wall' '-v' '-o' 'ctest2' '-mtune=generic' '-march=x86-64' '-pthread'
    

  2. Roland Haas

    This fragment fixes the issue:

    Index: build.sh
    ===================================================================
    --- build.sh    (revision 235)
    +++ build.sh    (working copy)
    @@ -14,8 +14,8 @@
    
     # Set locations
     THORN=OpenBLAS
    -NAME=OpenBLAS-0.2.19
    -TARNAME=v0.2.19
    +NAME=OpenBLAS-0.3.9
    +TARNAME=v0.3.9
     SRCDIR="$(dirname $0)"
     BUILD_DIR=${SCRATCH_BUILD}/build/${THORN}
     if [ -z "${OPENBLAS_INSTALL_DIR}" ]; then
    @@ -33,6 +33,9 @@
     if echo '' ${ARFLAGS} | grep 64 > /dev/null 2>&1; then
         export OBJECT_MODE=64
     fi
    +# Keep only -j option in Makeflags but not Cactus' make variables (some confuse
    +# OpenBLAS's c_check script)
    +MAKEFLAGS=${MAKEFLAGS%% -- *}
    
     echo "OpenBLAS: Preparing directory structure..."
     cd ${SCRATCH_BUILD}
    

    by removing all Cactus build system make variables from MAKEFLAGS (but keeping eg -j for parallelism).

    Using gcc -v to learn about libraries that need to be linked against seems very wrong to me and modifying MAKEFLAGS is a poor way of working around this issue.

    To be applied after the release and code deep freeze (on May 28th) and backported, along with an update of the tarball to 0.3.9.

  3. Log in to comment