watery01 / libyuv

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

Failed to build under Android #254

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1. Download libyuv r741
2. Try to build in Ubuntu 13.04, 64bit, NDK r8, gcc version 4.7.3 
(Ubuntu/Linaro 4.7.3-1ubuntu1)

Expected result: build without error
Actual result:
Compile++ thumb  : yuv_static <= compare.cc
Compile++ thumb  : yuv_static <= compare_common.cc
Compile++ thumb  : yuv_static <= compare_posix.cc
Compile++ thumb  : yuv_static <= convert.cc
Compile++ thumb  : yuv_static <= convert_argb.cc
/webrtc/third_party/libyuv/source/convert_argb.cc:908: internal compiler error: 
in add_const_value_attribute, at dwarf2out.c:13237
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Original issue reported on code.google.com by Artem.Se...@gmail.com on 29 Jul 2013 at 3:08

GoogleCodeExporter commented 9 years ago
Looks like it's related to typedef uint8 __attribute__((vector_size(16))) uvec8;

Original comment by Artem.Se...@gmail.com on 29 Jul 2013 at 3:59

GoogleCodeExporter commented 9 years ago
Thanks for the report.
The function is likely BGRAToARGB that uses shuffle masks:

// Shuffle table for converting BGRA to ARGB.
static const uvec8 kShuffleMaskBGRAToARGB = {
  3u, 2u, 1u, 0u, 7u, 6u, 5u, 4u, 11u, 10u, 9u, 8u, 15u, 14u, 13u, 12u
};

I saw a similar error on gcc 4.2 for OSX, but it related to static const:
// GCC 4.2 on OSX has link error when passing static or const to inline.
// TODO(fbarchard): Use static const when gcc 4.2 support is dropped.
#ifdef __APPLE__
#define CONST
#else
#define CONST static const
#endif

// Constants for ARGB
CONST vec8 kARGBToY = {
  13, 65, 33, 0, 13, 65, 33, 0, 13, 65, 33, 0, 13, 65, 33, 0
};

Could you try removing all 'static const'?
static const uvec8 kShuffleMaskBGRAToARGB = {
->
uvec8 kShuffleMaskBGRAToARGB = {

I'll go ahead and make a CONST macro, but ifdef'ed for APPLE.
If that works, whats a good macro to ifdef on?

Original comment by fbarch...@google.com on 1 Aug 2013 at 8:30

GoogleCodeExporter commented 9 years ago
Thanks. It works -  now it compiles without any error.
Regarding macro - may be "__x86_64__". Unfortunately I'm not an expert in build 
systems and I don't know what other platforms this bug affects.

Original comment by Artem.Se...@gmail.com on 2 Aug 2013 at 8:25

GoogleCodeExporter commented 9 years ago
This change keeps static, but removes const
https://webrtc-codereview.appspot.com/1944004/

Original comment by fbarch...@google.com on 2 Aug 2013 at 8:49

GoogleCodeExporter commented 9 years ago
Fixed r743
Another team ran into this issue with gcc 4.4.1 (but not 4.5.2) and removing 
'const' worked around it.  So I've done that for all platforms on vectors.

Original comment by fbarch...@google.com on 2 Aug 2013 at 11:43

GoogleCodeExporter commented 9 years ago
Re-opening, as I notice a downside to removing const:
data size has gone from 2C0 to 3E0 on row_win.obj

Appears to be duplicate data, mainly used for AVX2 constants:

// Constants for ARGB.
static vec8 kARGBToY = {
  13, 65, 33, 0, 13, 65, 33, 0, 13, 65, 33, 0, 13, 65, 33, 0
};

static lvec8 kARGBToY_AVX = {
  13, 65, 33, 0, 13, 65, 33, 0, 13, 65, 33, 0, 13, 65, 33, 0,
  13, 65, 33, 0, 13, 65, 33, 0, 13, 65, 33, 0, 13, 65, 33, 0
};

A fix would be to use the AVX constants for SSE as well.

Original comment by fbarch...@google.com on 5 Aug 2013 at 6:41

GoogleCodeExporter commented 9 years ago
r788 adds const for visual c, reducing the code size.
gcc version currently has no avx2, so no data size issue yet.

Original comment by fbarch...@google.com on 12 Sep 2013 at 1:09