Skip to content
This repository has been archived by the owner on Jan 11, 2021. It is now read-only.

Commit

Permalink
android: Fix undefined reference to `__android_log_write'
Browse files Browse the repository at this point in the history
when linking protobuf
  • Loading branch information
martin-schulze-vireso committed Jun 18, 2020
1 parent fe2468d commit e8f81bd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ def _configure_cmake(self):
if self.options.protobuf and self.settings.compiler == 'Visual Studio' and self.options.shared:
# this relies on CMake's bundled FindProtobuf.cmake
cmake.definitions['Protobuf_USE_STATIC_LIBS'] = not self.options['protobuf'].shared
if self.options.protobuf and self.settings.os == 'Android':
# add the log library as dependency of protobuf
cmake.definitions['CONAN_OPENCV_PROTOBUF_DEPENDENCIES'] = 'log'

# Intel TBB
cmake.definitions['BUILD_TBB'] = False
Expand Down Expand Up @@ -452,6 +455,8 @@ def build(self):
patch_file=os.path.join("patches", "0002-fix-FindOpenJPEG-doesnt-exist.patch"))
tools.patch(base_path=self._source_subfolder,
patch_file=os.path.join("patches", "0003-OpenJPEG-fixed-compilation-and-warnings-with-VS.patch"))
tools.patch(base_path=self._source_subfolder,
patch_file=os.path.join("patches", "0004-add-protobuf-dependencies.patch"))

cmake = self._configure_cmake()
cmake.build()
Expand Down
11 changes: 11 additions & 0 deletions patches/0004-add-protobuf-dependencies.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- cmake/OpenCVFindProtobuf.cmake
+++ cmake/OpenCVFindProtobuf.cmake
@@ -46,7 +46,7 @@
if(TARGET protobuf::libprotobuf)
add_library(libprotobuf INTERFACE IMPORTED)
set_target_properties(libprotobuf PROPERTIES
- INTERFACE_LINK_LIBRARIES protobuf::libprotobuf
+ INTERFACE_LINK_LIBRARIES "protobuf::libprotobuf;${CONAN_OPENCV_PROTOBUF_DEPENDENCIES}"
)
else()
add_library(libprotobuf UNKNOWN IMPORTED)

0 comments on commit e8f81bd

Please sign in to comment.