CarVac / filmulator-gui

Filmulator --- Simplified raw editing with the power of film
https://filmulator.org
Other
669 stars 31 forks source link

CMakeLists.txt broken on OSX - libexiv2.dylib and librtprocess.0.dylib #109

Closed dconrad5 closed 4 years ago

dconrad5 commented 4 years ago

I really like the idea of this program! I'm going to play with it for a while, but I needed to build it first on OSX since the most recent build I've found is pretty old at this point. Please forgive me if I'm breaking some Github rules or customs, this is my first issue report.

After some trial and error I managed to build the latest from dev branch on OSX Catalina, but I found that parts of the CMakeLists.txt file have broken. I can give what I did to fix it but it mostly involves hardcoding file paths so it's definitely not a solution to the problem, I just thought I would bring it to attention here.

exiv2.dylib's filepath was all sorts of screwed up, I fixed it by doing the following:

file(READ_SYMLINK "${EXIV2_LIBRARY}" result)
#message(STATUS "result=${result}")
#message(STATUS "EXIV2_INCLUDE_DIR=${EXIV2_INCLUDE_DIR}")
file(COPY "${EXIV2_INCLUDE_DIR}/${result}" DESTINATION "${CMAKE_SOURCE_DIR}/build/Filmulator.app/Contents/Frameworks")
file(READ_SYMLINK "${CMAKE_SOURCE_DIR}/build/Filmulator.app/Contents/Frameworks/libexiv2.dylib" result2)
#message(STATUS "result2=${result2}")
file(COPY "${EXIV2_INCLUDE_DIR}/../Cellar/exiv2/0.27.2/lib/${result2}" DESTINATION "${CMAKE_SOURCE_DIR}/build/Filmulator.app/Contents/Frameworks")
file(COPY "${EXIV2_INCLUDE_DIR}" DESTINATION "${CMAKE_SOURCE_DIR}/build/Filmulator.app/Contents/Frameworks")
file(RENAME "${CMAKE_SOURCE_DIR}/build/Filmulator.app/Contents/Frameworks/${result2}" "${CMAKE_SOURCE_DIR}/build/Filmulator.app/Contents/Frameworks/libexiv2.dylib")

librtprocess.dylib was completely broken - RTPROCESS_LIBRARIES didn't contain a filepath at all. It took a while for me to figure out what file I actually needed, but eventually I got it straight:

#message(STATUS "rtprocess_DIR=${rtprocess_DIR}")
message(STATUS "RTPROCESS_LIBRARIES=${RTPROCESS_LIBRARIES}")
#file(COPY "${RTPROCESS_LIBRARIES}" DESTINATION "${CMAKE_SOURCE_DIR}/build/Filmulator.app/Contents/Frameworks")
#file(COPY "/opt/local/include/rtprocess/librtprocess.h" DESTINATION "${CMAKE_SOURCE_DIR}/build/Filmulator.app/Contents/Frameworks")
file(COPY "/opt/local/lib/librtprocess.0.0.1.dylib" DESTINATION "${CMAKE_SOURCE_DIR}/build/Filmulator.app/Contents/Frameworks")
file(RENAME "${CMAKE_SOURCE_DIR}/build/Filmulator.app/Contents/Frameworks/librtprocess.0.0.1.dylib" "${CMAKE_SOURCE_DIR}/build/Filmulator.app/Contents/Frameworks/librtprocess.0.dylib")
#file(COPY "${rtprocess_DIR}" DESTINATION "${CMAKE_SOURCE_DIR}/build/Filmulator.app/Contents/Frameworks")

Hopefully the above makes sense. I can give the output of the errors too if that's helpful.

Perhaps it's a bit too far off topic but I also found it was confusing to figure out where libomp and qt were and how to set that in the build commands, maybe the main page build instructions could make that more clear? I'm not sure if it's kosher or not but I could suggest some changes to make it more clear what needs to be customized and what you're looking for to do so since it's so fresh in my mind.

CarVac commented 4 years ago

Did it work for you in the end?

Finding libraries depends on how you install them. I don't know if you get Qt from Homebrew, or downloaded directly from Qt, or what. Usually if you install it from a package manager, you can look up the package's file contents and find where the library is... but I don't actually know what file extension a MacOS library is (DLL for Windows, SO for Linux) so I can't help you there.

Also, by the way, it's only going to get harder to build, because I've decided the new features I had been working on are stable enough to merge into dev. So if you're going to get it building, please try with the latest version. As a forewarning: you have to build Lensfun yourself from the latest git; 3.95 isn't new enough.

As far as how best to contribute changes: the way GitHub works is you Fork the project using the button at the top right, then you clone your own fork of the repository (which you have write access to), then you make the changes, push the changes back to your fork, and then Pull Request.

dconrad5 commented 4 years ago

It did work for me in the end, it was just a couple days of scratching my head over obscure-looking configure errors (and trying to learn how cmake works). Everything is indeed installed via Homebrew. I see your newest commit, I'll check it out and see if maybe I can get it to build.

As far as I understand (I'm not an OSX developer or anything), .dylib files are the library files, similar to .dll or .so.

Any chance you can specify a minimum lensfun version that will work? Even if it's just a minimum commit number, that's helpful.

CarVac commented 4 years ago

https://github.com/lensfun/lensfun/commit/ac546e155fc95df50657169f3c92de7ccad38822

This is the oldest commit with the function I need.

dconrad5 commented 4 years ago

Excellent, thanks!

dconrad5 commented 4 years ago

Just so I understand correctly, the dynamic library files need to be in the package, not the .h header files, correct? Or maybe that's a better question for someone who's worked on mac builds?

I'm trying to get the latest commit e5ada1d to build and I think I got all the right dynamic libraries added into the .app package, but the build is still failing. It's throwing an error which I don't know enough to pinpoint the problem:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:1054:39: note: 
      expanded from macro '_LIBCPP_DEPRECATED_IN_CXX11'
#  define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED
                                      ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:1043:48: note: 
      expanded from macro '_LIBCPP_DEPRECATED'
#    define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
                                               ^
In file included from /Users/dana/forked filmulator-gui/filmulator-gui/filmulator-gui/ui/filmImageProvider.cpp:1:
In file included from /Users/dana/forked filmulator-gui/filmulator-gui/filmulator-gui/ui/filmImageProvider.h:11:
In file included from /Users/dana/forked filmulator-gui/filmulator-gui/filmulator-gui/ui/../core/imagePipeline.h:3:
In file included from /Users/dana/forked filmulator-gui/filmulator-gui/filmulator-gui/core/filmSim.hpp:32:
In file included from /usr/local/include/libraw/libraw.h:35:
/usr/local/include/libraw/libraw_datastream.h:122:8: warning: 'auto_ptr<std::__1::basic_streambuf<char> >' is deprecated
      [-Wdeprecated-declarations]
  std::auto_ptr<std::streambuf> saved_f; /* when *f is a subfile, *saved_f is the master file */
       ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2079:28: note: 
      'auto_ptr<std::__1::basic_streambuf<char> >' has been explicitly marked deprecated here
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr
                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:1054:39: note: 
      expanded from macro '_LIBCPP_DEPRECATED_IN_CXX11'
#  define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED
                                      ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:1043:48: note: 
      expanded from macro '_LIBCPP_DEPRECATED'
#    define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
                                               ^
127 warnings generated.
127 warnings generated.
make[1]: *** [CMakeFiles/filmulator.dir/all] Error 2
make: *** [all] Error 2
dana@Danas-MacBook-Pro build % 

Any idea what might be going wrong?

CarVac commented 4 years ago

The header files (.h) do not need to be in the package.

Are you sure you captured the actual error? You only have some notes and one warning.

dconrad5 commented 4 years ago

Good call, I guess I had assumed it stopped immediately upon the error - on a closer look it's not able to find archive.h... I must not have the paths right.

/Users/dana/forked filmulator-gui/filmulator-gui/filmulator-gui/database/rawproc_lensfun/lensfun_dbupdate.cpp:11:10: fatal error: 
      'archive.h' file not found
#include <archive.h>
         ^~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/filmulator.dir/database/rawproc_lensfun/lensfun_dbupdate.cpp.o] Error 1
dconrad5 commented 4 years ago

Yep, I didn't have the LibArchive_INCLUDE_DIR set right, and I wasn't including the correct librtprocess dynamic libraries. Looks like it compiles OK, but something is keeping the minimum window size too wide for my screen - a 13" Macbook - see this screenshot:

Screen Shot 2020-05-25 at 12 07 59 PM

It won't let me make the window any narrower than that.

I haven't tested anything beyond seeing that it starts OK, so I'll play with it a little. I do still want to try to make the build process for OSX more foolproof and commit that.

EDIT: Do you want me to separate out any bugs I find into their own issue threads here or is one thread fine?

CarVac commented 4 years ago

Make a separate thread.

If you're unable to fit the window, go to the Settings tab and reduce the user interface scale.

I set that minimum window size when making room for LensFun's user interface. Unfortunately, some lenses have really long names and that takes up room…

dconrad5 commented 4 years ago

I added pull request #112 - It's up to you obviously but I would think that this issue can be closed if you end up pulling in the pull request.