Opened 8 years ago

Closed 8 years ago

#51116 closed defect (fixed)

ipe @7.2.2: build fails on Yosemite, undeclared identifier 'NSLayoutGuide'.

Reported by: dbevans (David B. Evans) Owned by: m7.thon@…
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: Cc:
Port: ipe

Description

After fixing #50704, ipe builds on 10.11 but fails on 10.10.5 with the following error

Compiling ipeui_cocoa.cpp...
/usr/bin/clang++ -arch x86_64 -mmacosx-version-min=10.8 -Wdeprecated-declarations -Wall -Wno-sign-conversion -g -Os -stdlib=libc++ -fPIC -x objective-c++ -fobjc-arc  -DIPEUI_COCOA -std=c++11 -x objective-c++ -fobjc-arc  -I/opt/local/include  -c -o ../../build/obj/ipeui/ipeui_cocoa.o ipeui_cocoa.cpp
ipeui_cocoa.cpp:89:5: error: use of undeclared identifier 'NSLayoutGuide'; did you mean 'layoutGuide'?
    NSLayoutGuide *g = [[NSLayoutGuide alloc] init];
    ^~~~~~~~~~~~~
    layoutGuide
ipeui_cocoa.cpp:84:4: note: 'layoutGuide' declared here
id layoutGuide(NSView *owner)
   ^
ipeui_cocoa.cpp:89:26: error: use of undeclared identifier 'NSLayoutGuide'; did you mean 'layoutGuide'?
    NSLayoutGuide *g = [[NSLayoutGuide alloc] init];
                         ^~~~~~~~~~~~~
                         layoutGuide
ipeui_cocoa.cpp:84:4: note: 'layoutGuide' declared here
id layoutGuide(NSView *owner)
   ^
ipeui_cocoa.cpp:89:26: error: bad receiver type 'id (*)(NSView *__strong)'
    NSLayoutGuide *g = [[NSLayoutGuide alloc] init];
                         ^~~~~~~~~~~~~
ipeui_cocoa.cpp:89:20: error: use of undeclared identifier 'g'
    NSLayoutGuide *g = [[NSLayoutGuide alloc] init];
                   ^
ipeui_cocoa.cpp:90:12: error: no visible @interface for 'NSView' declares the selector 'addLayoutGuide:'
    [owner addLayoutGuide:g];
     ~~~~~ ^~~~~~~~~~~~~~
ipeui_cocoa.cpp:92:12: error: use of undeclared identifier 'g'
    return g;
           ^
ipeui_cocoa.cpp:142:15: error: no known instance method for selector 'owningView'
    return [a owningView];  // is a layout guide
              ^~~~~~~~~~
ipeui_cocoa.cpp:256:3: error: type arguments cannot be applied to non-parameterized class 'NSMutableArray'
  NSMutableArray <NSView *> *iViews;
  ^              ~~~~~~~~~~~
8 errors generated.
make[1]: *** [../../build/obj/ipeui/ipeui_cocoa.o] Error 1
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_macports_trunk_dports_graphics_ipe/ipe/work/ipe-7.2.2/src/ipeui'

The problem is that NSLayoutGuide is a new class introduced with 10.11 and so is not available on 10.10 and earlier. See NSLayoutGuide Class Reference for details.

Full build log attached.

Attachments (10)

ipe-yosemite-main.log (82.8 KB) - added by dbevans (David B. Evans) 8 years ago.
Build log showing build failure on Yosemite
Portfile-ipe.diff (402 bytes) - added by m7.thon@… 8 years ago.
ipe-yosemite-main.2.log (89.6 KB) - added by dbevans (David B. Evans) 8 years ago.
Build log showing new build failure
ipe-yosemite-main.3.log (85.0 KB) - added by dbevans (David B. Evans) 8 years ago.
Build log showing latest build failure on 10.10
ipe-mavericks-main.log (79.8 KB) - added by dbevans (David B. Evans) 8 years ago.
Build log showing latest build failure on 10.9
ipe-yosemite-main.4.log (90.6 KB) - added by dbevans (David B. Evans) 8 years ago.
Build log showing latest failure on 10.10
ipe-mavericks-main.2.log (86.6 KB) - added by dbevans (David B. Evans) 8 years ago.
Build log showing latest failure on 10.9
ipe-mavericks-main.3.log (92.9 KB) - added by dbevans (David B. Evans) 8 years ago.
Build log showing latest build failure on 10.9
ipe-mavericks-main.4.log (91.5 KB) - added by dbevans (David B. Evans) 8 years ago.
Build log showing ibtool failure on 10.9
patch-ipe-older-osx-versions.diff (12.5 KB) - added by m7.thon@… 8 years ago.
Fix ibtool error

Download all attachments as: .zip

Change History (27)

Changed 8 years ago by dbevans (David B. Evans)

Attachment: ipe-yosemite-main.log added

Build log showing build failure on Yosemite

comment:1 Changed 8 years ago by m7.thon@…

Reported upstream.

So, as long as this is not fixed, I guess the +qt4 variant (which compiles the Qt4 interface and does not use Cocoa) should be the default / forced on OSX < 10.11. I will update the Portfile accordingly.

Changed 8 years ago by m7.thon@…

Attachment: Portfile-ipe.diff added

comment:2 Changed 8 years ago by m7.thon@…

I attached a patch that should fix this issue and #51110, i.e., enabling compilation also on older versions of OSX.

comment:3 Changed 8 years ago by dbevans (David B. Evans)

I applied this patch locally and tested on 10.11, 10.10 and 10.9. Builds fine on 10.11 but 10.10 and 10.9 both fail with same error as reported in here and in #51110.

I'm thinking that MAC_OS_X_VERSION_10_11 and MAC_OS_X_VERSION_10_10 are probably not defined on earlier OS versions and should be replaced by their defined value to work correctly.

For instance on 10.10.5, AvailabilityMacros.h only defines

#define MAC_OS_X_VERSION_10_0         1000
#define MAC_OS_X_VERSION_10_1         1010
#define MAC_OS_X_VERSION_10_2         1020
#define MAC_OS_X_VERSION_10_3         1030
#define MAC_OS_X_VERSION_10_4         1040
#define MAC_OS_X_VERSION_10_5         1050
#define MAC_OS_X_VERSION_10_6         1060
#define MAC_OS_X_VERSION_10_7         1070
#define MAC_OS_X_VERSION_10_8         1080
#define MAC_OS_X_VERSION_10_9         1090
#define MAC_OS_X_VERSION_10_10      101000
#define MAC_OS_X_VERSION_10_10_2    101002
#define MAC_OS_X_VERSION_10_10_3    101003

comment:4 Changed 8 years ago by m7.thon@…

Yes, you are of course correct. Sorry about that.

comment:5 Changed 8 years ago by dbevans (David B. Evans)

OK, tried the build on 10.10 with the updated patch. It appears to have gotten past the reported problem but now fails in main_cocoa.cpp.

Compiling main_cocoa.cpp...
/usr/bin/clang++ -arch x86_64 -mmacosx-version-min=10.8 -Wdeprecated-declarations -Wall -Wno-sign-conversion -g -Os -stdlib=libc++ -DIPEUI_COCOA -std=c++11 -I../include -I../ipecanvas -I../ipecairo -I../ipelua -I../ipeui -I/opt/local/include -x objective-c++ -fobjc-arc  -I/opt/local/include/cairo -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/pixman-1 -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/libpng16 -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -I/opt/local/include  -DIPEBUNDLE  -c -o ../../build/obj/ipe/main_cocoa.o main_cocoa.cpp
main_cocoa.cpp:75:3: error: type arguments cannot be applied to non-parameterized class 'NSArray'
  NSArray <NSString *> *args = [[NSProcessInfo processInfo] arguments];
  ^       ~~~~~~~~~~~~~
1 error generated.
make[1]: *** [../../build/obj/ipe/main_cocoa.o] Error 1

Changed 8 years ago by dbevans (David B. Evans)

Attachment: ipe-yosemite-main.2.log added

Build log showing new build failure

comment:6 Changed 8 years ago by m7.thon@…

I now removed all uses of "lightweight generics" from the code. Hope there are no more incompatibilities with older OSX SDK versions.

comment:7 Changed 8 years ago by dbevans (David B. Evans)

Not quite yet. Build now fails as follows on 10.10

Compiling ipeui_common.cpp...
/usr/bin/clang++ -arch x86_64 -mmacosx-version-min=10.8 -Wdeprecated-declarations -Wall -Wno-sign-conversion -g -Os -stdlib=libc++ -fPIC -x objective-c++ -fobjc-arc  -DIPEUI_COCOA -std=c++11 -x objective-c++ -fobjc-arc  -I/opt/local/include  -c -o ../../build/obj/ipeui/ipeui_common.o ipeui_common.cpp
Compiling ipeui_cocoa.cpp...
/usr/bin/clang++ -arch x86_64 -mmacosx-version-min=10.8 -Wdeprecated-declarations -Wall -Wno-sign-conversion -g -Os -stdlib=libc++ -fPIC -x objective-c++ -fobjc-arc  -DIPEUI_COCOA -std=c++11 -x objective-c++ -fobjc-arc  -I/opt/local/include  -c -o ../../build/obj/ipeui/ipeui_cocoa.o ipeui_cocoa.cpp
ipeui_cocoa.cpp:143:15: error: no known instance method for selector 'owningView'
    return [a owningView];  // is a layout guide
              ^~~~~~~~~~
1 error generated.
make[1]: *** [../../build/obj/ipeui/ipeui_cocoa.o] Error 1

Build on 10.9 continues to fail as described in #51110.

Building with +qt4 is successful on all versions 10.9+ and seems to work as expected so that's always a fallback.

Changed 8 years ago by dbevans (David B. Evans)

Attachment: ipe-yosemite-main.3.log added

Build log showing latest build failure on 10.10

Changed 8 years ago by dbevans (David B. Evans)

Attachment: ipe-mavericks-main.log added

Build log showing latest build failure on 10.9

comment:8 Changed 8 years ago by m7.thon@…

Ok, please give it another try. It is frustrating that I cannot test this myself. Thanks for your efforts!

comment:9 in reply to:  8 Changed 8 years ago by dbevans (David B. Evans)

Replying to m7.thon@…:

Ok, please give it another try. It is frustrating that I cannot test this myself. Thanks for your efforts!

No problem. But I understand it is frustrating. Thanks for your patience.

Two more problems.

On 10.10

:info:build Compiling appui_cocoa.cpp...
:info:build /usr/bin/clang++ -arch x86_64 -mmacosx-version-min=10.8 -Wdeprecated-declarations -Wall -Wno-sign-conversion -g -Os -stdlib=libc++ -DIPEUI_COCOA -std=c++11 -I../include -I../ipecanvas -I../ipecairo -I../ipelua -I../ipeui -I/opt/local/include -x objective-c++ -fobjc-arc  -I/opt/local/include/cairo -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/pixman-1 -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/libpng16 -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -I/opt/local/include  -DIPEBUNDLE  -c -o ../../build/obj/ipe/appui_cocoa.o appui_cocoa.cpp
:info:build appui_cocoa.cpp:588:45: error: property 'frame' not found on object of type 'id'
:info:build   NSRect layerFrame = iLayerBox.contentView.frame;
:info:build                                             ^
:info:build 1 error generated.
:info:build make[1]: *** [../../build/obj/ipe/appui_cocoa.o] Error 1

On 10.9, similar to the previous error but in ipeui_cocoa.cpp

:info:build Compiling ipeui_cocoa.cpp...
:info:build /usr/bin/clang++ -arch x86_64 -mmacosx-version-min=10.8 -Wdeprecated-declarations -Wall -Wno-sign-conversion -g -Os -stdlib=libc++ -fPIC -x objective-c++ -fobjc-arc  -DIPEUI_COCOA -std=c++11 -x objective-c++ -fobjc-arc  -I/opt/local/include  -c -o ../../build/obj/ipeui/ipeui_cocoa.o ipeui_cocoa.cpp
:info:build ipeui_cocoa.cpp:56:48: error: no visible @interface for 'NSGraphicsContext' declares the selector 'CGContext'
:info:build     return [[NSGraphicsContext currentContext] CGContext];
:info:build             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~
:info:build 1 error generated.
:info:build make[1]: *** [../../build/obj/ipeui/ipeui_cocoa.o] Error 1

Changed 8 years ago by dbevans (David B. Evans)

Attachment: ipe-yosemite-main.4.log added

Build log showing latest failure on 10.10

Changed 8 years ago by dbevans (David B. Evans)

Attachment: ipe-mavericks-main.2.log added

Build log showing latest failure on 10.9

comment:10 Changed 8 years ago by m7.thon@…

Thanks, more of the same kind of error. Should also be fixed.

comment:11 Changed 8 years ago by dbevans (David B. Evans)

Partial success! 10.10 now builds without error and runs as expected under cursory testing.

On 10.9, 5 similar errors in appui_cocoa.cpp

:info:build Compiling appui_cocoa.cpp...
:info:build /usr/bin/clang++ -arch x86_64 -mmacosx-version-min=10.8 -Wdeprecated-declarations -Wall -Wno-sign-conversion -g -Os -stdlib=libc++ -DIPEUI_COCOA -std=c++11 -I../include -I../ipecanvas -I../ipecairo -I../ipelua -I../ipeui -I/opt/local/include -x objective-c++ -fobjc-arc  -I/opt/local/include/cairo -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/pixman-1 -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -I/opt/local/include  -DIPEBUNDLE  -c -o ../../build/obj/ipe/appui_cocoa.o appui_cocoa.cpp
:info:build appui_cocoa.cpp:958:27: error: no getter method for read from property
:info:build     item.title = iSnapBar.hidden ? @"Show Snap Toolbar" :
:info:build                  ~~~~~~~~~^~~~~~
:info:build appui_cocoa.cpp:965:45: error: property 'visible' not found on object of type 'NSPanel *'
:info:build       s.state = (iNotesPanel && iNotesPanel.visible);
:info:build                                             ^
:info:build appui_cocoa.cpp:967:53: error: property 'visible' not found on object of type 'NSPanel *'
:info:build       s.state = (iBookmarksPanel && iBookmarksPanel.visible);
:info:build                                                     ^
:info:build appui_cocoa.cpp:1027:31: error: no getter method for read from property
:info:build   iSnapBar.hidden = !iSnapBar.hidden;
:info:build                      ~~~~~~~~~^~~~~~
:info:build appui_cocoa.cpp:1028:16: error: no getter method for read from property
:info:build   if (iSnapBar.hidden) {
:info:build       ~~~~~~~~~^~~~~~
:info:build 5 errors generated.
:info:build make[1]: *** [../../build/obj/ipe/appui_cocoa.o] Error 1

Changed 8 years ago by dbevans (David B. Evans)

Attachment: ipe-mavericks-main.3.log added

Build log showing latest build failure on 10.9

comment:12 Changed 8 years ago by m7.thon@…

I don't understand the most recent error messages, but I changed the code to call the getters explicitly and hope for the best.

comment:13 Changed 8 years ago by dbevans (David B. Evans)

Your changes did, indeed, fix the previous problem on 10.9 but now ibtool fails

:info:build ibtool --compile ../../build/Ipe.app/Contents/Resources/mainmenu.nib mainmenu.xib
:info:build <?xml version="1.0" encoding="UTF-8"?>
:info:build <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
:info:build <plist version="1.0">
:info:build <dict>
:info:build     <key>com.apple.ibtool.errors</key>
:info:build     <array>
:info:build             <dict>
:info:build                     <key>description</key>
:info:build                     <string>Compilation failed. Unable to write to path: /opt/local/var/macports/build/_Volumes_MiniHD_opt_macports_trunk_dports_graphics_ipe/ipe/work/ipe-7.2.2/build/Ipe.app/Contents/Resources/mainmenu.nib</string>
:info:build                     <key>underlying-errors</key>
:info:build                     <array>
:info:build                             <dict>
:info:build                                     <key>description</key>
:info:build                                     <string>The file “mainmenu.nib” doesn’t exist.</string>
:info:build                                     <key>failure-reason</key>
:info:build                                     <string>The file doesn’t exist.</string>
:info:build                                     <key>underlying-errors</key>
:info:build                                     <array>
:info:build                                             <dict>
:info:build                                                     <key>description</key>
:info:build                                                     <string>The operation couldn’t be completed. No such file or directory</string>
:info:build                                                     <key>failure-reason</key>
:info:build                                                     <string>No such file or directory</string>
:info:build                                             </dict>
:info:build                                     </array>
:info:build                             </dict>
:info:build                             <dict>
:info:build                                     <key>description</key>
:info:build                                     <string>“mainmenu.nib” couldn’t be removed.</string>
:info:build                                     <key>failure-reason</key>
:info:build                                     <string>The file doesn’t exist.</string>
:info:build                                     <key>underlying-errors</key>
:info:build                                     <array>
:info:build                                             <dict>
:info:build                                                     <key>description</key>
:info:build                                                     <string>The operation couldn’t be completed. No such file or directory</string>
:info:build                                                     <key>failure-reason</key>
:info:build                                                     <string>No such file or directory</string>
:info:build                                             </dict>
:info:build                                     </array>
:info:build                             </dict>
:info:build                     </array>
:info:build             </dict>
:info:build     </array>
:info:build </dict>
:info:build </plist>
:info:build make[1]: *** [../../build/Ipe.app/Contents/Resources/mainmenu.nib] Error 1

Changed 8 years ago by dbevans (David B. Evans)

Attachment: ipe-mavericks-main.4.log added

Build log showing ibtool failure on 10.9

Changed 8 years ago by m7.thon@…

Fix ibtool error

comment:14 Changed 8 years ago by m7.thon@…

Another simple fix should do the trick. It seem newer versions of ibtool create a target path if it does not exist, while older ones don't.

comment:15 Changed 8 years ago by dbevans (David B. Evans)

That does it. ipe now builds and runs for me on 10.9, 10.10 and 10.11 so I think these changes are ready to commit. Thanks for all the updates.

Are there any other changes you would like to make? I noticed that the About screen says that ipe relies on the following:

  • Pdftex, Xetex, or Luatex
  • Pdflatex

Should any of these be included as run time dependencies?

Version 0, edited 8 years ago by dbevans (David B. Evans) (next)

comment:16 Changed 8 years ago by m7.thon@…

Hurray!

One of the main features of ipe is the ability to include LaTeX directly into drawings. For this to work, pdflatex (texlive-latex) needs to be installed. However, ipe works fine with the external MacTeX package, and is fully functional even without pdflatex except for LaTeX rendering, so I would not include this as a run-time dependency.

It would be great if you could commit these patches. Thanks!

comment:17 Changed 8 years ago by dbevans (David B. Evans)

Resolution: fixed
Status: newclosed

Patches committed in r147870. Build successful on 10.9, 10.10 buildbots.

Note: See TracTickets for help on using tickets.