Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't update to version 0.6.32 on Mac M2 #189

Closed
juanfcocontreras opened this issue Jun 26, 2023 · 26 comments
Closed

Can't update to version 0.6.32 on Mac M2 #189

juanfcocontreras opened this issue Jun 26, 2023 · 26 comments

Comments

@juanfcocontreras
Copy link

Maybe the fix shown here could be also applicable?

https://bugzilla.mozilla.org/show_bug.cgi?id=1767947

Full trace:

> install.packages("digest")
Installing package into ‘/Users/pedro/.local/R_libs’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/digest_0.6.32.tar.gz'
Content type 'application/x-gzip' length 177411 bytes (173 KB)
==================================================
downloaded 173 KB

* installing *source* package ‘digest’ ...
** package ‘digest’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: ‘Apple clang version 14.0.3 (clang-1403.0.22.14.1)’
using C++ compiler: ‘Apple clang version 14.0.3 (clang-1403.0.22.14.1)’
using SDK: ‘MacOSX13.3.sdk’
clang++ -std=gnu++17 -I"/opt/homebrew/Cellar/r/4.3.1/lib/R/include" -DNDEBUG -I.  -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include    -fPIC  -g -O2  -c SpookyV2.cpp -o SpookyV2.o
clang -I"/opt/homebrew/Cellar/r/4.3.1/lib/R/include" -DNDEBUG -I.  -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include    -fPIC  -g -O2  -c aes.c -o aes.o
clang -I"/opt/homebrew/Cellar/r/4.3.1/lib/R/include" -DNDEBUG -I.  -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include    -fPIC  -g -O2  -c blake3.c -o blake3.o
clang -I"/opt/homebrew/Cellar/r/4.3.1/lib/R/include" -DNDEBUG -I.  -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include    -fPIC  -g -O2  -c blake3_dispatch.c -o blake3_dispatch.o
clang -I"/opt/homebrew/Cellar/r/4.3.1/lib/R/include" -DNDEBUG -I.  -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include    -fPIC  -g -O2  -c blake3_portable.c -o blake3_portable.o
clang -I"/opt/homebrew/Cellar/r/4.3.1/lib/R/include" -DNDEBUG -I.  -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include    -fPIC  -g -O2  -c crc32.c -o crc32.o
clang++ -std=gnu++17 -I"/opt/homebrew/Cellar/r/4.3.1/lib/R/include" -DNDEBUG -I.  -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include    -fPIC  -g -O2  -c crc32c.cpp -o crc32c.o
clang++ -std=gnu++17 -I"/opt/homebrew/Cellar/r/4.3.1/lib/R/include" -DNDEBUG -I.  -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include    -fPIC  -g -O2  -c crc32c_portable.cpp -o crc32c_portable.o
In file included from crc32c_portable.cpp:10:
In file included from ./crc32c/crc32c_prefetch.h:18:
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/xmmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
 ^
In file included from crc32c_portable.cpp:10:
In file included from ./crc32c/crc32c_prefetch.h:18:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/xmmintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
 ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:37:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
    __builtin_ia32_emms();
    ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:37:5: note: '__builtin_isless' declared here
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:37:25: error: too few arguments to function call, expected 2, have 0
    __builtin_ia32_emms();
    ~~~~~~~~~~~~~~~~~~~~^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:54:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:71:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
    return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
           ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:133:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:163:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
    return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:193:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
    return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:220:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
    return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:243:19: error: use of undeclared identifier '__builtin_ia32_punpckhwd'
    return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:264:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
    return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:291:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
    return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:314:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
    return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:335:19: error: use of undeclared identifier '__builtin_ia32_punpckldq'
    return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:356:19: error: use of undeclared identifier '__builtin_ia32_paddb'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:356:19: note: '__builtin_arm_addg' declared here
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:356:19: error: first argument of MTE builtin function must be a pointer ('__v8qi' (vector of 8 'char' values) invalid)
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^                    ~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:377:19: error: use of undeclared identifier '__builtin_ia32_paddw'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:356:19: note: '__builtin_arm_addg' declared here
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:377:19: error: first argument of MTE builtin function must be a pointer ('__v4hi' (vector of 4 'short' values) invalid)
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                  ^                    ~~~~~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [crc32c_portable.o] Error 1
ERROR: compilation failed for package ‘digest’
* removing ‘/Users/pedro/.local/R_libs/digest’
* restoring previous ‘/Users/pedro/.local/R_libs/digest’
Warning in install.packages :
  installation of package ‘digest’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/24/dq2wn8216jv17zwrzgsnxndw0000gn/T/Rtmp0m0pR7/downloaded_packages’
@eddelbuettel
Copy link
Owner

Hi there and thanks for quick feedback -- I haven't even had time to announce this release (on CRAN as of this morning). And yes, we added some new code from a supposedly known-good source (Google) but apparently M1/M2 bites. Shuckes as this is not part of the test matrix.

Now: did you try the suggested patch?

@eddelbuettel
Copy link
Owner

Looking at the bombing file crc32c_prefetch.h, and recognising that the crc32c implementation added to digest was meant to be portable (as I also added a new package crc32c with the full cmake logic to detect architectures I think the key is to just not #define HAVE_MM_PREFETCH as we then skip the whole block

#if HAVE_MM_PREFETCH

#if defined(_MSC_VER)
#include <intrin.h>
#else  // !defined(_MSC_VER)
#include <xmmintrin.h>
#endif  // defined(_MSC_VER)

#endif  // HAVE_MM_PREFETCH

If you have a moment you could help in testing a bug fix candidate. Else I can probably use the 'macbuilder' of the R Project as it is M1 based.

@eddelbuettel
Copy link
Owner

eddelbuettel commented Jun 27, 2023

I have a one-line fix for you:

modified   src/crc32c/crc32c_config.h
@@ -12,7 +12,7 @@
 #define HAVE_BUILTIN_PREFETCH 1
 
 // Define to 1 if targeting X86 and the compiler has the _mm_prefetch intrinsic.
-#define HAVE_MM_PREFETCH 1
+// #define HAVE_MM_PREFETCH 1
 
 // Define to 1 if targeting X86 and the compiler has the _mm_crc32_u{8,32,64}
 // intrinsics.

With the change (and version up'ed to a pre-release 0.6.32.1) it builds and checks at the M1-based Macbuilder (and I am including a copy as the machine will prune its logs), expand 'details' below to see.

* using log directory ‘/Volumes/PkgBuild/work/1687824174-887a9c3d54d59501/packages/big-sur-arm64/results/4.3/digest.Rcheck’
* using R version 4.3.0 Patched (2023-05-18 r84451)
* using platform: aarch64-apple-darwin20 (64-bit)
* R was compiled by
    Apple clang version 14.0.0 (clang-1400.0.29.202)
    GNU Fortran (GCC) 12.2.0
* running under: macOS Ventura 13.3.1
* using session charset: UTF-8
* checking for file ‘digest/DESCRIPTION’ ... OK
* this is package ‘digest’ version ‘0.6.32.1’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘digest’ can be installed ... [2s/3s] OK
* used C compiler: ‘Apple clang version 14.0.3 (clang-1403.0.22.14.1)’
* used C++ compiler: ‘Apple clang version 14.0.3 (clang-1403.0.22.14.1)’
* used SDK: ‘MacOSX11.3.sdk’
* checking installed package size ... OK
* checking package directory ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... [0s/0s] OK
* checking whether the package can be loaded with stated dependencies ... [0s/0s] OK
* checking whether the package can be unloaded cleanly ... [0s/0s] OK
* checking whether the namespace can be loaded with stated dependencies ... [0s/0s] OK
* checking whether the namespace can be unloaded cleanly ... [0s/0s] OK
* checking loading without being on the library search path ... [0s/0s] OK
* checking startup messages can be suppressed ... [0s/0s] OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... [1s/1s] OK
* checking Rd files ... [0s/0s] OK
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in shell scripts ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking line endings in Makefiles ... OK
* checking compilation flags in Makevars ... OK
* checking for GNU extensions in Makefiles ... OK
* checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK
* checking use of PKG_*FLAGS in Makefiles ... OK
* checking compiled code ... OK
* checking installed files from ‘inst/doc’ ... OK
* checking files in ‘vignettes’ ... OK
* checking examples ... [0s/0s] OK
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ... [0s/0s] OK
  Running ‘tinytest.R’ [0s/0s]
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in ‘inst/doc’ ... OK
* checking running R code from vignettes ... [0s/0s] OK
  ‘sha1.md’ using ‘UTF-8’... [0s/0s] OK
* checking re-building of vignette outputs ... [3s/3s] OK
* checking PDF version of manual ... [2s/2s] OK
* DONE
Status: OK
* using check arguments '--no-clean-on-error '

* elapsed time (check, wall clock): 0:20

@benz0li
Copy link

benz0li commented Jun 27, 2023

Not surprisingly, the same happens for linux/arm64/v8:

docker run --rm -ti glcr.b-data.ch/r/ver install2.r digest
Logs

trying URL 'https://cloud.r-project.org/src/contrib/digest_0.6.32.tar.gz'
Content type 'application/x-gzip' length 177411 bytes (173 KB)
==================================================
downloaded 173 KB

* installing *source* package ‘digest’ ...
** package ‘digest’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: ‘gcc (Debian 12.2.0-14) 12.2.0’
using C++ compiler: ‘g++ (Debian 12.2.0-14) 12.2.0’
g++ -std=gnu++17 -I"/usr/local/lib/R/include" -DNDEBUG -I.  -I/usr/local/include    -fPIC  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c SpookyV2.cpp -o SpookyV2.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I.  -I/usr/local/include    -fPIC  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c aes.c -o aes.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I.  -I/usr/local/include    -fPIC  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c blake3.c -o blake3.o
In file included from /usr/include/string.h:535,
                 from blake3.c:11:
In function ‘memcpy’,
    inlined from ‘compress_subtree_to_parent_node’ at blake3.c:357:5,
    inlined from ‘blake3_hasher_update.part.0’ at blake3.c:535:7:
/usr/include/aarch64-linux-gnu/bits/string_fortified.h:29:10: warning: ‘__builtin_memcpy’ reading 64 bytes from a region of size 32 [-Wstringop-overread]
   29 |   return __builtin___memcpy_chk (__dest, __src, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   30 |                                  __glibc_objsize0 (__dest));
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
blake3.c: In function ‘blake3_hasher_update.part.0’:
blake3.c:353:11: note: source object ‘out_array’ of size 32
  353 |   uint8_t out_array[MAX_SIMD_DEGREE_OR_2 * BLAKE3_OUT_LEN / 2];
      |           ^~~~~~~~~
In function ‘memcpy’,
    inlined from ‘compress_parents_parallel’ at blake3.c:244:5,
    inlined from ‘compress_subtree_to_parent_node’ at blake3.c:356:9,
    inlined from ‘blake3_hasher_update.part.0’ at blake3.c:535:7:
/usr/include/aarch64-linux-gnu/bits/string_fortified.h:29:10: warning: ‘__builtin_memcpy’ writing 32 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
   29 |   return __builtin___memcpy_chk (__dest, __src, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   30 |                                  __glibc_objsize0 (__dest));
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
blake3.c: In function ‘blake3_hasher_update.part.0’:
blake3.c:353:11: note: at offset 32 into destination object ‘out_array’ of size 32
  353 |   uint8_t out_array[MAX_SIMD_DEGREE_OR_2 * BLAKE3_OUT_LEN / 2];
      |           ^~~~~~~~~
In function ‘memcpy’,
    inlined from ‘compress_subtree_to_parent_node’ at blake3.c:357:5,
    inlined from ‘blake3_hasher_update.part.0’ at blake3.c:535:7:
/usr/include/aarch64-linux-gnu/bits/string_fortified.h:29:10: warning: ‘__builtin_memcpy’ reading 64 bytes from a region of size 32 [-Wstringop-overread]
   29 |   return __builtin___memcpy_chk (__dest, __src, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   30 |                                  __glibc_objsize0 (__dest));
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
blake3.c: In function ‘blake3_hasher_update.part.0’:
blake3.c:353:11: note: source object ‘out_array’ of size 32
  353 |   uint8_t out_array[MAX_SIMD_DEGREE_OR_2 * BLAKE3_OUT_LEN / 2];
      |           ^~~~~~~~~
In function ‘memcpy’,
    inlined from ‘compress_parents_parallel’ at blake3.c:244:5,
    inlined from ‘compress_subtree_to_parent_node’ at blake3.c:356:9,
    inlined from ‘blake3_hasher_update.part.0’ at blake3.c:535:7:
/usr/include/aarch64-linux-gnu/bits/string_fortified.h:29:10: warning: ‘__builtin_memcpy’ writing 32 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
   29 |   return __builtin___memcpy_chk (__dest, __src, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   30 |                                  __glibc_objsize0 (__dest));
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
blake3.c: In function ‘blake3_hasher_update.part.0’:
blake3.c:353:11: note: at offset 64 into destination object ‘out_array’ of size 32
  353 |   uint8_t out_array[MAX_SIMD_DEGREE_OR_2 * BLAKE3_OUT_LEN / 2];
      |           ^~~~~~~~~
In function ‘memcpy’,
    inlined from ‘compress_subtree_to_parent_node’ at blake3.c:357:5,
    inlined from ‘blake3_hasher_update.part.0’ at blake3.c:535:7:
/usr/include/aarch64-linux-gnu/bits/string_fortified.h:29:10: warning: ‘__builtin_memcpy’ reading 96 bytes from a region of size 32 [-Wstringop-overread]
   29 |   return __builtin___memcpy_chk (__dest, __src, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   30 |                                  __glibc_objsize0 (__dest));
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
blake3.c: In function ‘blake3_hasher_update.part.0’:
blake3.c:353:11: note: source object ‘out_array’ of size 32
  353 |   uint8_t out_array[MAX_SIMD_DEGREE_OR_2 * BLAKE3_OUT_LEN / 2];
      |           ^~~~~~~~~
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I.  -I/usr/local/include    -fPIC  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c blake3_dispatch.c -o blake3_dispatch.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I.  -I/usr/local/include    -fPIC  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c blake3_portable.c -o blake3_portable.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I.  -I/usr/local/include    -fPIC  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c crc32.c -o crc32.o
g++ -std=gnu++17 -I"/usr/local/lib/R/include" -DNDEBUG -I.  -I/usr/local/include    -fPIC  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c crc32c.cpp -o crc32c.o
g++ -std=gnu++17 -I"/usr/local/lib/R/include" -DNDEBUG -I.  -I/usr/local/include    -fPIC  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c crc32c_portable.cpp -o crc32c_portable.o
In file included from crc32c_portable.cpp:10:
crc32c/crc32c_prefetch.h:18:10: fatal error: xmmintrin.h: No such file or directory
   18 | #include <xmmintrin.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
make: *** [/usr/local/lib/R/etc/Makeconf:200: crc32c_portable.o] Error 1
ERROR: compilation failed for package ‘digest’
* removing ‘/usr/local/lib/R/site-library/digest’

The downloaded source packages are in
	‘/tmp/downloaded_packages’
Warning message:
In install.packages(pkgs, ...) :
  installation of package ‘digest’ had non-zero exit status

@ivanek
Copy link

ivanek commented Jun 27, 2023

This fixed it on M1 Mac.

─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.3.1 Patched (2023-06-26 r84601)
 os       macOS Ventura 13.4.1
 system   aarch64, darwin22.5.0
 ui       X11
 language (EN)
 collate  C
 ctype    en_US.UTF-8
 tz       Europe/Zurich
 date     2023-06-27
 pandoc   3.1.4 @ /opt/homebrew/bin/pandoc

─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package     * version date (UTC) lib source
 cli           3.6.1   2023-03-23 [1] CRAN (R 4.3.0)
 digest      * 0.6.32  2023-06-27 [1] local
 sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.3.0)

 [1] /Library/Frameworks/R.framework/Versions/4.3/Resources/library

I have a one-line fix for you:

modified   src/crc32c/crc32c_config.h
@@ -12,7 +12,7 @@
 #define HAVE_BUILTIN_PREFETCH 1
 
 // Define to 1 if targeting X86 and the compiler has the _mm_prefetch intrinsic.
-#define HAVE_MM_PREFETCH 1
+// #define HAVE_MM_PREFETCH 1
 
 // Define to 1 if targeting X86 and the compiler has the _mm_crc32_u{8,32,64}
 // intrinsics.

With the change (and version up'ed to a pre-release 0.6.32.1) it builds and checks at the M1-based Macbuilder (and I am including a copy as the machine will prune its logs), expand 'details' below to see.

@juanfcocontreras
Copy link
Author

This fixed it on M1 Mac.

Same here! I think you can close this issue.

Thank you very much!

@eddelbuettel
Copy link
Owner

Thanks for the confirmations. I also had good luck on the M1 build service.

I'll get a new version to CRAN in the next few days.

@eddelbuettel
Copy link
Owner

I'll get a new version to CRAN in the next few days.

I actually sent it late yesterday, but per the usual CRAN Incoming Dashboard it and by now a good 100 other packages are stuck in 'pre-test'. I am sure it will get uncorked in a due course but for now we are stuck.

The github (and r-universe) version works, and do the preceding versions.

@alecristia
Copy link

Thanks for this package & fix! I tried the recommended command in r-universe

install.packages('digest', repos = c('https://eddelbuettel.r-universe.dev', 'https://cloud.r-project.org'))
yields

Error in download.file(url, destfile, method, mode = "wb", ...) :
cannot open URL 'https://eddelbuettel.r-universe.dev/src/contrib/digest_0.6.32.1.tgz'
In addition: Warning message:
In download.file(url, destfile, method, mode = "wb", ...) :
cannot open URL 'https://eddelbuettel.r-universe.dev/src/contrib/digest_0.6.32.1.tgz': HTTP status was '404 Not Found'
Warning in download.packages(pkgs, destdir = tmpd, available = available, :
download of package ‘digest’ failed

I also tried installing older versions from gzip but got this error:
install.packages("~/Desktop/digest_0.6.31.tar.gz", repos = NULL, type = "source")

Installing package into ‘/Users/acristia/Documents/gitrepos/broad-strokes-lena/renv/library/R-4.3/aarch64-apple-darwin20’
(as ‘lib’ is unspecified)
Error in startsWith(contriburl, "file:") : non-character object(s)

And I can't install the github version because trying to install devtools requires digest.
I can try the hot fix given above if you could walk me through it?

Or I can totally be patient and wait for the release- in which case feel free to ignore this comment!

@eddelbuettel
Copy link
Owner

Could that be you / your network?

edd@rob:/tmp$ wget https://eddelbuettel.r-universe.dev/bin/macosx/contrib/4.3/digest_0.6.32.1.tgz
--2023-06-29 12:37:03--  https://eddelbuettel.r-universe.dev/bin/macosx/contrib/4.3/digest_0.6.32.1.tgz
Resolving eddelbuettel.r-universe.dev (eddelbuettel.r-universe.dev)... 2606:4700:3030::ac43:ac1a, 2606:4700:3033::6815:37b4, 172.67.172.26, ...
Connecting to eddelbuettel.r-universe.dev (eddelbuettel.r-universe.dev)|2606:4700:3030::ac43:ac1a|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://cdn.r-universe.dev/f9038448926268fd337670a5df55257f/digest_0.6.32.1.tgz [following]
--2023-06-29 12:37:03--  https://cdn.r-universe.dev/f9038448926268fd337670a5df55257f/digest_0.6.32.1.tgz
Resolving cdn.r-universe.dev (cdn.r-universe.dev)... 2606:4700:3033::6815:37b4, 2606:4700:3030::ac43:ac1a, 104.21.55.180, ...
Connecting to cdn.r-universe.dev (cdn.r-universe.dev)|2606:4700:3033::6815:37b4|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 205132 (200K) [application/x-gzip]
Saving to: ‘digest_0.6.32.1.tgz’

digest_0.6.32.1.tgz                                  100%[=====================================================================================================================>] 200.32K  --.-KB/s    in 0.02s   

2023-06-29 12:37:03 (9.68 MB/s) - ‘digest_0.6.32.1.tgz’ saved [205132/205132]

edd@rob:/tmp$ md5sum digest_0.6.32.1.tgz
f9038448926268fd337670a5df55257f  digest_0.6.32.1.tgz
edd@rob:/tmp$

That was the binary (and you may have to tell install.packages() you want one -- I am not a macOS user). Source works for me too:

edd@rob:/tmp$ wget https://eddelbuettel.r-universe.dev/src/contrib/digest_0.6.32.1.tar.gz
--2023-06-29 12:38:43--  https://eddelbuettel.r-universe.dev/src/contrib/digest_0.6.32.1.tar.gz
Resolving eddelbuettel.r-universe.dev (eddelbuettel.r-universe.dev)... 2606:4700:3033::6815:37b4, 2606:4700:3030::ac43:ac1a, 104.21.55.180, ...
Connecting to eddelbuettel.r-universe.dev (eddelbuettel.r-universe.dev)|2606:4700:3033::6815:37b4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://cdn.r-universe.dev/9e4b578071f00218c8dcc355f62b5a7a/digest_0.6.32.1.tar.gz [following]
--2023-06-29 12:38:44--  https://cdn.r-universe.dev/9e4b578071f00218c8dcc355f62b5a7a/digest_0.6.32.1.tar.gz
Resolving cdn.r-universe.dev (cdn.r-universe.dev)... 2606:4700:3033::6815:37b4, 2606:4700:3030::ac43:ac1a, 104.21.55.180, ...
Connecting to cdn.r-universe.dev (cdn.r-universe.dev)|2606:4700:3033::6815:37b4|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 325510 (318K) [application/x-gzip]
Saving to: ‘digest_0.6.32.1.tar.gz’

digest_0.6.32.1.tar.gz                               100%[=====================================================================================================================>] 317.88K  --.-KB/s    in 0.04s   

2023-06-29 12:38:44 (8.18 MB/s) - ‘digest_0.6.32.1.tar.gz’ saved [325510/325510]

edd@rob:/tmp$ md5sum digest_0.6.32.1.tar.gz 
9e4b578071f00218c8dcc355f62b5a7a  digest_0.6.32.1.tar.gz
edd@rob:/tmp$ ls -l digest_0.6.32.1.t*
-rw-rw-r-- 1 edd edd 325510 Jun 27 22:30 digest_0.6.32.1.tar.gz
-rw-rw-r-- 1 edd edd 205132 Jun 27 22:30 digest_0.6.32.1.tgz
edd@rob:/tmp$ 

Maybe check with folks around you if there is a known networking issue?

digest is being processed at CRAN so this should be resolved 'soon'. There is also the Archive section at CRAN to fetch the previous version.

[Minutes later]

But I see now that the GitHub website is laggy / down. Maybe it is them .... and it is best to try later.

@benz0li
Copy link

benz0li commented Jun 30, 2023

Current status:

waiting: the CRAN team is waiting for an answer from you, e.g. because issues are present that CRAN cannot automatically check for, such as maintainer changes (check your e-mail …)

@eddelbuettel
Copy link
Owner

eddelbuettel commented Jun 30, 2023

Yes. I responded half a day ago. Given the large-ish number of reverse depends, one sometimes gets false positives where something else blew up for an unrelated reason, or a new check tilts the comparison to before. I argued that that was the case here. We shall see once Europe gets up and to work, I am hopeful we will know more "soon".

@alecristia
Copy link

alecristia commented Jun 30, 2023

wget https://eddelbuettel.r-universe.dev/bin/macosx/contrib/4.3/digest_0.6.32.1.tgz

this worked for me:

  1. manually download tgz (for mac) from r-universe
  2. run within rstudio:
    install.packages("~/Desktop/digest_0.6.32.1.tgz", repos = NULL, type = .Platform$pkgType)

@shashanksinghnain
Copy link

shashanksinghnain commented Jul 2, 2023

wget https://eddelbuettel.r-universe.dev/bin/macosx/contrib/4.3/digest_0.6.32.1.tgz

this worked for me:

  1. manually download tgz (for mac) from r-universe
  2. run within rstudio:
    install.packages("~/Desktop/digest_0.6.32.1.tgz", repos = NULL, type = .Platform$pkgType)

Not working for me, I get the following error when I run a code which uses the package (M2 Mac Pro) --

(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

@eddelbuettel
Copy link
Owner

That is something you need to sort out with the R-universe site. The package installs fine from source so do

install.packages('digest', repos = c('https://eddelbuettel.r-universe.dev', 'https://cloud.r-project.org'), type="source")

@schlichtanders
Copy link

Running into this on Arm8 Ampere Altra. It seems CRAN has still the old version, right?
Anyone any estimation when the fix will arrive in CRAN?

@eddelbuettel
Copy link
Owner

eddelbuettel commented Jul 2, 2023

  1. For situations like this, CRAN as an Archive/ directory for every package. You can always go back to a working version.

  2. The answer to your second question is in this thread, and at CRAN. The package was uploaded. We are all waiting. Maybe if you ask them they will tell you, they have not told me.

  3. The most obvious answer to your problems is also here. The version in this very repo works, as does the (identical) version we have been talking about at length that you get via r-universe: It simply copies from here.

In other words the pending 0.6.33 at CRAN is identical to the 0.6.32.1 you find here or at r-universe -- apart from the update to DESCRIPTION (and then ChangeLog) as I just do not commit the version number change before acceptance at CRAN.

Lastly, I am truly sorry for the M1/M2/Arm64 breakage. That code was added and commited here months ago but clearly we a) could do with such hardware for tests at CI and/or b) it would be nice if those of you with access to such more exotic (to me) hardware tried the main branch here every now and then. We all would have known sooner 😿

@eddelbuettel
Copy link
Owner

eddelbuettel commented Jul 2, 2023

Current state of the world:

  1. Email from CRAN to me dated June 27: "Please correct before 2023-07-11 to safely retain your package on CRAN."

  2. Upload to CRAN dated June 28 after which they were 'effectively' closed for a day or two, they then ran reverse depends, sent me an email with two perfectly false positives to which I of course responded immediately -- and I have not heard since. I have sent two more email, they remain unanswered.

<sarcasm mode> At least we are guaranteed to find out one way or the other by June 11. </sarcasm mode>

benz0li added a commit to b-data/r-docker-stack that referenced this issue Jul 3, 2023
- digest: Installation fails on arm64 for v0.6.32
- eddelbuettel/digest#189
benz0li added a commit to b-data/jupyterlab-r-docker-stack that referenced this issue Jul 3, 2023
- digest: Installation fails on arm64 for v0.6.32
- eddelbuettel/digest#189
@eddelbuettel
Copy link
Owner

Word is that (at least part of) the delay is due to some hardware woes in Dortmund, but there may be a resolution tomorrow.

@Ashastry2

This comment was marked as duplicate.

@eddelbuettel

This comment was marked as duplicate.

@eddelbuettel
Copy link
Owner

Still nothing new. State of the world is that

  • CRAN email from June 27 that "fix by July 11 or else"
  • upload of new package on June 28, triggered email to which I replied, still shows state "waiting"

This is more than a little irritating but even with additional polite behind the scenes probe I have not heard anything. At this point I have to assume the package may be thrown off CRAN on July 11 despite a new version in incoming.

@eddelbuettel
Copy link
Owner

Always lovely to see:

Thanks, on its way to CRAN.

Of course, standard (presumably scripted) form reply without any hint as to why this took nine days.

@schlichtanders

This comment was marked as off-topic.

@juanfcocontreras
Copy link
Author

CRAN version 0.6.33 installed here without any issue :-)

@eddelbuettel
Copy link
Owner

CRAN version 0.6.33 installed here without any issue :-)

Given that it only exists in source right now at CRAN and no binaries are listed , you must have installed from source, and I hope you are aware that you have done so any of the last seven or eight days by using this repo, or r-universe, or the CRAN Archive links....

I had planned to keep this open til the binaries are built but there is really no point, and the M1 builder for macOS had been consistently slower than those for Windows or x86_64 macOS so I am changing my and will close this as completed now.

Sorry for the all the "pain and suffering". It was an honest mistake / oversight committed in March here and available for early bird testers since then. The fix was a one-liner but sadly this time the passage was little delayed. All good now, so ... onwards!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants