qiqian / webp

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

Error building libwebp/dsp/enc_neon.c with clang for arm64 #233

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When building libwebp/dsp/enc_neon.c with clang open source ToT, the following 
error occurs:

../../third_party/libwebp/dsp/enc_neon.c:1020:16: error: implicit declaration 
of function 'vtbl2q_u8' is invalid in C99 
[-Werror,-Wimplicit-function-declaration]
               vtbl2q_u8(all_out, vld1_u8(kShuffles[0])),
               ^
../../third_party/libwebp/dsp/./neon.h:37:14: note: expanded from macro 
'INIT_VECTOR4'
  v.val[0] = a;                           \
             ^
../../third_party/libwebp/dsp/enc_neon.c:1019:3: error: assigning to 
'uint8x8_t' (vector of 8 'uint8_t' values) from incompatible type 'int'
  INIT_VECTOR4(shuffles,
  ^~~~~~~~~~~~~~~~~~~~~~
../../third_party/libwebp/dsp/./neon.h:37:12: note: expanded from macro 
'INIT_VECTOR4'
  v.val[0] = a;                           \
           ^ ~
../../third_party/libwebp/dsp/enc_neon.c:1019:3: error: assigning to 
'uint8x8_t' (vector of 8 'uint8_t' values) from incompatible type 'int'
  INIT_VECTOR4(shuffles,
  ^~~~~~~~~~~~~~~~~~~~~~
../../third_party/libwebp/dsp/./neon.h:38:12: note: expanded from macro 
'INIT_VECTOR4'
  v.val[1] = b;                           \
           ^ ~
../../third_party/libwebp/dsp/enc_neon.c:1019:3: error: assigning to 
'uint8x8_t' (vector of 8 'uint8_t' values) from incompatible type 'int'
  INIT_VECTOR4(shuffles,
  ^~~~~~~~~~~~~~~~~~~~~~
../../third_party/libwebp/dsp/./neon.h:39:12: note: expanded from macro 
'INIT_VECTOR4'
  v.val[2] = c;                           \
           ^ ~
../../third_party/libwebp/dsp/enc_neon.c:1019:3: error: assigning to 
'uint8x8_t' (vector of 8 'uint8_t' values) from incompatible type 'int'
  INIT_VECTOR4(shuffles,
  ^~~~~~~~~~~~~~~~~~~~~~
../../third_party/libwebp/dsp/./neon.h:40:12: note: expanded from macro 
'INIT_VECTOR4'
  v.val[3] = d;                           \

The file compile successfully with the version of clang that ships with Xcode 
(that uses a different arm64 backend, I think it is a forked version of clang) 
with the same command-line.

Full command line:

$ ../../third_party/llvm-build/Release+Asserts/bin/clang -MMD -MF 
obj/third_party/libwebp/dsp/libwebp_dsp_neon.enc_neon.arm64.o.d 
-DV8_DEPRECATION_WARNINGS -DDISABLE_NACL -DCHROMIUM_BUILD 
-DCR_CLANG_REVISION=218707 -DENABLE_MATERIAL_DESIGN=1 
-DENABLE_CHROME_NET_STACK_FOR_WKWEBVIEW=1 -DUSE_LIBJPEG_TURBO=1 
-DENABLE_CONFIGURATION_POLICY -DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY 
-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE -DDONT_EMBED_BUILD_METADATA 
-DCLD_VERSION=2 -DDISABLE_FTP_SUPPORT=1 
'-DSPDY_PROXY_AUTH_VALUE="ac4500dd3b7579186c1b0620614fdb1f7d61f944"' 
-DENABLE_LOAD_COMPLETION_HACKS=1 -DUSE_LIBPCI=1 -DDYNAMIC_ANNOTATIONS_ENABLED=1 
-DWTF_USE_DYNAMIC_ANNOTATIONS=1 -Igen -I../../third_party/libwebp -isysroot 
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
/SDKs/iPhoneOS8.1.sdk -O0 -gdwarf-2 -fvisibility=hidden -Wnewline-eof 
-miphoneos-version-min=7.0 -arch arm64 -Wendif-labels -Wno-unused-parameter 
-Wno-missing-field-initializers -Wno-selector-type-mismatch -Wheader-hygiene 
-Wno-char-subscripts -Wno-unneeded-internal-declaration 
-Wno-covered-switch-default -Wstring-conversion -Wno-c++11-narrowing 
-Wno-deprecated-register -std=c99 -Xclang -load -Xclang 
/Volumes/SecondarySSD/Developer/bling/src/third_party/llvm-build/Release+Asserts
/lib/libFindBadConstructs.dylib -Xclang -add-plugin -Xclang find-bad-constructs 
-fcolor-diagnostics -fstack-protector-all -Wno-undefined-bool-conversion 
-Wno-tautological-undefined-compare  -c 
../../third_party/libwebp/dsp/enc_neon.c -o 
obj/third_party/libwebp/dsp/libwebp_dsp_neon.enc_neon.arm64.o

If using /usr/bin/clang instead of 
../../third_party/llvm-build/Release+Asserts/bin/clang then the file compile 
successfully.

Versions:

$ ../../third_party/llvm-build/Release+Asserts/bin/clang --version
clang version 3.6.0 (218707)
Target: x86_64-apple-darwin14.0.0
Thread model: posix

$ clang --version
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix

Original issue reported on code.google.com by sdefresne@chromium.org on 10 Dec 2014 at 2:19

GoogleCodeExporter commented 9 years ago
The error log refers to the Chromium version. In HEAD, the problem is at 
enc_neon.c:860, where we need to find the right #define to use as version 
switch...

Original comment by pascal.m...@gmail.com on 10 Dec 2014 at 2:23

GoogleCodeExporter commented 9 years ago
This is preventing this patch from landing in Chromium tree:
https://codereview.chromium.org/771723002

Original comment by sdefresne@chromium.org on 10 Dec 2014 at 2:45

GoogleCodeExporter commented 9 years ago
I'd prefer not to have to do a less-than check on the clang version; I imagine 
there's something further to distinguish the two, if you have the chrome clang 
handy can you post the output from both using '-E -dM' + any of the above 
machine flags to get the right platform.

Original comment by jz...@google.com on 10 Dec 2014 at 8:37

GoogleCodeExporter commented 9 years ago
__apple_build_version__ may work; my concern with checking for e.g., 5.0 is 
that upstream may cross that at some point

Original comment by jz...@google.com on 10 Dec 2014 at 11:48

GoogleCodeExporter commented 9 years ago
I've attached the result of "clang -E -dM -x c /dev/null" for both Xcode clang 
(clang-xcode.txt) and ToT clang (clang-ToT.txt).

Here is the diff:

--- clang-xcode.txt 2014-12-11 10:51:39.000000000 +0100
+++ clang-ToT.txt   2014-12-11 10:51:26.000000000 +0100
@@ -12,15 +12,17 @@
 #define __ARM_ARCH_ISA_A64 1
 #define __ARM_ARCH_PROFILE 'A'
 #define __ARM_FEATURE_CLZ 1
-#define __ARM_FEATURE_CRYPTO 1
+#define __ARM_FEATURE_DIRECTED_ROUNDING 1
 #define __ARM_FEATURE_DIV 1
 #define __ARM_FEATURE_FMA 1
+#define __ARM_FEATURE_IDIV 1
+#define __ARM_FEATURE_NUMERIC_MAXMIN 1
 #define __ARM_FEATURE_UNALIGNED 1
 #define __ARM_FP 0xe
 #define __ARM_FP16_FORMAT_IEEE 1
 #define __ARM_FP_FENV_ROUNDING 1
 #define __ARM_NEON 1
-#define __ARM_NEON_FP 7
+#define __ARM_NEON_FP 0xe
 #define __ARM_NEON__ 1
 #define __ARM_PCS_AAPCS64 1
 #define __ARM_SIZEOF_MINIMAL_ENUM 4
@@ -86,16 +88,69 @@
 #define __GNUC__ 4
 #define __GXX_ABI_VERSION 1002
 #define __GXX_RTTI 1
+#define __INT16_C_SUFFIX__ 
+#define __INT16_FMTd__ "hd"
+#define __INT16_FMTi__ "hi"
+#define __INT16_MAX__ 32767
 #define __INT16_TYPE__ short
+#define __INT32_C_SUFFIX__ 
+#define __INT32_FMTd__ "d"
+#define __INT32_FMTi__ "i"
+#define __INT32_MAX__ 2147483647
 #define __INT32_TYPE__ int
 #define __INT64_C_SUFFIX__ LL
+#define __INT64_FMTd__ "lld"
+#define __INT64_FMTi__ "lli"
+#define __INT64_MAX__ 9223372036854775807LL
 #define __INT64_TYPE__ long long int
-#define __INT8_TYPE__ char
+#define __INT8_C_SUFFIX__ 
+#define __INT8_FMTd__ "hhd"
+#define __INT8_FMTi__ "hhi"
+#define __INT8_MAX__ 127
+#define __INT8_TYPE__ signed char
+#define __INTMAX_C_SUFFIX__ L
+#define __INTMAX_FMTd__ "ld"
+#define __INTMAX_FMTi__ "li"
 #define __INTMAX_MAX__ 9223372036854775807L
 #define __INTMAX_TYPE__ long int
 #define __INTMAX_WIDTH__ 64
+#define __INTPTR_FMTd__ "ld"
+#define __INTPTR_FMTi__ "li"
+#define __INTPTR_MAX__ 9223372036854775807L
 #define __INTPTR_TYPE__ long int
 #define __INTPTR_WIDTH__ 64
+#define __INT_FAST16_FMTd__ "hd"
+#define __INT_FAST16_FMTi__ "hi"
+#define __INT_FAST16_MAX__ 32767
+#define __INT_FAST16_TYPE__ short
+#define __INT_FAST32_FMTd__ "d"
+#define __INT_FAST32_FMTi__ "i"
+#define __INT_FAST32_MAX__ 2147483647
+#define __INT_FAST32_TYPE__ int
+#define __INT_FAST64_FMTd__ "ld"
+#define __INT_FAST64_FMTi__ "li"
+#define __INT_FAST64_MAX__ 9223372036854775807L
+#define __INT_FAST64_TYPE__ long int
+#define __INT_FAST8_FMTd__ "hhd"
+#define __INT_FAST8_FMTi__ "hhi"
+#define __INT_FAST8_MAX__ 127
+#define __INT_FAST8_TYPE__ signed char
+#define __INT_LEAST16_FMTd__ "hd"
+#define __INT_LEAST16_FMTi__ "hi"
+#define __INT_LEAST16_MAX__ 32767
+#define __INT_LEAST16_TYPE__ short
+#define __INT_LEAST32_FMTd__ "d"
+#define __INT_LEAST32_FMTi__ "i"
+#define __INT_LEAST32_MAX__ 2147483647
+#define __INT_LEAST32_TYPE__ int
+#define __INT_LEAST64_FMTd__ "ld"
+#define __INT_LEAST64_FMTi__ "li"
+#define __INT_LEAST64_MAX__ 9223372036854775807L
+#define __INT_LEAST64_TYPE__ long int
+#define __INT_LEAST8_FMTd__ "hhd"
+#define __INT_LEAST8_FMTi__ "hhi"
+#define __INT_LEAST8_MAX__ 127
+#define __INT_LEAST8_TYPE__ signed char
 #define __INT_MAX__ 2147483647
 #define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L
 #define __LDBL_DIG__ 15
@@ -122,11 +177,15 @@
 #define __PIC__ 2
 #define __POINTER_WIDTH__ 64
 #define __PRAGMA_REDEFINE_EXTNAME 1
+#define __PTRDIFF_FMTd__ "ld"
+#define __PTRDIFF_FMTi__ "li"
+#define __PTRDIFF_MAX__ 9223372036854775807L
 #define __PTRDIFF_TYPE__ long int
 #define __PTRDIFF_WIDTH__ 64
 #define __REGISTER_PREFIX__ 
 #define __SCHAR_MAX__ 127
 #define __SHRT_MAX__ 32767
+#define __SIG_ATOMIC_MAX__ 2147483647
 #define __SIG_ATOMIC_WIDTH__ 32
 #define __SIZEOF_DOUBLE__ 8
 #define __SIZEOF_FLOAT__ 4
@@ -141,6 +200,10 @@
 #define __SIZEOF_SIZE_T__ 8
 #define __SIZEOF_WCHAR_T__ 4
 #define __SIZEOF_WINT_T__ 4
+#define __SIZE_FMTX__ "lX"
+#define __SIZE_FMTo__ "lo"
+#define __SIZE_FMTu__ "lu"
+#define __SIZE_FMTx__ "lx"
 #define __SIZE_MAX__ 18446744073709551615UL
 #define __SIZE_TYPE__ long unsigned int
 #define __SIZE_WIDTH__ 64
@@ -150,24 +213,113 @@
 #define __STDC_UTF_32__ 1
 #define __STDC_VERSION__ 199901L
 #define __STDC__ 1
+#define __UINT16_C_SUFFIX__ 
+#define __UINT16_FMTX__ "hX"
+#define __UINT16_FMTo__ "ho"
+#define __UINT16_FMTu__ "hu"
+#define __UINT16_FMTx__ "hx"
+#define __UINT16_MAX__ 65535
+#define __UINT16_TYPE__ unsigned short
+#define __UINT32_C_SUFFIX__ U
+#define __UINT32_FMTX__ "X"
+#define __UINT32_FMTo__ "o"
+#define __UINT32_FMTu__ "u"
+#define __UINT32_FMTx__ "x"
+#define __UINT32_MAX__ 4294967295U
+#define __UINT32_TYPE__ unsigned int
+#define __UINT64_C_SUFFIX__ ULL
+#define __UINT64_FMTX__ "llX"
+#define __UINT64_FMTo__ "llo"
+#define __UINT64_FMTu__ "llu"
+#define __UINT64_FMTx__ "llx"
+#define __UINT64_MAX__ 18446744073709551615ULL
+#define __UINT64_TYPE__ long long unsigned int
+#define __UINT8_C_SUFFIX__ 
+#define __UINT8_FMTX__ "hhX"
+#define __UINT8_FMTo__ "hho"
+#define __UINT8_FMTu__ "hhu"
+#define __UINT8_FMTx__ "hhx"
+#define __UINT8_MAX__ 255
+#define __UINT8_TYPE__ unsigned char
+#define __UINTMAX_C_SUFFIX__ UL
+#define __UINTMAX_FMTX__ "lX"
+#define __UINTMAX_FMTo__ "lo"
+#define __UINTMAX_FMTu__ "lu"
+#define __UINTMAX_FMTx__ "lx"
+#define __UINTMAX_MAX__ 18446744073709551615UL
 #define __UINTMAX_TYPE__ long unsigned int
+#define __UINTMAX_WIDTH__ 64
+#define __UINTPTR_FMTX__ "lX"
+#define __UINTPTR_FMTo__ "lo"
+#define __UINTPTR_FMTu__ "lu"
+#define __UINTPTR_FMTx__ "lx"
+#define __UINTPTR_MAX__ 18446744073709551615UL
+#define __UINTPTR_TYPE__ long unsigned int
+#define __UINTPTR_WIDTH__ 64
+#define __UINT_FAST16_FMTX__ "hX"
+#define __UINT_FAST16_FMTo__ "ho"
+#define __UINT_FAST16_FMTu__ "hu"
+#define __UINT_FAST16_FMTx__ "hx"
+#define __UINT_FAST16_MAX__ 65535
+#define __UINT_FAST16_TYPE__ unsigned short
+#define __UINT_FAST32_FMTX__ "X"
+#define __UINT_FAST32_FMTo__ "o"
+#define __UINT_FAST32_FMTu__ "u"
+#define __UINT_FAST32_FMTx__ "x"
+#define __UINT_FAST32_MAX__ 4294967295U
+#define __UINT_FAST32_TYPE__ unsigned int
+#define __UINT_FAST64_FMTX__ "lX"
+#define __UINT_FAST64_FMTo__ "lo"
+#define __UINT_FAST64_FMTu__ "lu"
+#define __UINT_FAST64_FMTx__ "lx"
+#define __UINT_FAST64_MAX__ 18446744073709551615UL
+#define __UINT_FAST64_TYPE__ long unsigned int
+#define __UINT_FAST8_FMTX__ "hhX"
+#define __UINT_FAST8_FMTo__ "hho"
+#define __UINT_FAST8_FMTu__ "hhu"
+#define __UINT_FAST8_FMTx__ "hhx"
+#define __UINT_FAST8_MAX__ 255
+#define __UINT_FAST8_TYPE__ unsigned char
+#define __UINT_LEAST16_FMTX__ "hX"
+#define __UINT_LEAST16_FMTo__ "ho"
+#define __UINT_LEAST16_FMTu__ "hu"
+#define __UINT_LEAST16_FMTx__ "hx"
+#define __UINT_LEAST16_MAX__ 65535
+#define __UINT_LEAST16_TYPE__ unsigned short
+#define __UINT_LEAST32_FMTX__ "X"
+#define __UINT_LEAST32_FMTo__ "o"
+#define __UINT_LEAST32_FMTu__ "u"
+#define __UINT_LEAST32_FMTx__ "x"
+#define __UINT_LEAST32_MAX__ 4294967295U
+#define __UINT_LEAST32_TYPE__ unsigned int
+#define __UINT_LEAST64_FMTX__ "lX"
+#define __UINT_LEAST64_FMTo__ "lo"
+#define __UINT_LEAST64_FMTu__ "lu"
+#define __UINT_LEAST64_FMTx__ "lx"
+#define __UINT_LEAST64_MAX__ 18446744073709551615UL
+#define __UINT_LEAST64_TYPE__ long unsigned int
+#define __UINT_LEAST8_FMTX__ "hhX"
+#define __UINT_LEAST8_FMTo__ "hho"
+#define __UINT_LEAST8_FMTu__ "hhu"
+#define __UINT_LEAST8_FMTx__ "hhx"
+#define __UINT_LEAST8_MAX__ 255
+#define __UINT_LEAST8_TYPE__ unsigned char
 #define __USER_LABEL_PREFIX__ _
-#define __VERSION__ "4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)"
+#define __VERSION__ "4.2.1 Compatible Clang 3.6.0 (218707)"
 #define __WCHAR_MAX__ 2147483647
 #define __WCHAR_TYPE__ int
 #define __WCHAR_WIDTH__ 32
 #define __WINT_TYPE__ int
 #define __WINT_WIDTH__ 32
 #define __aarch64__ 1
-#define __apple_build_version__ 6000054
 #define __arm64 1
 #define __arm64__ 1
 #define __block __attribute__((__blocks__(byref)))
 #define __clang__ 1
-#define __clang_major__ 6
-#define __clang_minor__ 0
+#define __clang_major__ 3
+#define __clang_minor__ 6
 #define __clang_patchlevel__ 0
-#define __clang_version__ "6.0 (clang-600.0.54)"
+#define __clang_version__ "3.6.0 (218707)"
 #define __llvm__ 1
 #define __pic__ 2
 #define __strong 

__apple_build_version__ seems to only be defined for clang shipped through 
Xcode. Maybe this can be used to check. I tried to check if any of the 
__has_builtin, __has_extension could be used to check for the presence of that 
function, but couldn't find any.

Original comment by sdefresne@chromium.org on 11 Dec 2014 at 10:12

Attachments:

GoogleCodeExporter commented 9 years ago
patch submitted:   https://gerrit.chromium.org/gerrit/73216

 Thanks for the report!

Original comment by pascal.m...@gmail.com on 11 Dec 2014 at 10:27