Chen-tao / webm

Automatically exported from code.google.com/p/webm
0 stars 0 forks source link

scale.c build error with mingw-64 32-bit #571

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
v1.2.0-1627-gc4195e0
CROSS=i686-w64-mingw32- ./configure --target=x86-win32-gcc

Reported here:
https://groups.google.com/a/webmproject.org/d/msg/webm-discuss/S1hUvsNLR4I/HIIoR
jJWCz4J

Error snippet:

---

    [CC] third_party/libyuv/source/scale.c.o
third_party/libyuv/source/scale.c:642:32: warning: 'naked' attribute directive 
ignored [-Wattributes]
                                uint8* dst_ptr, int dst_width) {
                                ^
third_party/libyuv/source/scale.c: In function 'ScaleRowDown2_SSE2':
third_party/libyuv/source/scale.c:643:9: error: expected '(' before '{' token
   __asm {
         ^
third_party/libyuv/source/scale.c:644:5: error: unknown type name 'mov'
     mov        eax, [esp + 4]        // src_ptr
     ^
third_party/libyuv/source/scale.c:644:21: error: expected identifier or '(' 
before '[' token
     mov        eax, [esp + 4]        // src_ptr
                     ^
third_party/libyuv/source/scale.c:644:16: warning: unused variable 'eax' 
[-Wunused-variable]
     mov        eax, [esp + 4]        // src_ptr
                ^
third_party/libyuv/source/scale.c:670:28: warning: 'naked' attribute directive 
ignored [-Wattributes]
                            uint8* dst_ptr, int dst_width) {

Original issue reported on code.google.com by jz...@google.com on 8 Apr 2013 at 6:39

GoogleCodeExporter commented 8 years ago
A temporary workaround is to define YUV_DISABLE_ASM.

---
diff --git a/third_party/libyuv/source/scale.c 
b/third_party/libyuv/source/scale.c
index c142a17..fa143c6 100644
--- a/third_party/libyuv/source/scale.c
+++ b/third_party/libyuv/source/scale.c
@@ -24,7 +24,7 @@ extern "C" {
 /*
  * Note: Defining YUV_DISABLE_ASM allows to use c version.
  */
-//#define YUV_DISABLE_ASM
+#define YUV_DISABLE_ASM

 #if defined(_MSC_VER)
 #define ALIGN16(var) __declspec(align(16)) var

Original comment by jz...@google.com on 8 Apr 2013 at 6:40

GoogleCodeExporter commented 8 years ago

Original comment by albe...@google.com on 11 Apr 2013 at 10:13

GoogleCodeExporter commented 8 years ago
This code is branched from libyuv?  A quick test shows the original code 
compiles ok
gcc -c -I ../include scale.cc

That code should have an ifdef that only assembles the instructions above for 
Visual C:

#if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86)
#define HAS_SCALEROWDOWN2_SSE2
// Reads 32 pixels, throws half away and writes 16 pixels.
// Alignment requirement: src_ptr 16 byte aligned, dst_ptr 16 byte aligned.
__declspec(naked) __declspec(align(16))
static void ScaleRowDown2_SSE2(const uint8* src_ptr, ptrdiff_t src_stride,
                               uint8* dst_ptr, int dst_width) {
  __asm {
    mov        eax, [esp + 4]        // src_ptr

..
it should be falling into this ifdef instead
#elif !defined(LIBYUV_DISABLE_X86) && (defined(__x86_64__) || defined(__i386__))
// GCC versions of row functions are verbatim conversions from Visual C.
// Generated using gcc disassembly on Visual C object file:
// objdump -D yuvscaler.obj >yuvscaler.txt
#define HAS_SCALEROWDOWN2_SSE2
static void ScaleRowDown2_SSE2(const uint8* src_ptr, ptrdiff_t src_stride,
                               uint8* dst_ptr, int dst_width) {
  asm volatile (
    ".p2align  4                               \n"
  "1:                                          \n"
    "movdqa    (%0),%%xmm0                     \n"
...

Original comment by fbarch...@google.com on 4 Jun 2013 at 3:41

GoogleCodeExporter commented 8 years ago
fixed in libyuv r717
Change defined(_M_IX86) to defined(_M_IX86) && defined(_MSC_VER)

Original comment by fbarch...@google.com on 4 Jun 2013 at 6:05

GoogleCodeExporter commented 8 years ago
Fixed in https://gerrit.chromium.org/gerrit/57498

Original comment by jkoles...@google.com on 4 Jun 2013 at 8:12

GoogleCodeExporter commented 8 years ago
This issue was closed by revision 98ca829f574c.

Original comment by jkoles...@google.com on 7 Jun 2013 at 8:00