Samsung / rlottie

A platform independent standalone library that plays Lottie Animation.
Other
1.19k stars 228 forks source link

Release build failing to parse, Debug - ok #394

Closed nokeya closed 4 years ago

nokeya commented 4 years ago

Building rlottie static to Debug and Release on macOS x64 10.14.6

If build in Debug (-DCMAKE_BUILD_TYPE=Debug) - file parses ok, image renders. If build in Release (Release, RelWithDebInfo or MinSizeRel) - parser fails. Failing method is void LottieParserImpl::parseComposition() - Debug and Release behave differentry in while (const char *key = NextObjectKey()) { ... } loop.

In Debug it loops over all objects, in Release - it misses layers and some others, what leads if (comp->mVersion.empty() || !comp->mRootLayer) to fail.

sample file: https://assets4.lottiefiles.com/packages/lf20_GsFUFN.json

smohantty commented 4 years ago

This is strange . We are using RapidJson for json parsing . I need to dig dipper if it has some macos specific code .

nokeya commented 4 years ago

356efdcd3211477cf345f162591b779d2745c179 (rapidjson update) didn't help

smohantty commented 4 years ago

have to setup mac environment and test it . Does it happens for all the resource or the one you have attached here ?

nokeya commented 4 years ago

I've tried several from lottiefiles Now tried a_cup_of_coffee.json from rlottie examples, got the same - debug works, release don't. But it fails in a different way - layers are parsed, but if (!IsValid()) fails

smohantty commented 4 years ago

I tested with MacOs 10.14.6

Compiler : AppleClang 10.0.1.10010046

CMAKE version : 3.13.2

CMD : cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release .. -- The C compiler identification is AppleClang 10.0.1.10010046 -- The CXX compiler identification is AppleClang 10.0.1.10010046 -- The ASM compiler identification is AppleClang -- Found assembler: /Library/Developer/CommandLineTools/usr/bin/cc -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - found -- Found Threads: TRUE -- Configuring done -- Generating done -- Build files have been written to: /Users/smohantty/rlottie/build

The above resource file working fine with this build.

Could you please share your compiler and cmake version ?

Is it possible to build with meson -Dbuildtype=release to see if you are facing same issue ?

Thanks Subhransu

nokeya commented 4 years ago

Cmake:

cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release ..
-- The C compiler identification is AppleClang 11.0.0.11000033
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- The ASM compiler identification is Clang
-- Found assembler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/a.pershin/dev_proj/rlottie/build

cmake --version
cmake version 3.17.0-rc1

Tried meson with

meson -Dbuildtype=release --default-library static build
ninja -C build

Running with same a_cup_of_coffee.json I've got

Assertion failed: (false), function NextArrayValue, file ../src/lottie/lottieparser.cpp, line 458.
Signal: SIGABRT (signal SIGABRT)
nokeya commented 4 years ago

This was caused by rapidjson version mismatch. My project also use rapidjson, but other version (commit, since they havnt released for many years). Updated my rapidjson to the latest master - all OK, Release and Debug behave in the same way.