RawTherapee compilation error under macOS Mojave rcd_demosaic.cc:192 error: value is not contextually convertible to 'bool'

Hi, trying to compile under macOS Mojave from the current dev tip and getting this error:

RawTherapee/rtengine/rcd_demosaic.cc:192:44: error: value of type '__attribute__((__vector_size__(4 * sizeof(int)))) int' (vector of 4 'int' values) is not contextually convertible to 'bool'
                    const vfloat VH_Disc = (vabsf(0.5f - VH_Central_Value) < vabsf(0.5f - VH_Neighbourhood_Value)) ? VH_Neighbourhood_Value : VH_Central_Value;

The build command I’m using is the one listed in RawPedia - MacOS. Initially I was trying to build with a newer version of llvm and clang. To rule out the compiler incompatibility I’ve installed llvm@8 (8.0.1) but the issue was still there.

The line in question was introduced by a fairly recent commit 33c5d6a (Sep, 3 2020). I’ve switched to the immediately preceding commit and was able to build fine, both with llvm@8 and the system clang 11.0.0.

From what I gathered so far the issue might be related to this bug in the clang compiler as mentioned in this stackoverflow answer.

Am I missing something? Any pointers would be appreciated.

The commands and the output logs are available here.

I will fix this bug when building with clang < 10

I’ve built with clang 11.0.0 as well and got the same error.

there is no clang 11.0.0

# clang --version

Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

But that’s not llvm. Let me try and build again with llvm 10 although I think I tried that already.

Xcode does not report the correct clang (llvm) version. See here for details.

I had the same discussion with @lock042 a few days ago.
Xcode 11.0 uses llvm 8.0.0, which indeed does not support the ternary operator for sse float vectors.

1 Like

Good to know.

I’ve tried with llvm 10 and everything built fine. Last time I did that my command was off and it couldn’t find some dependencies. I have since updated that command and this time it worked.

Maybe the guide here MacOS - RawPedia should be updated to reflect the current llvm version.

Thanks for pointing me in the right direction!

For anyone interested, the command that worked for me is here.

1 Like

The macOS system clang is not traditional clang, it is Apple clang and has its own versioning. Homebrew llvm has been on llvm@10 since August, so I’m not sure what on Rawpedia needs updating.

1 Like

Which is so annoying…

Well, the core team developers are using llvm@10 as the standard, and the support for (the referenced) llvm@8 is coming second. The macOS has its own versioning idiosyncrasies of the components critical to the build. It seems to make sense to update the guide. If not to mention the llvm@10 yet (although why not?), then to make it more explicit about the pitfalls. These are the things that become obstacles for the newcomers, and distract the team members who have to answer such questions.

If you can point out to @XavAL what needs to be updated, I’m sure he would do it.

Sure, I will prepare the text.

I’m an editor; I can update the instructions if necessary.


That would be appropriate, I think :slightly_smiling_face:

@HIRAM, @XavAL, by the link below is a proposed wording for the updates to the MacOS - RawPedia section. Not sure if this is the best way to present the changes but these docs seem not to be in the repo.


@HIRAM, @XavAL Wondering what’s holding up the update. Let me know if there is something that needs to be changed in the wording, or if you don’t find the change meaningful enough to be applied.

If @HIRAM can’t do it himself I will edit the page in a couple of days.

1 Like

Ok, edition made MacOS - RawPedia thanks for the update!

Thanks! Although the markdown formatting does not seem to work. The `` and the []() links are displayed raw. Probably needs to be converted from markdown to something the docs use.

Also the code example under Using llvm 10 from homebrew: is completely broken.

Hopefully it should be fixed now.

Can you check it, please?