Bug 251425

Summary: textproc/ripgrep: Fails to build after lang/rust is updated to 1.48.0
Product: Ports & Packages Reporter: Tomoaki AOKI <junchoon>
Component: Individual Port(s)Assignee: Tobias Kortkamp <tobik>
Status: Closed FIXED    
Severity: Affects Only Me CC: 0mp, fullermd, mikael, petteri.valkonen, rust, swills, val
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
v1 none

Description Tomoaki AOKI 2020-11-27 14:07:04 UTC
textproc/ripgrep fails to build after lang/rust is updated to 1.48.0 at r556157.

Possibly related upstream issue is:

 https://github.com/BurntSushi/ripgrep/issues/1721

I've not yet tried the fix as I'm not at all familiar with rust.


Error messages are as below, snipping non-error outputs.

(snip)

   Compiling pcre2-sys v0.2.2
     Running `/usr/local/bin/rustc --crate-name build_script_build --edition=2018 /usr/ports/textproc/ripgrep/work/ripgrep-12.1.1/cargo-crates/pcre2-sys-0.2.2/build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=1 -C debug-assertions=off -C metadata=5ac12e5c2575cc82 -C extra-filename=-5ac12e5c2575cc82 --out-dir /usr/ports/textproc/ripgrep/work/target/release/build/pcre2-sys-5ac12e5c2575cc82 -L dependency=/usr/ports/textproc/ripgrep/work/target/release/deps --extern cc=/usr/ports/textproc/ripgrep/work/target/release/deps/libcc-794259eeff679901.rlib --extern pkg_config=/usr/ports/textproc/ripgrep/work/target/release/deps/libpkg_config-2cc270ed08bc617c.rlib --cap-lints allow -C target-cpu=haswell -C linker=cc -C link-arg=-fstack-protector-strong`
error[E0432]: unresolved import `crate::arch::x86_64::_mm_shuffle_pi8`
   --> /usr/ports/textproc/ripgrep/work/ripgrep-12.1.1/cargo-crates/packed_simd-0.3.3/src/codegen/shuffle1_dyn.rs:40:29
    |
40  |                         use crate::arch::x86_64::_mm_shuffle_pi8;
    |                             ^^^^^^^^^^^^^^^^^^^^^---------------
    |                             |                    |
    |                             |                    help: a similar name exists in the module: `_mm_shuffle_epi8`
    |                             no `_mm_shuffle_pi8` in `arch::x86_64`
...
297 | impl_shuffle1_dyn!(u8x8);
    | ------------------------- in this macro invocation
    |
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

     Running `/usr/local/bin/rustc --crate-name syn --edition=2018 /usr/ports/textproc/ripgrep/work/ripgrep-12.1.1/cargo-crates/syn-1.0.27/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=1 -C debug-assertions=off --cfg 'feature="clone-impls"' --cfg 'feature="default"' --cfg 'feature="derive"' --cfg 'feature="parsing"' --cfg 'feature="printing"' --cfg 'feature="proc-macro"' --cfg 'feature="quote"' --cfg 'feature="visit"' -C metadata=1d84ce7a27c0212b -C extra-filename=-1d84ce7a27c0212b --out-dir /usr/ports/textproc/ripgrep/work/target/release/deps -L dependency=/usr/ports/textproc/ripgrep/work/target/release/deps --extern proc_macro2=/usr/ports/textproc/ripgrep/work/target/release/deps/libproc_macro2-f960ca3ec6cdbb5d.rmeta --extern quote=/usr/ports/textproc/ripgrep/work/target/release/deps/libquote-667a0513151f8a57.rmeta --extern unicode_xid=/usr/ports/textproc/ripgrep/work/target/release/deps/libunicode_xid-2af6ac20f60027f9.rmeta --cap-lints allow -C target-cpu=haswell -C linker=cc -C link-arg=-fstack-protector-strong --cfg syn_disable_nightly_tests`

(snip)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: could not compile `packed_simd`

Caused by:
  process didn't exit successfully: `/usr/local/bin/rustc --crate-name packed_simd --edition=2018 /usr/ports/textproc/ripgrep/work/ripgrep-12.1.1/cargo-crates/packed_simd-0.3.3/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C debuginfo=1 --cfg 'feature="default"' --cfg 'feature="into_bits"' -C metadata=2e67c87c411d5629 -C extra-filename=-2e67c87c411d5629 --out-dir /usr/ports/textproc/ripgrep/work/target/release/deps -L dependency=/usr/ports/textproc/ripgrep/work/target/release/deps --extern cfg_if=/usr/ports/textproc/ripgrep/work/target/release/deps/libcfg_if-9d423cf02dc8de6b.rmeta --cap-lints allow -C target-cpu=haswell -C linker=cc -C link-arg=-fstack-protector-strong` (exit code: 1)
warning: build failed, waiting for other jobs to finish...
error: build failed
** Command failed (exit code 1): env MAKE_JOBS_NUMBER_LIMIT=12 make DISABLE_VULNERABILITIES=yes UPGRADE_TOOL=pkg_replace UPGRADE_PORT=ripgrep-12.1.1_6 UPGRADE_PORT_VER=12.1.1_6
** Fix the problem and try again.
Comment 1 Mikael Urankar freebsd_committer freebsd_triage 2020-11-27 14:12:06 UTC
do you have anything in make.conf?
Comment 2 Tomoaki AOKI 2020-11-28 07:11:19 UTC
(In reply to Mikael Urankar from comment #1)

Yes. As below, stripping commented out settings.
But textproc/ripgrep was built successfully before lang/rust 1.48.0 with these settings.


# Disable all debugging functionality on malloc for head.
MALLOC_PRODUCTION=yes

## Some ports wants KERNCONF defined to build.
## So define here instead of src.conf.
KERNCONF?=TEST15

WITH_NEW_MESA=yes
TEX_DEFAULT=  texlive

.if !${.CURDIR:M/usr/src/sys/boot*}
CPUTYPE?=	haswell
.endif

OPTIONS_SET=   I18N NLS CJK JAPANESE NVIDIA NVIDIA_GL GTK2 MMX SSE SSE2 SSE3 SSSE3 SSE4 SSE4.1 SSE4.2 AVX SIMD OPTIMIZED_FLAGS OPTIMIZED_CFLAGS WITH_NEW_XORG

OPTIONS_UNSET= NOUVEAU

.if ${.CURDIR:M/usr/ports/games/rubix}
  CPUTYPE=	core
.endif

.if ${.CURDIR:M/usr/ports/lang/gcc}
   CPUTYPE=	sandybridge
.endif


# Begin portconf settings
# Do not touch these lines
.if !empty(.CURDIR:M/usr/ports*) && exists(/usr/local/libexec/portconf)
_PORTCONF!=/usr/local/libexec/portconf
.for i in ${_PORTCONF:S/|/ /g}
${i:S/%/ /g}
.endfor
.endif
# End portconf settings

DEFAULT_VERSIONS+=	ssl=base
DEFAULT_VERSIONS+=	bdb=5
DEFAULT_VERSIONS+=	linux=c7

# Set preferred java version
JAVA_PREFERRED_PORTS=JAVA_PORT_NATIVE_OPENJDK_JDK_1_8
Comment 3 Tomoaki AOKI 2020-11-28 07:20:05 UTC
One thing to note.
This seems to be the same issue as bug 251356, but it was focused on firefox only and fixed on firefox, not rust. So I newly opened this PR.
Comment 4 Mikael Urankar freebsd_committer freebsd_triage 2020-11-28 09:33:51 UTC
Created attachment 220040 [details]
v1

Can you test this patch?
Comment 5 fullermd 2020-11-29 00:51:51 UTC
https://github.com/BurntSushi/ripgrep/commit/3ef63dacbed48e9c569722059922f37964a9494e

is the upstream commit that would wind up being the fix in the next release, if that would be better to use as a patch base.
Comment 6 Tomoaki AOKI 2020-11-29 02:11:56 UTC
(In reply to Mikael Urankar from comment #4)

Confirmed fixed both on stable/12 (amd64) at r368123 and on head (amd64) at r368125.

Thanks!
Comment 7 Tomoaki AOKI 2020-11-29 02:17:59 UTC
(In reply to fullermd from comment #5)

Yes, it would be better, if there's any difference.
I'm currently not enough familiar both with git(hub) and rust to check.

But anyway, the patch would be removed once new version containing upstream fix is released and ports gets updated. So this fix should be better than nothing, unless new upstream version would be released shortly enough.
Comment 8 Mikael Urankar freebsd_committer freebsd_triage 2020-11-29 16:26:58 UTC
(In reply to fullermd from comment #5)
it depends on other commits and it'll be very tedious to use this particular commit.
Comment 9 Mikael Urankar freebsd_committer freebsd_triage 2020-12-06 14:58:57 UTC
*** Bug 251590 has been marked as a duplicate of this bug. ***
Comment 10 Mateusz Piotrowski freebsd_committer freebsd_triage 2021-04-17 20:41:48 UTC
ripgrep seems to build fine now. I'm closing this PR for now.
Comment 11 Tomoaki AOKI 2021-04-18 00:37:19 UTC
Reopen.

Still fails without the patch at least on commit below.
  git <src> <139576030ff3> stable/13, amd64
  git <ports> <26faf5597798>
Comment 12 commit-hook freebsd_committer freebsd_triage 2021-06-14 20:52:01 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=db2cab46a53e97833b2368cd4ee04e792a5c72f4

commit db2cab46a53e97833b2368cd4ee04e792a5c72f4
Author:     Tobias Kortkamp <tobik@FreeBSD.org>
AuthorDate: 2021-06-13 12:38:06 +0000
Commit:     Tobias Kortkamp <tobik@FreeBSD.org>
CommitDate: 2021-06-14 20:51:05 +0000

    textproc/ripgrep: Unbreak with CPUTYPE=haswell and rust>=1.48.0

    error[E0432]: unresolved import `crate::arch::x86_64::_mm_shuffle_pi8`
       --> /usr/ports/textproc/ripgrep/work/ripgrep-12.1.1/cargo-crates/packed_simd-0.3.3/src/codegen/shuffle1_dyn.rs:40:29
        |
    40  |                         use crate::arch::x86_64::_mm_shuffle_pi8;
        |                             ^^^^^^^^^^^^^^^^^^^^^---------------
        |                             |                    |
        |                             |                    help: a similar name exists in the module: `_mm_shuffle_epi8`
        |                             no `_mm_shuffle_pi8` in `arch::x86_64`
    ...
    297 | impl_shuffle1_dyn!(u8x8);
        | ------------------------- in this macro invocation
        |

    Pull in newer packed_simd crate to fix it.  Newer versions are
    published as packed_simd_2 because the original author is MIA.

    PR:             251425
    Reported by:    Tomoaki AOKI <junchoon@dec.sakura.ne.jp>

 textproc/ripgrep/Makefile                       |   7 +-
 textproc/ripgrep/distinfo                       |   8 +-
 textproc/ripgrep/files/patch-packed_simd (gone) | 114 ------------------------
 3 files changed, 10 insertions(+), 119 deletions(-)
Comment 13 Tobias Kortkamp freebsd_committer freebsd_triage 2021-06-29 13:14:59 UTC
Should be fixed by the last commit and also the ripgrep 13.0.0 update.