Open Ravbug opened 3 years ago
Also running into this problem at the moment.
I am also hitting this issue. Has anyone come up with a solution? Short term fix I am thinking undef __ARM_NEON__ ?
oh, this only happens when building lottie2gif. The core rlottie project does not have this issue. I have just changed my build script to call make rlottie
rather than make
and it builds fine.
EDIT: Well I should have expected to fall back to this issue. Once I got my unrelated xcode compilation issues solved I am back to this linking error.
I have worked around this locally, I changed the call in memfill32 to memset, and took the generic c implementation off source_over from vdrawhelper_common.cpp. I know this isnt the cleanest fix, but now I have rlottie running on iOS. Here is the patch of my changes for anyone interested.
src/vector/vdrawhelper_neon.cpp | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/src/vector/vdrawhelper_neon.cpp b/src/vector/vdrawhelper_neon.cpp
index 681eabb..1c1eed6 100644
--- a/src/vector/vdrawhelper_neon.cpp
+++ b/src/vector/vdrawhelper_neon.cpp
@@ -2,28 +2,20 @@
#include "vdrawhelper.h"
-extern "C" void pixman_composite_src_n_8888_asm_neon(int32_t w, int32_t h,
- uint32_t *dst,
- int32_t dst_stride,
- uint32_t src);
-
-extern "C" void pixman_composite_over_n_8888_asm_neon(int32_t w, int32_t h,
- uint32_t *dst,
- int32_t dst_stride,
- uint32_t src);
-
void memfill32(uint32_t *dest, uint32_t value, int length)
{
- pixman_composite_src_n_8888_asm_neon(length, 1, dest, length, value);
+ memset(dest, value, length);
}
static void color_SourceOver(uint32_t *dest, int length,
uint32_t color,
- uint32_t const_alpha)
+ uint32_t alpha)
{
- if (const_alpha != 255) color = BYTE_MUL(color, const_alpha);
+ int ialpha, i;
- pixman_composite_over_n_8888_asm_neon(length, 1, dest, length, color);
+ if (alpha != 255) color = BYTE_MUL(color, alpha);
+ ialpha = 255 - vAlpha(color);
+ for (i = 0; i < length; ++i) dest[i] = color + BYTE_MUL(dest[i], ialpha);
}
void RenderFuncTable::neon()
--
I also have this problem when building rlottie on the Rasberry Pi using GCC. And I can confirm that it does not only happen when building lottie2gif as I only build the main library and still encounter the problem.
Applying the patch above solves the problems, so thanks for that! But it's not nice having to apply a custom patch to my repository so my application can be built successfully. Would it therefore be possible to apply this patch to the rlottie master branch or fix the problem in some other way?
Thanks! :)
Did the above patch which helped with the build, but when time came to do the install, it tried to move all the binary artifacts into /usr/lib
.
This is no longer allowed under Apple's SIP security guidelines. You can manually disable SIP but this is bad security practice and may not even be allowed for certain environments.
The solution is to edit cmake_install.cmake
and lottie_workdir/build/src/vector/stb/cmake_install.cmake
and change all the occurrences of /usr/lib
to /usr/local/lib
(which is writeable). You may also need to manually create a /usr/local/lib/cmake
directory.
Then when time comes to use the libraries, you have to make sure the include and lib paths are properly set up to point at /usr/local/lib
.
HTH.
Wrapping up solutions provided above, with some modification:
/usr/lib
to /usr/local/lib
-Werror=sign-compare
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e0d4e0b..f0a84e5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -87,7 +87,7 @@ endif()
if (NOT LIB_INSTALL_DIR)
- set (LIB_INSTALL_DIR "/usr/lib")
+ set (LIB_INSTALL_DIR "/usr/local/lib")
endif (NOT LIB_INSTALL_DIR)
#declare source and include files
diff --git a/src/lottie/lottiemodel.cpp b/src/lottie/lottiemodel.cpp
index bf0e357..e96a043 100644
--- a/src/lottie/lottiemodel.cpp
+++ b/src/lottie/lottiemodel.cpp
@@ -188,11 +188,11 @@ void LOTGradient::populate(VGradientStops &stops, int frameNo)
return;
}
int colorPoints = mColorPoints;
- if (colorPoints < 0 || colorPoints > size / 4) { // for legacy bodymovin (ref: lottie-android)
+ if (colorPoints < 0 || (long unsigned int)(colorPoints) > size / 4) { // for legacy bodymovin (ref: lottie-android)
colorPoints = int(size / 4);
}
auto opacityArraySize = size - colorPoints * 4;
- if ((opacityArraySize % 2 != 0) || (colorPoints > opacityArraySize / 2 && opacityArraySize < 4)) {
+ if ((opacityArraySize % 2 != 0) || ((long unsigned int)(colorPoints) > opacityArraySize / 2 && opacityArraySize < 4)) {
opacityArraySize = 0;
}
float *opacityPtr = ptr + (colorPoints * 4);
diff --git a/src/vector/vdrawhelper_neon.cpp b/src/vector/vdrawhelper_neon.cpp
index 99fd34f..a4a791a 100644
--- a/src/vector/vdrawhelper_neon.cpp
+++ b/src/vector/vdrawhelper_neon.cpp
@@ -2,27 +2,18 @@
#include "vdrawhelper.h"
-extern "C" void pixman_composite_src_n_8888_asm_neon(int32_t w, int32_t h,
- uint32_t *dst,
- int32_t dst_stride,
- uint32_t src);
-
-extern "C" void pixman_composite_over_n_8888_asm_neon(int32_t w, int32_t h,
- uint32_t *dst,
- int32_t dst_stride,
- uint32_t src);
-
void memfill32(uint32_t *dest, uint32_t value, int length)
{
- pixman_composite_src_n_8888_asm_neon(length, 1, dest, length, value);
+ memset(dest, value, length);
}
void Vcomp_func_solid_SourceOver_neon(uint32_t *dest, int length,
uint32_t color,
uint32_t const_alpha)
{
+ int ialpha, i;
if (const_alpha != 255) color = BYTE_MUL(color, const_alpha);
-
- pixman_composite_over_n_8888_asm_neon(length, 1, dest, length, color);
+ ialpha = 255 - vAlpha(color);
+ for (i = 0; i < length; ++i) dest[i] = color + BYTE_MUL(dest[i], ialpha);
}
#endif
We may also use #if !defined(__APPLE__)
to wrap those extern "C" void pixman_composite_src_n_8888_asm_neon
stuff, so that other arm platforms can still benefit from the speedup.
Just curious when this will get rolled into the main line. I don't see a PR open.
😬
I'd say the correct way of fixing this is not removing the usage of neon instructions from vdrawhelper_neon.cpp
, but rather not including/using neon in other places like vdrawhelper.cpp
and vdrawhelper_common.cpp
. I've opened the PR 556 mentioned above that only includes neon instructions on 32-bit arm architectures, fixing the builds for arm64 like Apple Silicon.
This is a more detailed error report for #488.
When compiling for iOS or Apple silicon, two symbols are not defined:
The file that uses these functions is
vdrawhelper_neon.cpp
.Steps to Reproduce:
CMakeLists.txt
to includeset(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE INTERNAL "")
below theproject
line, this will enable building Apple Silicon:declare project
project( rlottie VERSION 0.2 LANGUAGES C CXX ASM) set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE INTERNAL "") # add this line
...