Beep6581 / RawTherapee

A powerful cross-platform raw photo processing program
https://rawtherapee.com
GNU General Public License v3.0
2.67k stars 306 forks source link

OSX, No such file or directory make[2]: *** [rtexif/librtexif.a] #5736

Closed KarlMagnusLarsson closed 3 months ago

KarlMagnusLarsson commented 4 years ago

The build instructions in http://rawpedia.rawtherapee.com at http://rawpedia.rawtherapee.com/Linux and http://rawpedia.rawtherapee.com/MacOS are very detailed and clear, but my build still fails.

Problems: a) usage: ar -d [-TLsv] archive file ... in CMAKE output b) clang: error: invalid version number in '-mmacosx-version-min=' and c) No such file or directory make[2]: *** [rtexif/librtexif.a]

Problem c), seems to be the most serious and I can not fix.

Environment OSX 10.13.6 (Imac from 2010) git commit 1beb3c91b43209d7f0430707164a25ad4c78d28d Branch dev

Steps to reproduce using http://rawpedia.rawtherapee.com build instruction:

brew install gtk+3 gtkmm3 gtk-mac-integration adwaita-icon-theme libsigc++ little-cms2 libiptcdata fftw lensfun wget llvm cmake expat pkgconfig libomp 
git clone https://github.com/Beep6581/RawTherapee
cd RawTherapee
mkdir build
cd build
export PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/expat/lib/pkgconfig && \
cmake  .. -DCMAKE_BUILD_TYPE="release" \
          -DPROC_TARGET_NUMBER="2" \
          -DCACHE_NAME_SUFFIX="5.8-dev" \
          -DCMAKE_C_COMPILER="clang" \
          -DCMAKE_CXX_COMPILER="clang++" \
          -DWITH_LTO="ON" \
          -DLENSFUNDBDIR="/Applications/RawTherapee.app/Contents/Resources/share/lensfun" \
          -DCMAKE_BUILD_TYPE=Release \
          -DOpenMP_C_FLAGS=-fopenmp=libomp \
          -DOpenMP_CXX_FLAGS=-fopenmp=libomp \
          -DOpenMP_C_LIB_NAMES="libomp" \
          -DOpenMP_CXX_LIB_NAMES="libomp" \
          -DOpenMP_libomp_LIBRARY="/usr/local/lib/libomp.dylib" \
          -DOpenMP_CXX_FLAGS="-Wno-pass-failed -Wno-deprecated-register -Xpreprocessor -fopenmp /usr/local/lib/libomp.dylib -I/usr/local/include" \
          -DOpenMP_CXX_LIB_NAMES="libomp" \
          -DOpenMP_C_FLAGS="-Wno-pass-failed -Wno-deprecated-register -Xpreprocessor -fopenmp /usr/local/lib/libomp.dylib -I/usr/local/include" \
          -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
          -DCMAKE_EXE_LINKER_FLAGS="-L/usr/local/opt/libffi/lib -L/usr/local/lib" \
          -DCMAKE_AR="/usr/local/Cellar/llvm/8.0.0/bin/llvm-ar" \
          -DCMAKE_RANLIB="/usr/local/Cellar/llvm/8.0.0/bin/llvm-ranlib"

For some reason "ar" command help info is printed in CMAKE output, but CMAKE continues to configure and does not stop.

<...snip...>
-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.11") 
-- Found PNG: /usr/local/lib/libpng.dylib (found version "1.4.12") 
usage:  ar -d [-TLsv] archive file ...
    ar -m [-TLsv] archive file ...
    ar -m [-abiTLsv] position archive file ...
    ar -p [-TLsv] archive [file ...]
    ar -q [-cTLsv] archive file ...
    ar -r [-cuTLsv] archive file ...
    ar -r [-abciuTLsv] position archive file ...
    ar -t [-TLsv] archive [file ...]
    ar -x [-ouTLsv] archive [file ...]
-- Binutils version detected as less than 2.29 - setting CMake parameters to enable LTO linking:
    CMAKE_AR="/usr/local/Cellar/llvm/8.0.0/bin/llvm-ar"
    CMAKE_RANLIB="/usr/local/Cellar/llvm/8.0.0/bin/llvm-ranlib"
<...snip...>
make

Make returns an error: clang: error: invalid version number in '-mmacosx-version-min='

I can fix this with export MACOSX_DEPLOYMENT_TARGET=10.10, where 10.10 is chosen without to much consideration. (I run OSX 10.13).

If I start from scratch, wipe everything and redo build with export MACOSX_DEPLOYMENT_TARGET=10.10 then make stops at:

/usr/local/Cellar/llvm/8.0.0/bin/llvm-ar qc librtexif.a  CMakeFiles/rtexif.dir/canonattribs.cc.o CMakeFiles/rtexif.dir/fujiattribs.cc.o CMakeFiles/rtexif.dir/kodakattribs.cc.o CMakeFiles/rtexif.dir/nikonattribs.cc.o CMakeFiles/rtexif.dir/olympusattribs.cc.o CMakeFiles/rtexif.dir/panasonicattribs.cc.o CMakeFiles/rtexif.dir/pentaxattribs.cc.o CMakeFiles/rtexif.dir/rtexif.cc.o CMakeFiles/rtexif.dir/sonyminoltaattribs.cc.o CMakeFiles/rtexif.dir/stdattribs.cc.o
Error running link command: No such file or directory
make[2]: *** [rtexif/librtexif.a] Error 2
make[1]: *** [rtexif/CMakeFiles/rtexif.dir/all] Error 2
make: *** [all] Error 2

If I try git checkout release-5.8, wipe build and rebuild with make, then I do not get the '-mmacosx-version-min=' errir, but make still fails at:

make[2]: *** [rtexif/librtexif.a] Error 2
make[1]: *** [rtexif/CMakeFiles/rtexif.dir/all] Error 2
make: *** [all] Error 2

This error, c) in my list, I can not fix and I am stuck here.

Benitoite commented 4 years ago

The ar warning is normal-- macos ar does not have the same flags as in other OS, so depending on the ar you have it may or may not fail, causing cmake to pick a suitable version based on .

For the min os version, use a versioned SDK that you actually have installed in your Xcode, which should be 10.13. Tell cmake the version, too: -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.13 If you need backwards compatibility, you must install the appropriate SDK into the Xcode bundle, and use the sysroot flags.

Error running link command- use a verbosity flag so we can see the particular invocation causing the error. Perhaps you could pass the LD to cmake... -DCMAKE_LINKER=/usr/bin/ld or which ever linker you would like to use depending on your compiler of choice.

Benitoite commented 4 years ago

Also, I have done some work to some things mac related, #5703 and #5679 . You should patch them in before a build since it is not yet merged: curl https://patch-diff.githubusercontent.com/raw/Beep6581/RawTherapee/pull/5703.patch | git apply curl https://patch-diff.githubusercontent.com/raw/Beep6581/RawTherapee/pull/5679.patch | git apply

KarlMagnusLarsson commented 4 years ago

Thank you @Benitoite for checking and for the patches. I will apply them.

I have added -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.13 to cmake.

However I think the link command is fine, I think., since 'which ld' shows /usr/bin/ld (I have no other linker) and -DCMAKE_LINKER=/usr/bin/ld does not help.

I get en error due to missing file: Error running link command: No such file or directory since rtexif/librtexif.a does not exist.

I added -DCMAKE_VERBOSE_MAKEFILE=ON, but could not get more info.

KarlMagnusLarsson commented 4 years ago

The complete error, for reference: [ 3%] Linking CXX static library librtexif.a cd /Users/magnuslarsson/Desktop/test/RawTherapee/build/rtexif && /usr/local/Cellar/cmake/3.17.1/bin/cmake -P CMakeFiles/rtexif.dir/cmake_clean_target.cmake cd /Users/magnuslarsson/Desktop/test/RawTherapee/build/rtexif && /usr/local/Cellar/cmake/3.17.1/bin/cmake -E cmake_link_script CMakeFiles/rtexif.dir/link.txt --verbose=1 /usr/local/Cellar/llvm/8.0.0/bin/llvm-ar qc librtexif.a CMakeFiles/rtexif.dir/canonattribs.cc.o CMakeFiles/rtexif.dir/fujiattribs.cc.o CMakeFiles/rtexif.dir/kodakattribs.cc.o CMakeFiles/rtexif.dir/nikonattribs.cc.o CMakeFiles/rtexif.dir/olympusattribs.cc.o CMakeFiles/rtexif.dir/panasonicattribs.cc.o CMakeFiles/rtexif.dir/pentaxattribs.cc.o CMakeFiles/rtexif.dir/rtexif.cc.o CMakeFiles/rtexif.dir/sonyminoltaattribs.cc.o CMakeFiles/rtexif.dir/stdattribs.cc.o Error running link command: No such file or directory make[2]: [rtexif/librtexif.a] Error 2 make[1]: [rtexif/CMakeFiles/rtexif.dir/all] Error 2 make: *** [all] Error 2

Perhaps the problematic part is /usr/local/Cellar/llvm/8.0.0/bin/llvm-ar qc librtexif.a in the error message.

I can not find librtexif.a among the files.

KarlMagnusLarsson commented 4 years ago

I solved lbrtexif.a problem

The build instruction in http://rawpedia.rawtherapee.com/MacOS has llvm version 8.0.0 hard coded: -DCMAKE_AR="/usr/local/Cellar/llvm/8.0.0/bin/llvm-ar" \ -DCMAKE_RANLIB="/usr/local/Cellar/llvm/8.0.0/bin/llvm-ranlib" \

I have version 10.0.0_3 from Brew. I updated the cmake command as per below and now it is building past Linking CXX static library librtexif.a stage.

This works for me with regards to librtexif.a problem: export PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/expat/lib/pkgconfig && \ cmake .. -DCMAKE_BUILD_TYPE="release" \ -DPROC_TARGET_NUMBER="2" \ -DCACHE_NAME_SUFFIX="5.8-dev" \ -DCMAKE_C_COMPILER="clang" \ -DCMAKE_CXX_COMPILER="clang++" \ -DWITH_LTO="ON" \ -DLENSFUNDBDIR="/Applications/RawTherapee.app/Contents/Resources/share/lensfun" \ -DCMAKE_BUILD_TYPE=Release \ -DOpenMP_C_FLAGS=-fopenmp=libomp \ -DOpenMP_CXX_FLAGS=-fopenmp=libomp \ -DOpenMP_C_LIB_NAMES="libomp" \ -DOpenMP_CXX_LIB_NAMES="libomp" \ -DOpenMP_libomp_LIBRARY="/usr/local/lib/libomp.dylib" \ -DOpenMP_CXX_FLAGS="-Wno-pass-failed -Wno-deprecated-register -Xpreprocessor -fopenmp /usr/local/lib/libomp.dylib -I/usr/local/include" \ -DOpenMP_CXX_LIB_NAMES="libomp" \ -DOpenMP_C_FLAGS="-Wno-pass-failed -Wno-deprecated-register -Xpreprocessor -fopenmp /usr/local/lib/libomp.dylib -I/usr/local/include" \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ -DCMAKE_EXE_LINKER_FLAGS="-L/usr/local/opt/libffi/lib -L/usr/local/lib" \ -DCMAKE_AR="/usr/local/Cellar/llvm/10.0.0_3/bin/llvm-ar" \ -DCMAKE_RANLIB="/usr/local/Cellar/llvm/10.0.0_3/bin/llvm-ranlib" \ -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.13 \ -DCMAKE_LINKER=/usr/bin/ld \ -DCMAKE_VERBOSE_MAKEFILE=ON \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON

KarlMagnusLarsson commented 4 years ago

The compilation completed. That is good. I got a runtime error at startup instead.

I could trim the 'llvm-ar' explicit references and CMAKE picked everything up anyway. I do not think that -DCMAKE_AR="/usr/local/Cellar/llvm/10.0.0_3/bin/llvm-ar" -DCMAKE_RANLIB="/usr/local/Cellar/llvm/10.0.0_3/bin/llvm-ranlib" are needed in CMAKE configuration.

This is what I used: export PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/expat/lib/pkgconfig && \ cmake .. -DCMAKE_BUILD_TYPE="release" \ -DPROC_TARGET_NUMBER="2" \ -DCACHE_NAME_SUFFIX="5.8-dev" \ -DCMAKE_C_COMPILER="clang" \ -DCMAKE_CXX_COMPILER="clang++" \ -DWITH_LTO="ON" \ -DLENSFUNDBDIR="/Applications/RawTherapee.app/Contents/Resources/share/lensfun" \ -DCMAKE_BUILD_TYPE=Release \ -DOpenMP_C_FLAGS=-fopenmp=libomp \ -DOpenMP_CXX_FLAGS=-fopenmp=libomp \ -DOpenMP_C_LIB_NAMES="libomp" \ -DOpenMP_CXX_LIB_NAMES="libomp" \ -DOpenMP_libomp_LIBRARY="/usr/local/lib/libomp.dylib" \ -DOpenMP_CXX_FLAGS="-Wno-pass-failed -Wno-deprecated-register -Xpreprocessor -fopenmp /usr/local/lib/libomp.dylib -I/usr/local/include" \ -DOpenMP_CXX_LIB_NAMES="libomp" \ -DOpenMP_C_FLAGS="-Wno-pass-failed -Wno-deprecated-register -Xpreprocessor -fopenmp /usr/local/lib/libomp.dylib -I/usr/local/include" \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ -DCMAKE_EXE_LINKER_FLAGS="-L/usr/local/opt/libffi/lib -L/usr/local/lib" \ -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.13

I did make install and this gave me an OSX app that I could start, but starting the Ratherapee app results in a runtime error after start: Dyld Error Message: Library not loaded: /Applications/RawTherapee.app/Contents/Frameworks/libexpat.1.dylib Referenced from: /Users/USER/Desktop/*/RawTherapee.app/Contents/MacOS/rawtherapee Reason: Incompatible library version: rawtherapee requires version 8.0.0 or later, but libexpat.1.dylib provides version 1.0.0

Benitoite commented 4 years ago

Another thing is that RawTherapee app must be installed in /Applications.

On Wed, Apr 29, 2020 at 2:14 PM KarlMagnusLarsson notifications@github.com wrote:

The compilation completed. That is good. I got a runtime error at startup instead.

I could trim the 'llvm-ar' explicit references and CMAKE picked everything up anyway. I do not think that -DCMAKE_AR="/usr/local/Cellar/llvm/10.0.0_3/bin/llvm-ar" -DCMAKE_RANLIB="/usr/local/Cellar/llvm/10.0.0_3/bin/llvm-ranlib" are needed in CMAKE configuration.

This is what I used: export PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/expat/lib/pkgconfig && cmake .. -DCMAKE_BUILD_TYPE="release" -DPROC_TARGET_NUMBER="2" -DCACHE_NAME_SUFFIX="5.8-dev" -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DWITH_LTO="ON" -DLENSFUNDBDIR="/Applications/RawTherapee.app/Contents/Resources/share/lensfun"

-DCMAKE_BUILD_TYPE=Release -DOpenMP_C_FLAGS=-fopenmp=libomp -DOpenMP_CXX_FLAGS=-fopenmp=libomp -DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" -DOpenMP_libomp_LIBRARY="/usr/local/lib/libomp.dylib" -DOpenMP_CXX_FLAGS="-Wno-pass-failed -Wno-deprecated-register -Xpreprocessor -fopenmp /usr/local/lib/libomp.dylib -I/usr/local/include" -DOpenMP_CXX_LIB_NAMES="libomp" -DOpenMP_C_FLAGS="-Wno-pass-failed -Wno-deprecated-register -Xpreprocessor -fopenmp /usr/local/lib/libomp.dylib -I/usr/local/include" -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_EXE_LINKER_FLAGS="-L/usr/local/opt/libffi/lib -L/usr/local/lib" -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.13

I did make install and this gave me an OSX app that I could start, but starting the Ratherapee app results in a runtime error after start: Dyld Error Message: Library not loaded: /Applications/RawTherapee.app/Contents/Frameworks/libexpat.1.dylib Referenced from: /Users/USER/Desktop/*/RawTherapee.app/Contents/MacOS/rawtherapee Reason: Incompatible library version: rawtherapee requires version 8.0.0 or later, but libexpat.1.dylib provides version 1.0.0

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Beep6581/RawTherapee/issues/5736#issuecomment-621467665, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIW2B6VEZTISRSPV3J67OTRPCKCDANCNFSM4MT7M4DA .

KarlMagnusLarsson commented 4 years ago

@Benitoite, Thank you for the feedback!

I am aware of this instruction from http://rawpedia.rawtherapee.com/MacOS

...macOS 10.15
    To run RawTherapee 5.8 on macOS 10.15 Catalina you must:
        Copy the app to and run from the /Applications folder.
        Add /bin/sh to System Preferences > Security & Privacy > Privacy > Full Disk Access. You will be prompted to automatically do this the first time you run the program....

However I am on OSX 10.13.6 on old Imac hw from 2010! This is a much more relaxed environment compared to OSX 10.15, :-), so I do not think this is the root cause of my startup error message:

Dyld Error Message:
Library not loaded: /Applications/RawTherapee.app/Contents/Frameworks/libexpat.1.dylib
Referenced from: /Users/USER/Desktop/*/RawTherapee.app/Contents/MacOS/rawtherapee
Reason: Incompatible library version: rawtherapee requires version 8.0.0 or later, but libexpat.1.dylib provides version 1.0.0

I get a standard library incompatibility warning, so I think I have not bumped into Apple App security measures.

I added:

          -DCMAKE_EXE_LINKER_FLAGS="-L/usr/local/opt/expat/lib" \
          -DCMAKE_CXX_FLAGS="-I/usr/local/opt/expat/include" \

to CMAKE, since Homebrew states:

For compilers to find expat you may need to set:
  export LDFLAGS="-L/usr/local/opt/expat/lib"
  export CPPFLAGS="-I/usr/local/opt/expat/include"

I checked the OSX app created from build process: make make install sudo make macosx_bundle and the app has the libs from homebrew libexpat, (after a first shallow inspection, at least).

I have from homebrew, (since the instruction recommends brew install expat):

otool -L /usr/local/opt/expat/lib/libexpat.1.dylib
/usr/local/opt/expat/lib/libexpat.1.dylib:
    /usr/local/opt/expat/lib/libexpat.1.dylib (compatibility version 8.0.0, current version 8.11.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5)

However I also have from OSX:

otool -L /usr/lib/libexpat.1.dylib
/usr/lib/libexpat.1.dylib:
    /usr/lib/libexpat.1.dylib (compatibility version 7.0.0, current version 8.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)

But, again, I think I pick up the library from Homebrew. I have:

brew info expat
expat: stable 2.2.9 (bottled), HEAD [keg-only]
ls /usr/local/opt/expat/lib/libexpat*
/usr/local/opt/expat/lib/libexpat.1.6.11.dylib  /usr/local/opt/expat/lib/libexpat.a
/usr/local/opt/expat/lib/libexpat.1.dylib   /usr/local/opt/expat/lib/libexpat.dylib

How to resolve the Dyld error message?

Which version of libexpat works for Rawtherapee?

Is there something in the cmake, make chain that needs to be further configured for correct libexpat to be used?

Benitoite commented 4 years ago

Due to App Sandbox, it must be installed into /Applications to pick up any libraries inside the app, as the paths to the libraries are hard-coded to reside in /Applications. Once it picks up the libexpat inside the app bundle, it will not search elsewhere for a different libexpat in /usr/lib.
This does affect all macOS, so I did update the rawpedia instructions there.

PS I rolled the single change in PR #5679 into the bigger patch #5703.

To install the RawTherapee application, open the .dmg and drag the RawTherapee app onto the /Applications folder.

To use the optional rawtherapee-cli command line interface, move rawtherapee-cli into a folder in your $PATH and install the RawTherapee app as above.
KarlMagnusLarsson commented 4 years ago

I get the same error if I take the dmg from 'sudo make macosx_bundle', mount dmg and drag app to /Applications.

DYLD_FALLBACK_LIBRARY_PATH=/Applications/RawTherapee.app/Contents/Frameworks
Dyld Error Message:
  Library not loaded: /Applications/RawTherapee.app/Contents/Frameworks/libexpat.1.dylib
  Referenced from: /Applications/RawTherapee 2.app/Contents/MacOS/rawtherapee
  Reason: Incompatible library version: rawtherapee requires version 8.0.0 or later, but libexpat.1.dylib provides version 1.0.0
Benitoite commented 4 years ago

It's a little confusing because there was a rename... The RawTherapee you launch must have the base name in /Applications.. any others should be stowed away in a folder. Then, with the build you are trying to test, the results of otool -l /Applications/RawTherapee.app/Contents/MacOS/rawtherapee in particular the entry for the second load command which should be libexpat. If that indicates a Compatibility Version=7 and an Current Version=8, the linker may be picking up the system libexpat.

Benitoite commented 4 years ago

You might also check that your CMakeCache.txt are consistent with your desired outcome... This is what I get with self-installed libraries in /opt/local/. The default config should work with homebrew.

% cat CMakeCache.txt | grep EXPAT
pkgcfg_lib_EXPAT_expat:FILEPATH=/opt/local/lib/libexpat.dylib
EXPAT_CFLAGS:INTERNAL=-I/opt/local/include
EXPAT_CFLAGS_I:INTERNAL=
EXPAT_CFLAGS_OTHER:INTERNAL=
EXPAT_FOUND:INTERNAL=1
EXPAT_INCLUDEDIR:INTERNAL=/opt/local/include
EXPAT_INCLUDE_DIRS:INTERNAL=/opt/local/include
EXPAT_LDFLAGS:INTERNAL=-L/opt/local/lib;-lexpat
EXPAT_LDFLAGS_OTHER:INTERNAL=
EXPAT_LIBDIR:INTERNAL=/opt/local/lib
EXPAT_LIBRARIES:INTERNAL=expat
EXPAT_LIBRARY_DIRS:INTERNAL=/opt/local/lib
EXPAT_LIBS:INTERNAL=
EXPAT_LIBS_L:INTERNAL=
EXPAT_LIBS_OTHER:INTERNAL=
EXPAT_LIBS_PATHS:INTERNAL=
EXPAT_MODULE_NAME:INTERNAL=expat
EXPAT_PREFIX:INTERNAL=/opt/local
EXPAT_STATIC_CFLAGS:INTERNAL=-I/opt/local/include
EXPAT_STATIC_CFLAGS_I:INTERNAL=
EXPAT_STATIC_CFLAGS_OTHER:INTERNAL=
EXPAT_STATIC_INCLUDE_DIRS:INTERNAL=/opt/local/include
EXPAT_STATIC_LDFLAGS:INTERNAL=-L/opt/local/lib;-lexpat
EXPAT_STATIC_LDFLAGS_OTHER:INTERNAL=
EXPAT_STATIC_LIBDIR:INTERNAL=
EXPAT_STATIC_LIBRARIES:INTERNAL=expat
EXPAT_STATIC_LIBRARY_DIRS:INTERNAL=/opt/local/lib
EXPAT_STATIC_LIBS:INTERNAL=
EXPAT_STATIC_LIBS_L:INTERNAL=
EXPAT_STATIC_LIBS_OTHER:INTERNAL=
EXPAT_STATIC_LIBS_PATHS:INTERNAL=
EXPAT_VERSION:INTERNAL=2.2.9
EXPAT_expat_INCLUDEDIR:INTERNAL=
EXPAT_expat_LIBDIR:INTERNAL=
EXPAT_expat_PREFIX:INTERNAL=
EXPAT_expat_VERSION:INTERNAL=
__pkg_config_arguments_EXPAT:INTERNAL=REQUIRED;expat>=2.1
__pkg_config_checked_EXPAT:INTERNAL=1
//ADVANCED property for variable: pkgcfg_lib_EXPAT_expat
pkgcfg_lib_EXPAT_expat-ADVANCED:INTERNAL=1
Benitoite commented 4 years ago

Also, your otool -l /usr/local/opt/expat/lib/libexpat.1.dylib shoud read out something like:

Load command 3
          cmd LC_ID_DYLIB
      cmdsize 48
         name @rpath/libexpat.1.dylib (offset 24)
   time stamp 1 Wed Dec 31 16:00:01 1969
      current version 1.6.11
compatibility version 1.0.0

(ignoring any default time stamp)

KarlMagnusLarsson commented 4 years ago

@Benitoite thank you for the input.

@Benitoite Does my brew install expat install a different version compared to what you have? How to get the version of libexpat I need? It seems that neither brew expat or osx expat can provide a working version.

I think you have found a deviation, comparing our systems. otool -l /usr/local/opt/expat/lib/libexpat.1.dylib gives me:

<snip>
Load command 3
          cmd LC_ID_DYLIB
      cmdsize 72
         name /usr/local/opt/expat/lib/libexpat.1.dylib (offset 24)
   time stamp 1 Thu Jan  1 01:00:01 1970
      current version 8.11.0
compatibility version 8.0.0
<snip>

Which looks decidedly different compared to your output. brew reinstall expat prints this

==> Reinstalling expat 
==> Downloading https://homebrew.bintray.com/bottles/expat-2.2.9.high_sierra.bottle.tar.gz
Already downloaded: /Users/magnuslarsson/Library/Caches/Homebrew/downloads/f3f9793c136655a1df30caf47d63d59f66618469478c22c15987fc6e96cf7a39--expat-2.2.9.high_sierra.bottle.tar.gz
==> Pouring expat-2.2.9.high_sierra.bottle.tar.gz
==> Caveats
expat is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have expat first in your PATH run:
  echo 'export PATH="/usr/local/opt/expat/bin:$PATH"' >> ~/.bash_profile

For compilers to find expat you may need to set:
  export LDFLAGS="-L/usr/local/opt/expat/lib"
  export CPPFLAGS="-I/usr/local/opt/expat/include"

For pkg-config to find expat you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/expat/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/expat/2.2.9: 17 files, 446.4KB
magnuslarsson:~$ brew info expat
expat: stable 2.2.9 (bottled), HEAD [keg-only]
XML 1.0 parser
https://libexpat.github.io/
/usr/local/Cellar/expat/2.2.9 (17 files, 446.4KB)
  Poured from bottle on 2020-05-01 at 12:55:10
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/expat.rb
==> Options
--HEAD
    Install HEAD version
==> Caveats
expat is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have expat first in your PATH run:
  echo 'export PATH="/usr/local/opt/expat/bin:$PATH"' >> ~/.bash_profile

For compilers to find expat you may need to set:
  export LDFLAGS="-L/usr/local/opt/expat/lib"
  export CPPFLAGS="-I/usr/local/opt/expat/include"

For pkg-config to find expat you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/expat/lib/pkgconfig"

So library is installed in /usr/local/opt/expat/lib

brew info expat

expat: stable 2.2.9 (bottled), HEAD [keg-only]
XML 1.0 parser
https://libexpat.github.io/
/usr/local/Cellar/expat/2.2.9 (17 files, 446.4KB)
  Poured from bottle on 2020-05-01 at 12:55:10
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/expat.rb
==> Options
--HEAD
    Install HEAD version

After brew libexpat reistall I still have:

Load command 3
          cmd LC_ID_DYLIB
      cmdsize 72
         name /usr/local/opt/expat/lib/libexpat.1.dylib (offset 24)
   time stamp 1 Thu Jan  1 01:00:01 1970
      current version 8.11.0
compatibility version 8.0.0

The above is as before.

on the osx system side otool -l /usr/lib/libexpat.1.dylib shows:

Load command 3
          cmd LC_ID_DYLIB
      cmdsize 56
         name /usr/lib/libexpat.1.dylib (offset 24)
   time stamp 1 Thu Jan  1 01:00:01 1970
      current version 8.0.0
compatibility version 7.0.0
KarlMagnusLarsson commented 4 years ago

I need to do more testing.

It seems I can not have 'RawTherapee' and 'RawTherape 2' in /Applications, for test (the distributed binary, which works for me, and my own build, which does not work). If I install my newly built package cleanly in /Applications as /Applications/RawTherapee, then I get another runtime error (pointer).

I will start all over with latest dev and patch #5703 and install as /Applications/RawTherapee and do a new test.

KarlMagnusLarsson commented 4 years ago

The library problem is solved. A clean install to /Applications/RawTherapee.app works. The libexpat error is gone.

I am sorry I automatically got a 'RawTherapee 2' app, since I kept old RawTherapee in /Applications. That did not work and I should have understood from feedback.

Without any additional patches I get another run-time error. The complete error output is logged in the attached file. rawtherapee-error.txt

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
abort() called
*** error for object 0x60400001eea0: Invalid pointer dequeued from free list

commit 1beb3c91b43209d7f0430707164a25ad4c78d28d branch dev

Steps to reproduce:

brew install gtk+3 gtkmm3 gtk-mac-integration adwaita-icon-theme libsigc++ little-cms2 libiptcdata fftw lensfun wget llvm cmake expat pkgconfig libomp 
git clone https://github.com/Beep6581/RawTherapee.git
cd RawTherapee
mkdir build
cd build
export PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/expat/lib/pkgconfig && \
cmake  .. -DCMAKE_BUILD_TYPE="release" \
          -DPROC_TARGET_NUMBER="2" \
          -DCACHE_NAME_SUFFIX="5.8-dev" \
          -DCMAKE_C_COMPILER="clang" \
          -DCMAKE_CXX_COMPILER="clang++" \
          -DWITH_LTO="ON" \
          -DLENSFUNDBDIR="/Applications/RawTherapee.app/Contents/Resources/share/lensfun" \
          -DCMAKE_BUILD_TYPE=Release \
          -DCMAKE_EXE_LINKER_FLAGS="-L/usr/local/opt/expat/lib" \
          -DCMAKE_CXX_FLAGS="-I/usr/local/opt/expat/include" \
          -DOpenMP_C_FLAGS=-fopenmp=libomp \
          -DOpenMP_CXX_FLAGS=-fopenmp=libomp \
          -DOpenMP_C_LIB_NAMES="libomp" \
          -DOpenMP_CXX_LIB_NAMES="libomp" \
          -DOpenMP_libomp_LIBRARY="/usr/local/lib/libomp.dylib" \
          -DOpenMP_CXX_FLAGS="-Wno-pass-failed -Wno-deprecated-register -Xpreprocessor -fopenmp /usr/local/lib/libomp.dylib -I/usr/local/include" \
          -DOpenMP_CXX_LIB_NAMES="libomp" \
          -DOpenMP_C_FLAGS="-Wno-pass-failed -Wno-deprecated-register -Xpreprocessor -fopenmp /usr/local/lib/libomp.dylib -I/usr/local/include" \
          -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
          -DCMAKE_EXE_LINKER_FLAGS="-L/usr/local/opt/libffi/lib -L/usr/local/lib" \
          -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.13 
make -j4
make install
sudo make macosx_bundle

I unzip to get dmg bundle and open dmg bundle and install to /Applications.

When I click RawTherapee app the applications does load, but fails to starts as shown above. However, this time without complaining about libexpat.

KarlMagnusLarsson commented 4 years ago

Since the original errors I reported and in particular "No such file or directory make[2]: *** [rtexif/librtexif.a]" is solved we could work on closing this open issue report.

I propose two possible ways to patch build instruction: 1: Make -DCMAKE_AR and -DCMAKE_RANLIB= respect installed llvm version and 5-May-2020 that is 10.0.0_3. The path /usr/local/opt/llvm/bin points to installed version. -DCMAKE_AR="/usr/local/opt/llvm/bin/llvm-ar" \ -DCMAKE_RANLIB="/usr/local/opt/llvm/bin/llvm-ranlib" or 2: use standard ar from /usr/bin in osx and remove -DCMAKE_AR and -DCMAKE_RANLIB= from cmake configuration.

Details

The build instruction for Homebrew at http://rawpedia.rawtherapee.com/MacOS contains:

-DCMAKE_AR="/usr/local/Cellar/llvm/8.0.0/bin/llvm-ar" \
-DCMAKE_RANLIB="/usr/local/Cellar/llvm/8.0.0/bin/llvm-ranlib"

But if you do brew install llvm (as per instruction in http://rawpedia.rawtherapee.com/MacOS) then, for example, 3-May-2020, you get llvm/10.0.0_3 installed, so the path usr/local/Cellar/llvm/8.0.0/bin/llvm-ar does not work. I get:

/usr/local/Cellar/llvm/8.0.0/bin/llvm-ar qc librtexif.a ... 
<snip>
Error running link command: No such file or directory
make[2]: *** [rtexif/librtexif.a] Error 2
make[1]: *** [rtexif/CMakeFiles/rtexif.dir/all] Error 2
make: *** [all] Error 2

I see two possible solutions: 1: Make -DCMAKE_AR and -DCMAKE_RANLIB= respect installed llvm version and 5-May-2020 that is 10.0.0_3. The path /usr/local/opt/llvm/bin points to installed version. -DCMAKE_AR="/usr/local/opt/llvm/bin/llvm-ar" \ -DCMAKE_RANLIB="/usr/local/opt/llvm/bin/llvm-ranlib" or 2: use standard ar from /usr/bin in osx and remove -DCMAKE_AR and -DCMAKE_RANLIB= from cmake configuration.

I do not know if the use of llvm-ar is critical compared to using /usr/bin/ar

I get the same error at runtime regardless of llvm-ar or ar

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

as reported before in rawtherapee-error.txt

Benitoite commented 4 years ago

Ok let's see what we can do to fix. The ar/ranlib part of CMakeLists.txt for mac was a workaround due to a change for other OS' LTO functionality that broke the mac config a few months ago. The default behavior is intended to make a homebrew build (although one hasn't been completely possible in a while), and options available to allow either MacPorts or libraries-built-from-scratch (the method I use exclusively).

KarlMagnusLarsson commented 3 months ago

No longer relevant.