Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid argument(s): Failed to load dynamic library 'phash.so': dlopen failed: cannot locate symbol "TIFFSetWarningHandler" referenced by "/data/app/~~dsq_8wJXYPiEvZhp0h9C8w==/com.example.tcg-n4L1yUnzT6xjvaZKt_iDZA==/lib/arm64/phash.so"... #42

Open
ChurikiTenna opened this issue Mar 7, 2024 · 0 comments

Comments

@ChurikiTenna
Copy link

ChurikiTenna commented Mar 7, 2024

I built phase.so as below:

export NDK_PATH=/Users/tenna/Library/Android/sdk/ndk/26.2.11394342
export ARCH=arm64-v8a
export TOOLCHAIN=$NDK_PATH/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android34-clang++

$TOOLCHAIN -shared -fPIC -o /Users/tenna/desktop/appname/android/app/src/main/jniLibs/$ARCH/phash.so \
    -I/Library/Frameworks/Mono.framework/Versions/6.12.0/include \
    -I/Users/tenna/pHash/CImg-3.3.5_pre03042417 \
    -L/Users/tenna/anaconda3/pkgs/jpeg-9e-h80987f9_1/lib \
    -L/Users/tenna/anaconda3/pkgs/libtiff-4.5.0-h313beb8_2/lib \
    -L/Users/tenna/anaconda3/pkgs/libpng-1.6.39-h80987f9_0/lib \
    /Users/tenna/pHash/src/pHash.cpp

Or

export NDK_PATH=/Users/tenna/Library/Android/sdk/ndk/26.2.11394342
export ARCH=arm64-v8a
export TOOLCHAIN=$NDK_PATH/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android34-clang++
$TOOLCHAIN -shared -fPIC -o /Users/tenna/desktop/app/android/app/src/main/jniLibs/$ARCH/phash.so \
    -I/Library/Frameworks/Mono.framework/Versions/6.12.0/include \
    -I/Users/tenna/pHash/third-party/CImg \
    -L/Library/Frameworks/Mono.framework/Versions/6.12.0/lib \
    /Users/tenna/pHash/src/pHash.cpp

When I try to open the phase.so file in flutter, it throws errors:

I/flutter ( 7373): getImagePhash.e Invalid argument(s): Failed to load dynamic library 'phash.so': dlopen failed: cannot locate symbol "TIFFSetWarningHandler" referenced by "/data/app/~~dsq_8wJXYPiEvZhp0h9C8w==/com.example.tcg-n4L1yUnzT6xjvaZKt_iDZA==/lib/arm64/phash.so"...
E/flutter ( 7373): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'phash.so': dlopen failed: cannot locate symbol "TIFFSetWarningHandler" referenced by "/data/app/~~dsq_8wJXYPiEvZhp0h9C8w==/com.example.tcg-n4L1yUnzT6xjvaZKt_iDZA==/lib/arm64/phash.so"...
E/flutter ( 7373): #0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11:43)
E/flutter ( 7373): #1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22:12)
E/flutter ( 7373): #2      lib (package:tcg/templates/hash2.dart:17:22)
E/flutter ( 7373): #3      lib (package:tcg/templates/hash2.dart)
E/flutter ( 7373): #4      calculateImageHash (package:tcg/templates/hash2.dart:23:39)
E/flutter ( 7373): #5      HashHelper2._computeImagePHash (package:tcg/templates/hash2.dart:90:16)
E/flutter ( 7373): #6      HashHelper2.getImagePhash (package:tcg/templates/hash2.dart:49:24)
E/flutter ( 7373): <asynchronous suspension>
E/flutter ( 7373): #7      _MyPageTabState.getdata (package:tcg/pages/my_page.dart:32:18)
E/flutter ( 7373): <asynchronous suspension>
E/flutter ( 7373): 

TIFFSetWarningHandler is supposed be imported from libtiff in CImg.h.

I tried reinstalling libtiff.dylib through homebrew which did not solve the problem.
This made me suspect that the version of libtiff installed may differ from the version required for the library.
But I could not find any specification either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant