darbyjohnston / tlRender

tlRender is an open source library for building playback and review applications for visual effects, film, and animation.
BSD 3-Clause "New" or "Revised" License
193 stars 22 forks source link

expat dependency in OCIO #10

Closed meshula closed 3 years ago

meshula commented 3 years ago

There's an expat dependency in OCIO. I think the super-build should be responsible for fetching that bit... Building on macOS yields this (after I hack in TLR_PLATFORM_MACOS):

ld: library not found for -lOCIO_expat-NOTFOUND

I think the issue is perhaps with OCIO? expat in theory is packaged as a system library...

darbyjohnston commented 3 years ago

That's odd, OCIO should build the dependencies it needs; are you building from the directions on the home page? https://github.com/darbyjohnston/tlRender#building-on-macos

meshula commented 3 years ago
1509  git clone https://github.com/darbyjohnston/tlRender.git
 1510  cd tlRender
 1511  mkdir build;cd build
 1512  cmake ../etc/SuperBuild/ -DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_PREFIX_PATH=$PWD/install 
 1513  cmake --build . -j 4

Perhaps you've got expat in a global path due to macports or homebrew?

meshula commented 3 years ago

expat isn't in the install dir.

drwxrwxr-x nporcino gfx 1.1 KB Mon Jul 19 18:26:18 2021  .
drwxrwxr-x nporcino gfx 192 B  Mon Jul 19 18:22:27 2021  ..
drwxr-xr-x nporcino gfx 128 B  Mon Jul 19 18:22:25 2021  freetype2
.rw-r--r-- nporcino gfx 3.3 KB Mon Jul 19 18:22:12 2021  fseq.h
.rw-r--r-- nporcino gfx 211 KB Mon Jul 19 18:21:18 2021  glad.h
drwxr-xr-x nporcino gfx 128 B  Mon Jul 19 18:22:16 2021  GLFW
.rw-r--r-- nporcino gfx 2.1 KB Mon Jul 19 18:23:17 2021  jconfig.h
.rw-r--r-- nporcino gfx  15 KB Mon Nov 16 15:38:06 2020  jerror.h
.rw-r--r-- nporcino gfx  15 KB Mon Nov 16 15:38:06 2020  jmorecfg.h
.rw-r--r-- nporcino gfx  49 KB Mon Nov 16 15:38:06 2020  jpeglib.h
drwxrwxr-x nporcino gfx  96 B  Mon Jul 19 18:22:08 2021  KHR
drwxrwxr-x nporcino gfx 832 B  Mon Jul 19 18:26:18 2021  libavcodec
drwxrwxr-x nporcino gfx 128 B  Mon Jul 19 18:26:18 2021  libavdevice
drwxrwxr-x nporcino gfx 192 B  Mon Jul 19 18:26:18 2021  libavfilter
drwxrwxr-x nporcino gfx 160 B  Mon Jul 19 18:26:18 2021  libavformat
drwxrwxr-x nporcino gfx 2.8 KB Mon Jul 19 18:26:18 2021  libavutil
drwxrwxr-x nporcino gfx 160 B  Mon Jul 19 18:22:27 2021  libpng16
drwxrwxr-x nporcino gfx 128 B  Mon Jul 19 18:26:18 2021  libswresample
drwxrwxr-x nporcino gfx 128 B  Mon Jul 19 18:26:18 2021  libswscale
drwxrwxr-x nporcino gfx 224 B  Mon Jul 19 18:24:34 2021  OpenColorIO
drwxrwxr-x nporcino gfx 5.1 KB Mon Jul 19 18:23:42 2021  OpenEXR
drwxrwxr-x nporcino gfx 256 B  Mon Jul 19 18:22:54 2021  opentime
drwxrwxr-x nporcino gfx 1.3 KB Mon Jul 19 18:22:54 2021  opentimelineio
.rw-r--r-- nporcino gfx 140 KB Mon Jul 19 18:22:24 2021  png.h
.rw-r--r-- nporcino gfx  22 KB Mon Jul 19 18:22:24 2021  pngconf.h
.rw-r--r-- nporcino gfx 7.4 KB Mon Jul 19 18:22:25 2021  pnglibconf.h
drwxrwxr-x nporcino gfx  96 B  Mon Jul 19 18:23:07 2021  pystring
.rw-r--r-- nporcino gfx  36 KB Sat Nov 10 06:33:01 2018  tiff.h
.rw-r--r-- nporcino gfx 3.1 KB Mon Jul 19 18:23:52 2021  tiffconf.h
.rw-r--r-- nporcino gfx  23 KB Fri May 31 06:05:23 2019  tiffio.h
.rw-r--r-- nporcino gfx 1.6 KB Sun Oct 28 07:13:31 2018  tiffio.hxx
.rw-r--r-- nporcino gfx 410 B  Sun Nov  3 12:11:12 2019  tiffvers.h
.rw-r--r-- nporcino gfx  72 KB Mon Nov 16 15:38:06 2020  turbojpeg.h
drwxr-xr-x nporcino gfx 672 B  Mon Jul 19 18:23:06 2021  yaml-cpp
.rw-r--r-- nporcino gfx  16 KB Mon Jul 19 18:22:10 2021  zconf.h
.rw-r--r-- nporcino gfx  94 KB Sun Jan 15 09:29:40 2017  zlib.h
meshula commented 3 years ago

It's definitely a flaw in someone's find algo for expat:

//The directory containing a CMake configuration file for expat.
expat_DIR:PATH=expat_DIR-NOTFOUND

//Path to a file.
expat_INCLUDE_DIR:PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include

//Path to a library.
expat_LIBRARY:FILEPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/lib/libexpat.tbd
darbyjohnston commented 3 years ago

Good point about homebrew, maybe that's also what was supplying stat64 on my machine.

meshula commented 3 years ago

OCIO/src/OCIO/share/cmake/modules/Findexpat.cmake

looks like no one has set it up for Mac/iOS. It's probably possible to coerce their script with expat_Root, but it seems like it's not a trivial work around.

cmake ../etc/SuperBuild/ -DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_PREFIX_PATH=$PWD/install  -Dexpat_ROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    expat_ROOT

no dice

meshula commented 3 years ago

actually the problem is in tlRender/cmake/Modules/FindOCIO.cmake.

if(CMAKE_BUILD_TYPE MATCHES "^Debug$")
    find_library(OCIO_yaml_LIBRARY NAMES libyaml-cppmdd libyaml-cpp yaml-cpp)
    find_library(OCIO_pystring_LIBRARY NAMES pystring)
    find_library(OCIO_expat LIBRARY NAMES expatdMD expat)
else()
    find_library(OCIO_yaml_LIBRARY NAMES libyaml-cppmd libyaml-cpp yaml-cpp)
    find_library(OCIO_pystring_LIBRARY NAMES pystring)
    find_library(OCIO_expat LIBRARY NAMES expatMD)
endif()

the release version also needs to look for expat as an alternate name.

Yep... Adding expat my build succeeds!

darbyjohnston commented 3 years ago

Interesting, not homebrew, but from Xcode; this is from the macOS GitHub action: Found expat: /Applications/Xcode_12.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/lib/libexpat.tbd (found suitable version "2.2.8", minimum required is "2.2.8")

I think you are right about building expat, I should probably add yaml as well. It is currently being built by OCIO as a CMake "ExternalProject_Add" but I'm getting a lot of warnings from it during linking.

I'll add the OCIO dependencies, thanks for troubleshooting this!

darbyjohnston commented 3 years ago

Ah Ok, great, I just checked in a change to add the missing "expat" name.