Page 1 of 1

Error on Mac OS X 10.7: error: unknown attribute __hot__

Posted: 2014-03-04T15:17:37-07:00
by DanKegel
Building apps that link to ImageMagick 6.8.8-4 on MacOS X 10.7 can fail with the error

In file included from /Users/buildbot/slave-state/osx107/g-speak-rbb-osx107-1/sandbox-osx107-master3_13/build/examples/radiology/radiology.C:26:
  • ...
    /opt/oblong/deps-64-9/include/ImageMagick/magick/pixel.h:179:42:
    error: unknown attribute '__hot__' ignored [-Werror,-Wattributes]
    DecodePixelGamma(const MagickRealType) magick_hot_spot,
    ^
    /opt/oblong/deps-64-9/include/ImageMagick/magick/method-attribute.h:132:43:
    note: expanded from macro 'magick_hot_spot'
    # define magick_hot_spot __attribute__((__hot__))
    ^
Evidently magick/method-attribute.h (and wand/method-attribute.h) have an incomplete compiler version check. Here's what I see there:
  • #if defined(__clang__) || (((__GNUC__) > 4) || ((__GNUC__ == 4) &&
    (__GNUC_MINOR__ >= 3)))
    # define magick_alloc_size(x) __attribute__((__alloc_size__(x)))
    # define magick_alloc_sizes(x,y) __attribute__((__alloc_size__(x,y)))
    # define magick_cold_spot __attribute__((__cold__))
    # define magick_hot_spot __attribute__((__hot__))
    #else
    ...
    #endif
The clang I'm using is
  • $ clang++ --version
    Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
    Target: x86_64-apple-darwin11.4.2
    Thread model: posix
Unfortunately,
  • #if defined(__has_attribute) && __has_attribute(__hot__)
is true on this compiler, and version number checking in clang is hard per http://sourceforge.net/p/predef/wiki/Compilers/
so a real fix might be hard.

If it's of interest, here's the commandline that failed:
  • clang++ -I /Users/buildbot/slave-state/osx107/g-speak-rbb-osx107-1/sandbox-osx107-master3_13/build/gtest/include
    -mmacosx-version-min=10.7 -isystem /include -Wempty-body
    -fdiagnostics-show-option -Wall -Wpointer-arith -Wshadow
    -Wwrite-strings -Wno-overloaded-virtual -Wno-strict-overflow
    -Wno-error=unused-variable -Werror -g -O3 -std=gnu++0x
    -Wno-parentheses -Wno-unused-command-line-argument -Wno-shadow
    -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -arch i386
    -arch x86_64 -isysroot
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
    -I/Users/buildbot/slave-state/osx107/g-speak-rbb-osx107-1/sandbox-osx107-master3_13/build
    -I/opt/oblong/g-speak3.13/include -I/opt/oblong/deps-64-9/include
    -I/opt/oblong/deps-64-9/include/ImageMagick -o
    CMakeFiles/hydra.dir/examples/hydra/hydra.C.o -c
    /Users/buildbot/slave-state/osx107/g-speak-rbb-osx107-1/sandbox-osx107-master3_13/build/examples/hydra/hydra.C

Re: Error on Mac OS X 10.7: error: unknown attribute __hot__

Posted: 2014-03-04T17:52:49-07:00
by magick
We'll add a patch to ImageMagick 6.8.8-8 Beta to fix the problem you reported. Thanks.

Re: Error on Mac OS X 10.7: error: unknown attribute __hot__

Posted: 2014-03-21T09:57:00-07:00
by DanKegel
The patch helped, but a related problem remains. I will post on a new thread about the next problem.