Summary: | media-libs/opencv-4.5.5 fails to build due to "error: ‘_mm_insert_epi64’ was not declared in this scope; did you mean ‘_mm_insert_epi8’?" | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Iade Gesso <iade.gesso> |
Component: | Current packages | Assignee: | No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it <maintainer-needed> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | espinafre, feinorgh, jstein, leonchik1976, rich, sam, scott, sven.eden |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
URL: | https://github.com/opencv/opencv/issues/21597 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
build.log and the emerge --info output
Fix missing ‘_mm_insert_epi64’ function in 32bit build |
Description
Iade Gesso
2021-12-28 20:12:43 UTC
Created attachment 760683 [details]
build.log and the emerge --info output
In '/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/include/smmintrin.h' there is: 429 #ifdef __x86_64__ 430 #define _mm_insert_epi64(D, S, N) \ 431 ((__m128i) __builtin_ia32_vec_set_v2di ((__v2di)(__m128i)(D), \ 432 (long long)(S), (int)(N))) 433 #endif And the error happens while building 'opencv-4.5.5_build-abi_x86_32.x86', so the function really isn't there. (In reply to Sven Eden from comment #2) > In '/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/include/smmintrin.h' there is: > > 429 #ifdef __x86_64__ > 430 #define _mm_insert_epi64(D, S, N) > \ > 431 ((__m128i) __builtin_ia32_vec_set_v2di ((__v2di)(__m128i)(D), > \ > 432 (long long)(S), (int)(N))) > 433 #endif > > And the error happens while building 'opencv-4.5.5_build-abi_x86_32.x86', so > the function really isn't there. So... the issue can be in the GCC 11.2.1 package... but it appeared just now because previous OpenCV versions doesn't need that function? Iade (In reply to Sven Eden from comment #2) > In '/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/include/smmintrin.h' there is: > > 429 #ifdef __x86_64__ > 430 #define _mm_insert_epi64(D, S, N) > \ > 431 ((__m128i) __builtin_ia32_vec_set_v2di ((__v2di)(__m128i)(D), > \ > 432 (long long)(S), (int)(N))) > 433 #endif > > And the error happens while building 'opencv-4.5.5_build-abi_x86_32.x86', so > the function really isn't there. Anyway... the same problem appears even if I build OpenCV 4.5.5 using the old GCC 8.5.x... Iade Such errors are usually nothing to do with gcc version and are to do with the package forcing extensions you don't have. (In reply to Iade Gesso from comment #3) > (In reply to Sven Eden from comment #2) > > In '/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/include/smmintrin.h' there is: > > > > 429 #ifdef __x86_64__ > > 430 #define _mm_insert_epi64(D, S, N) > > \ > > 431 ((__m128i) __builtin_ia32_vec_set_v2di ((__v2di)(__m128i)(D), > > \ > > 432 (long long)(S), (int)(N))) > > 433 #endif > > > > And the error happens while building 'opencv-4.5.5_build-abi_x86_32.x86', so > > the function really isn't there. > > So... the issue can be in the GCC 11.2.1 package... but it appeared just now > because previous OpenCV versions doesn't need that function? No. It is, because 'modules/gapi/src/backends/fluid/gfluidcore_simd_sse41.hpp checks against __i386__ only at one point (line 238), and at the other parts where '_mm_insert_epi64()' is used, it is done so without any checks. opencv-4.5.4 build for ABI_X86_32 without any issues, so the problem is in gfluidcore_simd_sse41.hpp. (In reply to Sven Eden from comment #6) > No. It is, because > 'modules/gapi/src/backends/fluid/gfluidcore_simd_sse41.hpp checks against > __i386__ only at one point (line 238), and at the other parts where > '_mm_insert_epi64()' is used, it is done so without any checks. > > opencv-4.5.4 build for ABI_X86_32 without any issues, so the problem is in > gfluidcore_simd_sse41.hpp. Thanks. Can you report it upstream? (In reply to Sven Eden from comment #6) > (In reply to Iade Gesso from comment #3) > > (In reply to Sven Eden from comment #2) > > > In '/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/include/smmintrin.h' there is: > > > > > > 429 #ifdef __x86_64__ > > > 430 #define _mm_insert_epi64(D, S, N) > > > \ > > > 431 ((__m128i) __builtin_ia32_vec_set_v2di ((__v2di)(__m128i)(D), > > > \ > > > 432 (long long)(S), (int)(N))) > > > 433 #endif > > > > > > And the error happens while building 'opencv-4.5.5_build-abi_x86_32.x86', so > > > the function really isn't there. > > > > So... the issue can be in the GCC 11.2.1 package... but it appeared just now > > because previous OpenCV versions doesn't need that function? > > No. It is, because > 'modules/gapi/src/backends/fluid/gfluidcore_simd_sse41.hpp checks against > __i386__ only at one point (line 238), and at the other parts where > '_mm_insert_epi64()' is used, it is done so without any checks. > > opencv-4.5.4 build for ABI_X86_32 without any issues, so the problem is in > gfluidcore_simd_sse41.hpp. I found a solution here https://lists.freebsd.org/pipermail/p4-projects/2014-December/039272.html Il tryed adding the definition of ‘_mm_insert_epi64’ for i386 as suggested in the link, and now opencv-4.5.5 builds fine. I will provide a patch in the attachments. Let me know if it works :) Iade Created attachment 761664 [details, diff]
Fix missing ‘_mm_insert_epi64’ function in 32bit build
(In reply to Iade Gesso from comment #8) > (In reply to Sven Eden from comment #6) > > (In reply to Iade Gesso from comment #3) > > > (In reply to Sven Eden from comment #2) > > > > In '/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/include/smmintrin.h' there is: > > > > > > > > 429 #ifdef __x86_64__ > > > > 430 #define _mm_insert_epi64(D, S, N) > > > > \ > > > > 431 ((__m128i) __builtin_ia32_vec_set_v2di ((__v2di)(__m128i)(D), > > > > \ > > > > 432 (long long)(S), (int)(N))) > > > > 433 #endif > > > > > > > > And the error happens while building 'opencv-4.5.5_build-abi_x86_32.x86', so > > > > the function really isn't there. > > > > > > So... the issue can be in the GCC 11.2.1 package... but it appeared just now > > > because previous OpenCV versions doesn't need that function? > > > > No. It is, because > > 'modules/gapi/src/backends/fluid/gfluidcore_simd_sse41.hpp checks against > > __i386__ only at one point (line 238), and at the other parts where > > '_mm_insert_epi64()' is used, it is done so without any checks. > > > > opencv-4.5.4 build for ABI_X86_32 without any issues, so the problem is in > > gfluidcore_simd_sse41.hpp. > > I found a solution here > https://lists.freebsd.org/pipermail/p4-projects/2014-December/039272.html > > Il tryed adding the definition of ‘_mm_insert_epi64’ for i386 as suggested > in the link, and now opencv-4.5.5 builds fine. > I will provide a patch in the attachments. > > Let me know if it works :) > > > Iade I thikn you've misunderstood Sven's comment. Copying/pasting this definition is wrong; the usage of the instrinsics should instead be guarded with another define (like it is in other places). (In reply to Sam James from comment #10) > (In reply to Iade Gesso from comment #8) > > (In reply to Sven Eden from comment #6) > > > (In reply to Iade Gesso from comment #3) > > > > (In reply to Sven Eden from comment #2) > > > > > In '/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/include/smmintrin.h' there is: > > > > > > > > > > 429 #ifdef __x86_64__ > > > > > 430 #define _mm_insert_epi64(D, S, N) > > > > > \ > > > > > 431 ((__m128i) __builtin_ia32_vec_set_v2di ((__v2di)(__m128i)(D), > > > > > \ > > > > > 432 (long long)(S), (int)(N))) > > > > > 433 #endif > > > > > > > > > > And the error happens while building 'opencv-4.5.5_build-abi_x86_32.x86', so > > > > > the function really isn't there. > > > > > > > > So... the issue can be in the GCC 11.2.1 package... but it appeared just now > > > > because previous OpenCV versions doesn't need that function? > > > > > > No. It is, because > > > 'modules/gapi/src/backends/fluid/gfluidcore_simd_sse41.hpp checks against > > > __i386__ only at one point (line 238), and at the other parts where > > > '_mm_insert_epi64()' is used, it is done so without any checks. > > > > > > opencv-4.5.4 build for ABI_X86_32 without any issues, so the problem is in > > > gfluidcore_simd_sse41.hpp. > > > > I found a solution here > > https://lists.freebsd.org/pipermail/p4-projects/2014-December/039272.html > > > > Il tryed adding the definition of ‘_mm_insert_epi64’ for i386 as suggested > > in the link, and now opencv-4.5.5 builds fine. > > I will provide a patch in the attachments. > > > > Let me know if it works :) > > > > > > Iade > > I thikn you've misunderstood Sven's comment. Copying/pasting this definition > is wrong; the usage of the instrinsics should instead be guarded with > another define (like it is in other places). No, I understood what Sven told and I tryed to apply his suggestion but I fell down into a cast hell (I didn't find good documentation about the sse4.2 API)... so I proposed my patch as a sort of workaround... Hope someone can fix it in the right way!!! Iade (In reply to Iade Gesso from comment #11) > No, I understood what Sven told and I tryed to apply his suggestion but I > fell down into a cast hell (I didn't find good documentation about the > sse4.2 API)... so I proposed my patch as a sort of workaround... Hope > someone can fix it in the right way!!! > > Iade Would you mind reporting the issue upstream then as you can reproduce it? Just attach the log and explain that one of the uses is unguarded. For now, you can try -mno-sse4.1 for the 32 bit build I guess. Changed URL to upstream bug with this exact issue (Using "_mm_insert_epi64" on 32bit builds) Upstream appears to have a PR that got merged to address this issue (PR#21628 - GAPI Fluid Resize: Fix for 32bit build issue). I was unsuccessful at using the PR patch against the 4.5.5 sources, however... maybe I'm just not doing it right. (In reply to Richard Ostrow from comment #14) > Upstream appears to have a PR that got merged to address this issue > (PR#21628 - GAPI Fluid Resize: Fix for 32bit build issue). I was > unsuccessful at using the PR patch against the 4.5.5 sources, however... > maybe I'm just not doing it right. On a side note, I can confirm that the upstream merge has fixed the isssue - I was able to modify this ebuild to a "9999" git version using the head and it built and installed without issue. It's an ugly hack, though, so I don't think I'll submit a 9999 ebuild here (lots of things forced to version "4.5.5" with the contrib stuff rather than "${PV}", had to add a custom src_unpack() function to handle both git and downloaded stuff normally associated with the src_uri build, etc). Really, only thing of worth noting is that it's fixed upstream and it's worth attempting to make a patch to make 4.5.5 compile/install - I don't know how long I've been staring at failed world updates due to opencv not compiling. I don't know what the release cycle is like, so I have no idea how long we'd have to wait for 4.5.6. Alternatively, maybe we can bring back a previously working version? 4.5.5 is definitely broken for multilib builds. (In reply to Richard Ostrow from comment #15) > (In reply to Richard Ostrow from comment #14) > > Upstream appears to have a PR that got merged to address this issue > > (PR#21628 - GAPI Fluid Resize: Fix for 32bit build issue). I was > > unsuccessful at using the PR patch against the 4.5.5 sources, however... > > maybe I'm just not doing it right. > > On a side note, I can confirm that the upstream merge has fixed the isssue - > I was able to modify this ebuild to a "9999" git version using the head and > it built and installed without issue. It's an ugly hack, though, so I don't > think I'll submit a 9999 ebuild here (lots of things forced to version > "4.5.5" with the contrib stuff rather than "${PV}", had to add a custom > src_unpack() function to handle both git and downloaded stuff normally > associated with the src_uri build, etc). > > Really, only thing of worth noting is that it's fixed upstream and it's > worth attempting to make a patch to make 4.5.5 compile/install - I don't > know how long I've been staring at failed world updates due to opencv not > compiling. I don't know what the release cycle is like, so I have no idea > how long we'd have to wait for 4.5.6. > > Alternatively, maybe we can bring back a previously working version? 4.5.5 > is definitely broken for multilib builds. It didn't apply cleanly so I was hoping for a new release soon. The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2d5e4062df38b6faa35d2d2c1f785bc2f138a548 commit 2d5e4062df38b6faa35d2d2c1f785bc2f138a548 Author: Sam James <sam@gentoo.org> AuthorDate: 2022-06-07 04:34:48 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2022-06-07 04:36:52 +0000 media-libs/opencv: add 4.6.0 Bug: https://bugs.gentoo.org/834092 Closes: https://bugs.gentoo.org/830185 Signed-off-by: Sam James <sam@gentoo.org> media-libs/opencv/Manifest | 2 + media-libs/opencv/opencv-4.6.0.ebuild | 580 ++++++++++++++++++++++++++++++++++ 2 files changed, 582 insertions(+) |