facebookresearch / ocean

Ocean is the in-house framework for Computer Vision (CV) and Augmented Reality (AR) applications at Meta. It is platform independent and is mainly implemented in C/C++.
https://facebookresearch.github.io/ocean/
MIT License
614 stars 54 forks source link

Missing dependencies when building with XCode (iOS, macOS) #9

Closed enpe closed 2 months ago

enpe commented 2 months ago

Problem

When building for iOS or macOS, the configuration step of CMake fails because of a missing dependency on JBIG::JBIG:

iOS

computername:ocean nils$ cmake -S"${OCEAN_DEVELOPMENT_PATH}" -B"${HOME}/build_ocean_ios_release" -DCMAKE_BUILD_TYPE="Release" -G Xcode -DCMAKE_TOOLCHAIN_FILE="${OCEAN_DEVELOPMENT_PATH}/build/cmake/ios-cmake/ios.toolchain.cmake" -DPLATFORM="OS64" -DDEPLOYMENT_TARGET="15.0" -DCMAKE_INSTALL_PREFIX="${HOME}/install_ocean_thirdparty/ios_OS64_static_Release" -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=[REDACTED] -DBUILD_SHARED_LIBS="OFF"
-- [DEFAULTS] Using explicit named language support! E.g., enable_language(CXX) is needed in the project files.
-- [DEFAULTS] Disabling bitcode support by default. ENABLE_BITCODE not provided for override!
-- [DEFAULTS] Enabling ARC support by default. ENABLE_ARC not provided!
-- [DEFAULTS] Hiding symbols visibility by default. ENABLE_VISIBILITY not provided!
-- [DEFAULTS] Using NON-strict compiler checks by default. ENABLE_STRICT_TRY_COMPILE not provided!
-- Not setting any manual command-line buildflags, since Xcode is selected as the generator. Modifying the Xcode build-settings directly instead.
-- Configuring iphoneos build for platform: OS64, architecture(s): arm64
-- Using SDK: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.5.sdk
-- Using C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Using CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-- Using libtool: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-- Using install name tool: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool
-- Autoconf target triple: arm64-apple-ios15.0
-- Using minimum deployment version: 15.0 (SDK version: 17.5)
-- Merging integrated CMake 3.14+ iOS,tvOS,watchOS,macOS toolchain(s) with this toolchain!
-- Using Xcode version: 15.4
-- CMake version: 3.30.0
-- Using a data_ptr size of: 8
-- Bitcode: Disabled
-- ARC: Enabled
-- Hiding symbols: Enabled
--
-- BUILD_SHARED_LIBS = OFF
-- CMAKE_BUILD_TYPE = Release
-- CMAKE_CXX_STANDARD = 20
-- CMAKE_INSTALL_PREFIX = /Users/nils/install_ocean_thirdparty/ios_OS64_static_Release
-- OCEAN_COMPILER_FLAGS = ""
-- OCEAN_ENABLE_MESSENGER = ON
-- OCEAN_HOST_PROCESSOR_TYPE = x86_64
-- OCEAN_HOST_SYSTEM_NAME = macos
-- OCEAN_IMPL_DIR = /Users/nils/spielwiese/ocean/impl
-- OCEAN_PREPROCESSOR_FLAGS = "-DOCEAN_ACTIVATE_MESSENGER=1;-DOCEAN_RUNTIME_STATIC"
-- OCEAN_TARGET_PROCESSOR_TYPE = aarch64
-- OCEAN_TARGET_SYSTEM_NAME = ios
--
-- Found the following HarfBuzz libraries:
--  HarfBuzz (required): /opt/local/lib/libharfbuzz.dylib
-- Excluding 'ocean/io/Signature.{cpp, h, mm}' because OpenSSL hasn't been found.
-- Excluding 'ocean_test_testcv_testopencv' because OpenCV hasn't been found.
-- Configuring done (219.1s)
CMake Error at /Users/nils/install_ocean_thirdparty/ios_OS64_static_Release/lib/cmake/tiff/TiffTargets.cmake:61 (set_target_properties):
  The link interface of target "TIFF::tiff" contains:

    JBIG::JBIG

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  /Users/nils/install_ocean_thirdparty/ios_OS64_static_Release/lib/cmake/tiff/TiffConfig.cmake:24 (include)
  /Applications/CMake.app/Contents/share/cmake-3.30/Modules/FindTIFF.cmake:104 (find_package)
  impl/ocean/media/openimagelibraries/CMakeLists.txt:17 (find_package)

-- Generating done (0.5s)
CMake Generate step failed.  Build files cannot be regenerated correctly.
computername:ocean nils$

macOS

computername:ocean nils$ cd ${OCEAN_DEVELOPMENT_PATH}
computername:ocean nils$ cmake -S"${OCEAN_DEVELOPMENT_PATH}" \
>     -B"${HOME}/build_ocean_macos_release" \
>     -DCMAKE_BUILD_TYPE="Release" \
>     -G Xcode \
>     -DCMAKE_INSTALL_PREFIX="${HOME}/install_ocean_thirdparty/macos_static_Release" \
>     -DBUILD_SHARED_LIBS="OFF"
-- The C compiler identification is AppleClang 15.0.0.15000309
-- The CXX compiler identification is AppleClang 15.0.0.15000309
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The OBJC compiler identification is AppleClang 15.0.0.15000309
-- The OBJCXX compiler identification is AppleClang 15.0.0.15000309
-- Detecting OBJC compiler ABI info
-- Detecting OBJC compiler ABI info - done
-- Check for working OBJC compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - skipped
-- Detecting OBJCXX compiler ABI info
-- Detecting OBJCXX compiler ABI info - done
-- Check for working OBJCXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
--
-- BUILD_SHARED_LIBS = OFF
-- CMAKE_BUILD_TYPE = Release
-- CMAKE_CXX_STANDARD = 20
-- CMAKE_INSTALL_PREFIX = /Users/nils/install_ocean_thirdparty/macos_static_Release
-- OCEAN_COMPILER_FLAGS = "-msse4.1;-mavx2"
-- OCEAN_ENABLE_MESSENGER = ON
-- OCEAN_HOST_PROCESSOR_TYPE = x86_64
-- OCEAN_HOST_SYSTEM_NAME = macos
-- OCEAN_IMPL_DIR = /Users/nils/spielwiese/ocean/impl
-- OCEAN_PREPROCESSOR_FLAGS = "-DOCEAN_ACTIVATE_MESSENGER=1;-DOCEAN_RUNTIME_STATIC"
-- OCEAN_TARGET_PROCESSOR_TYPE = x86_64
-- OCEAN_TARGET_SYSTEM_NAME = macos
--
-- Found Freetype: /Users/nils/install_ocean_thirdparty/macos_static_Release/lib/libfreetype.a (found version "2.13.2")
-- Found the following HarfBuzz libraries:
--  HarfBuzz (required): /opt/local/lib/libharfbuzz.dylib
-- Found HarfBuzz: /opt/local/include/harfbuzz (found version "3.2.0")
-- Found ZLIB: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/lib/libz.tbd (found version "1.2.12")
-- Found PNG: /Users/nils/install_ocean_thirdparty/macos_static_Release/lib/libpng.a (found version "1.6.43")
-- Found JPEG: /Users/nils/install_ocean_thirdparty/macos_static_Release/lib/libjpeg.a (found version "90")
-- Found TIFF: /Users/nils/install_ocean_thirdparty/macos_static_Release/lib/cmake/tiff (found version "4.6.0")
-- Found wxWidgets: -L/Users/nils/install_ocean_thirdparty/macos_static_Release/lib;-pthread;/Users/nils/install_ocean_thirdparty/macos_static_Release/lib/libwx_osx_cocoau_xrc-3.2.a;/Users/nils/install_ocean_thirdparty/macos_static_Release/lib/libwx_osx_cocoau_qa-3.2.a;/Users/nils/install_ocean_thirdparty/macos_static_Release/lib/libwx_baseu_net-3.2.a;/Users/nils/install_ocean_thirdparty/macos_static_Release/lib/libwx_osx_cocoau_html-3.2.a;/Users/nils/install_ocean_thirdparty/macos_static_Release/lib/libwx_osx_cocoau_core-3.2.a;/Users/nils/install_ocean_thirdparty/macos_static_Release/lib/libwx_baseu_xml-3.2.a;/Users/nils/install_ocean_thirdparty/macos_static_Release/lib/libwx_baseu-3.2.a;-lwx_osx_cocoau_core-3.2;-lwxjpeg-3.2;-lwxpng-3.2;-lwxtiff-3.2;-framework AudioToolbox;-framework WebKit;-lwx_baseu-3.2;/opt/local/lib/libexpat.dylib;/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/lib/libz.tbd;-lwxregexu-3.2;/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/lib/libiconv.tbd;-framework CoreFoundation;-framework Security;-framework Carbon;-framework Cocoa;-framework IOKit;-framework QuartzCore (found version "3.2.4")
CMake Warning (dev) at /Applications/CMake.app/Contents/share/cmake-3.30/Modules/FindPackageHandleStandardArgs.cmake:441 (message):
  The package name passed to `find_package_handle_standard_args` (LIBUSB_1)
  does not match the name of the calling package (libusb-1.0).  This can lead
  to problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  build/cmake/Findlibusb-1.0.cmake:65 (find_package_handle_standard_args)
  impl/ocean/system/usb/video/CMakeLists.txt:12 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found LIBUSB_1: /Users/nils/install_ocean_thirdparty/macos_static_Release/lib/libusb.a
CMake Warning (dev) at /Applications/CMake.app/Contents/share/cmake-3.30/Modules/FindPackageHandleStandardArgs.cmake:441 (message):
  The package name passed to `find_package_handle_standard_args` (LIBUSB_1)
  does not match the name of the calling package (libusb-1.0).  This can lead
  to problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  build/cmake/Findlibusb-1.0.cmake:65 (find_package_handle_standard_args)
  impl/ocean/system/usb/CMakeLists.txt:15 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Excluding 'application_ocean_demo_misc_imageannotator_osx' because OpenCV hasn't been found.
-- Found GTest: /Users/nils/install_ocean_thirdparty/macos_static_Release/lib/cmake/GTest/GTestConfig.cmake (found version "1.14.0")
-- Excluding 'ocean_test_testcv_testopencv' because OpenCV hasn't been found.
-- Excluding 'application_ocean_test_cv_testcv_testopencv' because its dependency 'ocean_test_testcv_testopencv' is missing.
-- Configuring done (244.3s)
CMake Error at /Users/nils/install_ocean_thirdparty/macos_static_Release/lib/cmake/tiff/TiffTargets.cmake:61 (set_target_properties):
  The link interface of target "TIFF::tiff" contains:

    JBIG::JBIG

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  /Users/nils/install_ocean_thirdparty/macos_static_Release/lib/cmake/tiff/TiffConfig.cmake:24 (include)
  /Applications/CMake.app/Contents/share/cmake-3.30/Modules/FindTIFF.cmake:104 (find_package)
  impl/ocean/media/openimagelibraries/CMakeLists.txt:17 (find_package)

-- Generating done (0.7s)
CMake Generate step failed.  Build files cannot be regenerated correctly.
computername:ocean nils$

Instructions to reproduce the problem

For iOS, follow steps 1, 2, and 4 (release) from

https://github.com/facebookresearch/ocean/blob/main/building_for_ios.md

on a Mac with an Intel-CPU (not sure if ARM-based ones are affected or not).

For macOS, follow the steps 1, 2, and 4 (release) from

https://github.com/facebookresearch/ocean/blob/main/building_for_macos.md