openwrt / packages

Community maintained packages for OpenWrt. Documentation for submitting pull requests is in CONTRIBUTING.md
GNU General Public License v2.0
4.01k stars 3.48k forks source link

openblas: failed to build with ccache #16271

Closed 1715173329 closed 3 years ago

1715173329 commented 3 years ago

Maintainer: @commodo Environment: target: rockchip, host: ubuntu 20.04 x86_64

Description: An error occurred with ccache enabled:

touch /mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15/.prepared_383546e81b293a74c89507494dbcce09_6664517399ebbbc92a37c5bb081b5c53_check
. /mnt/openwrt-snapshot/include/shell.sh; gzip -dc /mnt/openwrt-snapshot/dl/OpenBLAS-0.3.15.tar.gz | tar -C /mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15/.. -xf -
[ ! -d ./src/ ] || cp -fpR ./src/. /mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15
touch /mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15/.prepared_383546e81b293a74c89507494dbcce09_6664517399ebbbc92a37c5bb081b5c53
rm -f /mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15/.configured_*
rm -f /mnt/openwrt-snapshot/staging_dir/target-aarch64_generic_musl/stamp/.openblas_installed
(cd /mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15/./; if [ -x ./configure ]; then find /mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15/ -name config.guess | xargs -r chmod u+w; find /mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15/ -name config.guess | xargs -r -n1 cp --remove-destination /mnt/openwrt-snapshot/scripts/config.guess; find /mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15/ -name config.sub | xargs -r chmod u+w; find /mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15/ -name config.sub | xargs -r -n1 cp --remove-destination /mnt/openwrt-snapshot/scripts/config.sub; AR="aarch64-openwrt-linux-musl-gcc-ar" AS="ccache_cc -c -Os -pipe -mcpu=generic -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -ffile-prefix-map=/mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15=OpenBLAS-0.3.15 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" LD=aarch64-openwrt-linux-musl-ld NM="aarch64-openwrt-linux-musl-gcc-nm" CC="ccache_cc" GCC="ccache_cc" CXX="ccache_cxx" RANLIB="aarch64-openwrt-linux-musl-gcc-ranlib" STRIP=aarch64-openwrt-linux-musl-strip OBJCOPY=aarch64-openwrt-linux-musl-objcopy OBJDUMP=aarch64-openwrt-linux-musl-objdump SIZE=aarch64-openwrt-linux-musl-size CFLAGS="-Os -pipe -mcpu=generic -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -ffile-prefix-map=/mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15=OpenBLAS-0.3.15 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro " CXXFLAGS="-Os -pipe -mcpu=generic -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -ffile-prefix-map=/mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15=OpenBLAS-0.3.15 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro " CPPFLAGS="-I/mnt/openwrt-snapshot/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/usr/include -I/mnt/openwrt-snapshot/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/include/fortify -I/mnt/openwrt-snapshot/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/include " LDFLAGS="-L/mnt/openwrt-snapshot/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/usr/lib -L/mnt/openwrt-snapshot/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/lib -znow -zrelro "   ./configure --target=aarch64-openwrt-linux --host=aarch64-openwrt-linux --build=x86_64-pc-linux-gnu --program-prefix="" --program-suffix="" --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls  ; fi; )
touch /mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15/.configured_68b329da9893e34099c7d8ad5cb9c940
rm -f /mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15/.built
touch /mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15/.built_check
CFLAGS="-Os -pipe -mcpu=generic -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -ffile-prefix-map=/mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15=OpenBLAS-0.3.15 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  -I/mnt/openwrt-snapshot/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/usr/include -I/mnt/openwrt-snapshot/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/include/fortify -I/mnt/openwrt-snapshot/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/include " CXXFLAGS="-Os -pipe -mcpu=generic -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -ffile-prefix-map=/mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15=OpenBLAS-0.3.15 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  -I/mnt/openwrt-snapshot/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/usr/include -I/mnt/openwrt-snapshot/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/include/fortify -I/mnt/openwrt-snapshot/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/include " LDFLAGS="-L/mnt/openwrt-snapshot/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/usr/lib -L/mnt/openwrt-snapshot/staging_dir/toolchain-aarch64_generic_gcc-8.4.0_musl/lib -znow -zrelro " make  -C /mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15/. AR="aarch64-openwrt-linux-musl-gcc-ar" AS="ccache_cc -c -Os -pipe -mcpu=generic -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -ffile-prefix-map=/mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15=OpenBLAS-0.3.15 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" LD=aarch64-openwrt-linux-musl-ld NM="aarch64-openwrt-linux-musl-gcc-nm" CC="ccache_cc" GCC="ccache_cc" CXX="ccache_cxx" RANLIB="aarch64-openwrt-linux-musl-gcc-ranlib" STRIP=aarch64-openwrt-linux-musl-strip OBJCOPY=aarch64-openwrt-linux-musl-objcopy OBJDUMP=aarch64-openwrt-linux-musl-objdump SIZE=aarch64-openwrt-linux-musl-size CROSS="aarch64-openwrt-linux-musl-" ARCH="aarch64" CROSS=1 HOSTCC=ccache gcc CROSS_SUFFIX=aarch64-openwrt-linux-musl- BINARY=64 NUM_THREADS=2 PREFIX=/usr COMMON_OPT="" TARGET=ARMV8 NOFORTRAN=1 ;
make[3]: Entering directory '/mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15'
ccache: invalid option -- 'D'
Usage:
    ccache [options]
    ccache compiler [compiler options]
    compiler [compiler options]          (via symbolic link)

Common options:
    -c, --cleanup              delete old files and recalculate size counters
                               (normally not needed as this is done
                               automatically)
    -C, --clear                clear the cache completely (except configuration)
        --config-path PATH     operate on configuration file PATH instead of the
                               default
    -d, --directory PATH       operate on cache directory PATH instead of the
                               default
        --evict-older-than AGE remove files older than AGE (unsigned integer
                               with a d (days) or s (seconds) suffix)
    -F, --max-files NUM        set maximum number of files in cache to NUM (use
                               0 for no limit)
    -M, --max-size SIZE        set maximum size of cache to SIZE (use 0 for no
                               limit); available suffixes: k, M, G, T (decimal)
                               and Ki, Mi, Gi, Ti (binary); default suffix: G
    -X, --recompress LEVEL     recompress the cache to level LEVEL (integer or
                               "uncompressed") using the Zstandard algorithm;
                               see "Cache compression" in the manual for details
    -o, --set-config KEY=VAL   set configuration item KEY to value VAL
    -x, --show-compression     show compression statistics
    -p, --show-config          show current configuration options in
                               human-readable format
    -s, --show-stats           show summary of configuration and statistics
                               counters in human-readable format
    -z, --zero-stats           zero statistics counters

    -h, --help                 print this help text
    -V, --version              print version and copyright information

Options for scripting or debugging:
        --checksum-file PATH   print the checksum (64 bit XXH3) of the file at
                               PATH
        --dump-manifest PATH   dump manifest file at PATH in text format
        --dump-result PATH     dump result file at PATH in text format
        --extract-result PATH  extract data stored in result file at PATH to the
                               current working directory
    -k, --get-config KEY       print the value of configuration key KEY
        --hash-file PATH       print the hash (160 bit BLAKE3) of the file at
                               PATH
        --print-stats          print statistics counter IDs and corresponding
                               values in machine-parsable format

See also the manual on <https://ccache.dev/documentation.html>.
make[3]: *** [Makefile.prebuild:70: getarch] Error 1
Makefile.system:255: Makefile.conf: No such file or directory
make[3]: *** No rule to make target 'Makefile.conf'.  Stop.
make[3]: Leaving directory '/mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15'
make[2]: *** [Makefile:109: /mnt/openwrt-snapshot/build_dir/target-aarch64_generic_musl/OpenBLAS-0.3.15/.built] Error 2
make[2]: Leaving directory '/mnt/openwrt-snapshot/feeds/packages/libs/openblas'
time: package/feeds/packages/openblas/compile#1.14#0.58#1.39
    ERROR: package/feeds/packages/openblas failed to build.
make[1]: *** [package/Makefile:116: package/feeds/packages/openblas/compile] Error 1
make[1]: Leaving directory '/mnt/openwrt-snapshot'
make: *** [/mnt/openwrt-snapshot/include/toplevel.mk:230: package/feeds/packages/openblas/compile] Error 2

My workaround is disabling ccache for HOSTCC:

diff --git a/libs/openblas/Makefile b/libs/openblas/Makefile
index 4fc8eb2a0..8cb2f8ab6 100644
--- a/libs/openblas/Makefile
+++ b/libs/openblas/Makefile
@@ -78,7 +78,7 @@ endif

 MAKE_FLAGS += \
    CROSS=1 \
-   HOSTCC=$(HOSTCC) \
+   HOSTCC=$(HOSTCC_NOCACHE) \
    CROSS_SUFFIX=$(TARGET_CROSS) \
    BINARY=$(OPENBLAS_BINARY) \
    NUM_THREADS=2 \
commodo commented 3 years ago

My workaround is disabling ccache for HOSTCC:

That may actually be the fix :p Thank you for confirming it works with ccache.

I need to updated OpenBLAS anyway this week. Will include this in the update.

1715173329 commented 3 years ago

I need to updated OpenBLAS anyway this week. Will include this in the update.

Okay, thank you so much!

commodo commented 3 years ago

opened https://github.com/openwrt/packages/pull/16276