Closed leleliu008 closed 1 year ago
cc @skal65535
Thanks for the report. The dependency looks correct. Alternatively the order of the libraries in the target_link_libraries()
calls could be swapped.
How are you configuring the project? I don't see an issue using .. -DCMAKE_TOOLCHAIN_FILE=../cmake/android.cmake -DSJPEG_ANDROID_NDK_PATH=<path-to>/android-ndk-r25b
.
@jzern You didn't encounter this because you didn't install the libpng
and libjpeg-turbo
therefore cmake didn't find them, which in turn SJPEG_HAVE_JPEG
and SJPEG_HAVE_PNG
macro were not defined, ReadJPEG
and ReadPNG
didn't compile.
my config: https://github.com/leleliu008/ndk-pkg-formula-repository-offical-core/blob/master/formula/sjpeg.yml
reproduce steps:
git clone --depth 1 https://github.com/webmproject/sjpeg
cd sjpeg
cmake \
-Wno-dev \
-DCMAKE_EXPORT_COMPILE_COMMANDS=OFF \
-DBUILD_TESTING=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_COLOR_MAKEFILE=ON \
-DCMAKE_TOOLCHAIN_FILE='/home/leleliu008/.uppm/installed/android-ndk-r25c/build/cmake/android.toolchain.cmake' \
-DCMAKE_INSTALL_PREFIX="$PWD/out" \
-DANDROID_TOOLCHAIN=clang \
-DANDROID_ABI=arm64-v8a \
-DANDROID_ARM_NEON=TRUE \
-DANDROID_STL=c++_shared \
-DANDROID_PLATFORM=21 \
-S . \
-B build.d \
-DBUILD_SHARED_LIBS=ON \
-DSJPEG_BUILD_EXAMPLES=ON \
-DSJPEG_ANDROID_NDK_PATH=/home/leleliu008/.uppm/installed/android-ndk-r25c
ld: error: undefined symbol: sjpeg::EncoderParam::ResetMetadata()
>>> referenced by utils.cc:877 (/home/leleliu008/sjpeg/examples/utils.cc:877)
>>> CMakeFiles/sjpeg-utils.dir/examples/utils.cc.o:(ReadPPM(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, int*, int*, sjpeg::EncoderParam*))
>>> referenced by utils.cc:922 (/home/leleliu008/sjpeg/examples/utils.cc:922)
>>> CMakeFiles/sjpeg-utils.dir/examples/utils.cc.o:(ReadFail(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, int*, int*, sjpeg::EncoderParam*))
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [CMakeFiles/sjpeg-utils.dir/build.make:100: libsjpeg-utils.so] Error 1
gmake[2]: Leaving directory '/home/leleliu008/sjpeg/build.d'
gmake[1]: *** [CMakeFiles/Makefile2:146: CMakeFiles/sjpeg-utils.dir/all] Error 2
gmake[1]: Leaving directory '/home/leleliu008/sjpeg/build.d'
@jzern You didn't encounter this because you didn't install the
libpng
andlibjpeg-turbo
therefore cmake didn't find them, which in turnSJPEG_HAVE_JPEG
andSJPEG_HAVE_PNG
macro were not defined,ReadJPEG
andReadPNG
didn't compile.
You're right, I wasn't paying attention the source of the link error. In other builds, specifying -Wl,--no-undefined
is enough to reproduce the issue.
reported esser messages:
workaroud: