Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS >=10.10 compilation issues #3161

Closed
ion12 opened this issue Feb 20, 2016 · 14 comments
Closed

macOS >=10.10 compilation issues #3161

ion12 opened this issue Feb 20, 2016 · 14 comments
Assignees
Labels
os: macOS Specific to macOS scope: compilation Compilation issues

Comments

@ion12
Copy link
Contributor

ion12 commented Feb 20, 2016

Always found compiling on 10.6 and 10.8 with Macports very smooth.
First time trying to compile on 10.11, followed instruction on RawPedia.
The only real difference it seemed was that Clang needed to be compiled manually for openmp support.

Tried to compile first with clang 3.9 + libopenmp from svn trunk. Failed.

Installed Clang from Macports Clang 3.7 as it seemed it has openmp support as well using
sudo port install clang-3.7 +openmp.

Failed at first as well, until I realized that the patch for RawTherapee/rtengine/ipsharpen.cc still needs to be done manually, as described in
http://rawtherapee.com/oldforum/viewtopic.php?p=44395#p44395
(The code has changed a bit since then, it's on line 270 right now).
Build succeeded.
Tried again with clang from svn but still no go.

libiconv.2.dylib still needs to be manually patched as well, (otherwise RT will crash on startup without even reaching the splash screen), as described here:
http://rawtherapee.com/oldforum/viewtopic.php?f=10&t=6307#p44103

There are also a lot of warnings while compiling, which I'm guessing are Clang related incompatibilities, but it's above my head.

I'm not sure if there's any point in submitting error logs, because it seems like everything I've done to compile, and all the issues I've run up against have already been reported, it's just that it's scattered across different github issues and old forum posts.

I would be nice to update RawPedia to install "clang-3.7 +openmp" from Macports and maybe RawTherapee/rtengine/ipsharpen.cc can be patched?
seems like it was supposed to be anyway in issue 3003 but it never happened.
I don't know if libiconv could be downloaded, patched, compiled and bundled with RT (instead of the regular Macports version which causes RT to crash) by a script in the RT source itself? perhaps in /Users/Yonatan/builds/rtbuild/RawTherapee/rtdata/osx/macosx_bundle.sh ?
but if not it should be mentioned on RawPedia how to manually do it.

Willing to help out but will probably not have any more time until next weekend

In the meantime, release and debug builds done today, OSX_10.11_64_4.2.677

http://filebin.net/yhtmmcq79o

@Beep6581 Beep6581 self-assigned this Feb 20, 2016
@Beep6581 Beep6581 added the scope: compilation Compilation issues label Feb 20, 2016
@heckflosse
Copy link
Collaborator

@ion12 a79c67f should fix the clang issue in ipsharpen.cc

@ion12
Copy link
Contributor Author

ion12 commented Feb 20, 2016

Confirmed working, thanks!
Made a shared folder for RT builds, with an "OSX" subfolder.
New 4.2.682 release+debug builds available now in there as well:
https://drive.google.com/folderview?id=0B8oSq7opQwfFdW91M1U1RUt3NEE&usp=sharing
Next week I'll try compiling the gtk3 branch as well, will this commit make it there too?

Re:compiling instructions/RawPedia, just for completeness sake:

  • If clang-3.7 from macports is good enough, just adding "clang-3.7 +openmp" to the list of Macports dependencies and removing the reference to the llvm\openmp website seems like the way to go for now.
  • Would be nice to have the "git clone checkout pull" info on the OS X RawPedia page, not just on the Linux one.
  • Don't think +no_gnome and +no_x11 are required in "variants.conf" - I can't confirm this 100% without reinstalling macports from scratch, but "no_x11" is depreciated https://trac.macports.org/ticket/39383, and I think "no_gnome" is as well.
  • "BUILD_BUNDLE" "BINDIR" "DATADIR" appear to be already set-up automatically for Apple and Windows in "RawTherapee/CMakeLists.txt" (ln106-130) is it necessary to set them up again when running the cmake command?
  • The "libiconv" patch - any way I can help? At least documenting it if not fixing it.
    Btw, it doesn't seem to make a difference if "libiconv.2.dylib" is patched or not during "make install", but it has to be patched before running "make Macosx_bundle" otherwise RT will crash.

@Beep6581
Copy link
Owner

Thank you @ion12, I made the changes.
In RawPedia, the dependency installation line now reads:
sudo port install cairo clang-3.7 +openmp cmake fftw-3-single gdk-pixbuf2 gtk2 gtk-engines2 gtkmm gtk-osx-application-gtk2 lcms2 libiptcdata libsigcxx2 pango
I don't know how "+openmp" works, can I leave it there where it is, or should I move it to the end of the line?

Working on libiconv now...

@Beep6581
Copy link
Owner

Patch for libiconv 1.14 added to tools/osx/

@Beep6581
Copy link
Owner

@ion12 do OS X builders still need to download libiconv manually and patch it manually?
Is http://rawtherapee.com/oldforum/viewtopic.php?p=44103#p44103 still accurate? If so, I will rewrite those instructions in http://rawpedia.rawtherapee.com/OS_X#Patch If no, then advise what to do.

@ion12
Copy link
Contributor Author

ion12 commented Feb 21, 2016

@Beep6581
libiconv - right now I follow the instructions in the old forum post
The patched libiconv.2.dylib does not have to be present in "/opt/local/lib/" during RT compiling, but if it is not bundled into "/RawTherapee.app/Contents/MacOS/lib/" RT will crash immediately:

Exception Type:        EXC_BREAKPOINT (SIGTRAP)
Exception Codes:       0x0000000000000002, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/Volumes/RawTherapee_/RawTherapee.app/Contents/MacOS/lib:/tmp/RT4

Dyld Error Message:
  Symbol not found: _iconv
  Referenced from: /System/Library/PrivateFrameworks/LanguageModeling.framework/Versions/A/LanguageModeling
  Expected in: /Volumes/VOLUME/RawTherapee.app/Contents/MacOS/lib/libiconv.2.dylib
 in /System/Library/PrivateFrameworks/LanguageModeling.framework/Versions/A/LanguageModeling

Is there any chance this problem can be resolved within RT source code, or is there a need to report a bug with Macports or libiconv devs?

clang-3.7 +openmp needs to stay together
+openmp is the port variant of clang-3.7 that makes sure it is configured with OpenMP support.

Personally I would remove the reference to the llvm website all together, I find it confusing and if Macports' Clang works it's redundant.

Currently with clang-3.7+openmp there is no need to manually add the -DCMAKE_C_FLAGS and -DCMAKE_CXX_FLAGS, Macports takes care of that internally.

I think the instructions could still be improved a little, If you leave the issue open, I would love help with it next weekend when I have time again.
Will also try compiling with Macports clang-3.9 and see if it works.

@Beep6581
Copy link
Owner

Done.
Are these still needed?

      -DCMAKE_C_COMPILER="/tmp/clang/build_llvm/bin/clang" \
      -DCMAKE_CXX_COMPILER="/tmp/clang/build_llvm/bin/clang++" \

I don't think there's much point in trying unstable compiler versions.

@ion12
Copy link
Contributor Author

ion12 commented Feb 22, 2016

Good catch. Compiler flags must be changed to:

      -DCMAKE_C_COMPILER="clang-mp-3.7" \
      -DCMAKE_CXX_COMPILER="clang++-mp-3.7" \

Otherwise Macports will use the system Clang to compile.

I also added:
-DCMAKE_CXX_FLAGS="-w" \
after the compiler flags, as there are a lot of warnings when compiling with Clang. I assume that's ok?
I'm also pretty sure

      -DBUILD_BUNDLE="ON" \
      -DBINDIR="." \
      -DDATADIR="." \

are redundant as these options seem to be forced ON anyway for windows and mac in "/RawTherapee/CMakeLists.txt"

@Beep6581
Copy link
Owner

Agreed on all points, changes applied.
I added the libiconv patching and compilation instructions, I also simplified them and made them more flexible. I can't verify whether they work though, could you?
http://rawpedia.rawtherapee.com/OS_X#Patch

@heckflosse @adamreichold have you any idea whether this libiconv problem is something we can work around on our end?
Though it is likely this has been fixed in libiconv's master.

@adamreichold
Copy link
Contributor

@Beep6581 From looking at the source (which does seem to have changed in libiconv's master branch) and at the patch, this looks like it might be related to Mac OS X's FreeBSD heritage? Shouldn't defining __FreeBSD__ during the build have the same effect? If so, maybe this is something that could be incorporated into the MacPorts build script? (There do not seem to be any Darwin- or Mac-OS-X-specific code paths in the libiconv source.)

@ion12
Copy link
Contributor Author

ion12 commented Feb 22, 2016

@Beep6581 copied patch instructions from RawPedia verbatim into a shell script. Confirmed working.

Also confirmed +no_gnome +no_x11 are indeed redundant, only -x11 +quartz are necessary.

I understand that you want to keep things simple but I would at least copy

Clone the source

First, you need to clone RawTherapee's source code repository. Bring up your console and run this:

git clone https://github.com/Beep6581/RawTherapee ~/repo-rt
cd ~/repo-rt

and

Update RawTherapee

Every time you want to update your RawTherapee to the latest code available, just do the following and then repeat the Compile RawTherapee step above:

cd ~/repo-rt
git pull

from the linux instructions, otherwise it's hard to make sense of the complete process. If it was the first time I've ever tried to compile something I think I would find it frustrating.

Won't try to test unstable Clang, but still want to try compiling again on OS X 10.6, as well as testing the gtk3 branch.
Hope to upload some build scripts and instruction to my g drive after I'm done testing, maybe you would find them helpful.

In the meantime, latest builds updated here
https://drive.google.com/open?id=0B8oSq7opQwfFM3E5UC02a3IycW8

@Beep6581
Copy link
Owner

I'll make the changes you propose later today, after work.

About 10.6, RT now requires GCC minimum 4.9. I doubt OS X 10.6's CLANG/LLVM compiler conforms to that. I'm saying this so you don't waste time troubleshooting if the build fails.

@ion12
Copy link
Contributor Author

ion12 commented Feb 24, 2016

The final RT builds I was making last year on 10.6 and 10.8 were already using Macports' gcc-4.9, so I'm curious to see if it still works.
As far as I understand, Apple completely removed support for the GCC compiler and libstdc++ in 10.9 and now we are left with only Clang/LLVM and libc++ when installing Xcode.

@Beep6581
Copy link
Owner

I changed my mind, I won't duplicate the same text because that snowballs into something hard to maintain when changes need to be made. Instead, I linked to specific sections of the Linux article in key places of the OS X article. Now its easy to follow the complete process.

Closing.

@Beep6581 Beep6581 added the os: macOS Specific to macOS label Dec 3, 2019
@Beep6581 Beep6581 changed the title Compiling on OS X 10.10 and newer macOS >=10.10 compilation issues Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os: macOS Specific to macOS scope: compilation Compilation issues
Projects
None yet
Development

No branches or pull requests

4 participants