Unofficial Gargoyle build for MacOS 10.12

(Andrew Plotkin) #1

This weekend, kerrymg contributed a patch for Gargoyle that fixes the “no keyboard input” bug on MacOS 10.12 (Sierra).

This hasn’t been released yet, but I did a build just to have a build out there:

eblong.com/zarf/tmp/gargoyle-201 … ch.mac.dmg

I haven’t tested this beyond the machine I built it on, so you’ll have to tell me whether it works (and with what backwards compatibility).

Building Gargoyle
Where to Begin on Macos Sierra?
(Nathanaël Marion) #2

No backwards compatibility. On my El Capitan mac, it says I need 10.12 minimum.

(Andrew Plotkin) #3

Okay, good to know.

(This is just a placeholder until there’s a real release by somebody who understands the build system. I did a bunch of hackery on the build system to make it run. That’s orthogonal to the keyboard-input patch.)

#4

Hello, I’m the person who contributed the macOS Gargoyle patch.

For Gargoyle to run on older macOS versions the executables need to be compiled targeting the appropriate OS X version (you don’t need the old SDK). Pass the -mmacosx-version-min=10.x option to every compiler and linker command line. I’ve been targeting 10.9 without issue. Anything older will run into problems because of Apple’s switching of the default C++ standard library.

The difficulty is the support libraries. The Homebrew packages (bottles) target various OS X releases. Ideally they need to be built with the same min version as Gargoyle itself. I haven’t bothered figuring out how to do this.

#5

It’s not working for me. I’ve thrown the error report in the spoiler tags below. Thanks.

[spoiler]Process: Gargoyle [1055]
Path: /Users/USER/Desktop/Gargoyle.app/Contents/MacOS/Gargoyle
Identifier: com.googlecode.garglk.Launcher
Version: 2011.1
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Gargoyle [1055]
User ID: 501

Date/Time: 2016-10-11 11:18:12.785 -0400
OS Version: Mac OS X 10.12 (16A323)
Report Version: 12
Anonymous UUID: AEC430F1-D218-5687-04FA-CF80E5FB6D9D

Time Awake Since Boot: 4500 seconds

System Integrity Protection: disabled

Crashed Thread: 0

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Termination Reason: DYLD, [0x1] Library missing

Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
Library not loaded: /usr/local/opt/sdl/lib/libSDL-1.2.0.dylib
Referenced from: /Users/USER/Desktop/Gargoyle.app/Contents/MacOS/Gargoyle
Reason: image not found

Binary Images:
0x101f86000 - 0x101f8cfff +com.googlecode.garglk.Launcher (2011.1) /Users/USER/Desktop/Gargoyle.app/Contents/MacOS/Gargoyle
0x101f96000 - 0x101fe2ffb +libgarglk.dylib (0) /Users/USER/Desktop/Gargoyle.app/Contents/Frameworks/libgarglk.dylib
0x1020bc000 - 0x10212fff7 +libfreetype.6.dylib (0) /usr/local/opt/freetype/lib/libfreetype.6.dylib
0x102a8c000 - 0x102ac91c7 dyld (421.1) /usr/lib/dyld
0x7fff97c7c000 - 0x7fff97c7cfff com.apple.Cocoa (6.11 - 22) <5EEB0A26-F1C2-3D57-8441-52C0B80C2A6A> /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa
0x7fff9d04a000 - 0x7fff9d058fff com.apple.opengl (12.4.2 - 12.4.2) <06F5BF0B-BD03-361D-9D7B-626517E4F761> /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL

Model: MacBookPro11,2, BootROM MBP112.0138.B17, 4 processors, Intel Core i7, 2 GHz, 8 GB, SMC 2.18f15
Graphics: Intel Iris Pro, Intel Iris Pro, Built-In
Memory Module: BANK 0/DIMM0, 4 GB, DDR3, 1600 MHz, 0x80AD, 0x484D54343531533641465238412D50422020
Memory Module: BANK 1/DIMM0, 4 GB, DDR3, 1600 MHz, 0x80AD, 0x484D54343531533641465238412D50422020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x134), Broadcom BCM43xx 1.0 (7.21.171.10.1a16)
Bluetooth: Version 5.0.0f18, 3 services, 27 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
PCI Card: Apple 57761-B0, Ethernet Controller, Thunderbolt@191,0,0
PCI Card: pci11c1,5901, IEEE 1394 Open HCI, Thunderbolt@190,0,0
PCI Card: pci12d8,400e, USB Open Host Controller, Thunderbolt@194,0,0
PCI Card: pci12d8,400e, USB Open Host Controller, Thunderbolt@194,0,1
PCI Card: pci12d8,400f, USB Enhanced Host Controller, Thunderbolt@194,0,2
Serial ATA Device: APPLE SSD SM0256F, 251 GB
USB Device: USB 2.0 Bus
USB Device: Hub
USB Device: Wireless Mouse
USB Device: FaceTime HD Camera (Display)
USB Device: Apple Thunderbolt Display
USB Device: Display Audio
USB Device: USB 3.0 Bus
USB Device: Apple Internal Keyboard / Trackpad
USB Device: BRCM20702 Hub
USB Device: Bluetooth USB Host Controller
USB Device: Keyboard Hub
USB Device: Apple Keyboard
Thunderbolt Bus: MacBook Pro, Apple Inc., 17.1
Thunderbolt Device: Thunderbolt Display, Apple Inc., 1, 26.2[/spoiler]

(Andrew Plotkin) #6

Thanks. I have added “-mmacosx-version-min=10.9” and redone the build. As you say, the included libraries may undermine this.

Hm. I’ve added lines to the build script which may fix this. Or not! Or it may just trip over a different library!

I see the garglk source includes a directory full of static libs to link, but these are Windows DLLs so not exactly helpful here. :slight_smile:

Maybe I should just be compiling with the STATIC option. But let’s try this first.

eblong.com/zarf/tmp/gargoyle-201 … ch.mac.dmg (updated)

#7

From your crash report it seems you’re missing SDL library:

However, it looks like you are using Homebrew so, for the time being, you can install SDL and SDL_mixer libraries. You may need other libraries too. Eventually, all these libraries will be packaged in the Gargoyle bundle (unfortunately, it’s not as simple as just copying them into the bundle directory).

Good Luck!

#8

I’m getting “Library not loaded: /usr/local/opt/sdl_mixer/lib/libSDL_mixer-1.2.0.dylib” now.

#9

The libraries need to be copied into Gargoyle.app/Contents/Frameworks, then library references from other libraries and executables have to be fixed. Take a look at the beginning of the ‘gargoyle_osx.sh’ script and the calls to ‘install_name_tool’

It can be done by hand (which I’ve done a few times) but it gets old, quickly.

#10

It’s also important to pass the “version-min” option in the link step or it won’t work. I use the following to check:

Your output should look something like this:

Load command 8
      cmd LC_VERSION_MIN_MACOSX
  cmdsize 16
  version 10.9
      sdk 10.12
(Andrew Plotkin) #11

That’s what I’m doing. See github.com/erkyrath/garglk/blob … yle_osx.sh .

I added a special case for /usr/local/opt/sdl/lib/libSDL-1.2.0.dylib because that’s not showing up as a reference to /usr/local/lib/libSDL-1.2.0.dylib . (Yes, those are identical files.) However, I guess I did it wrong.

That’s set.

      cmd LC_VERSION_MIN_MACOSX
  cmdsize 16
  version 10.9
      sdk 10.12
#12

I’m an idiot! I forgot that since Homebrew 1.0 some packages are installed to “/usr/local/opt” and others into “/usr/local/lib”. I think all libraries are available on “/usr/local/opt” but I’m not certain (and can’t check right now)

(Andrew Plotkin) #13

otool -L says that most of the dylibs in the binaries are set up in this damnfool way (not /usr/local/lib), so I need to fix it up a lot more.

Sorry. Do not attempt to use this build until further notice.

#14

Yes. I’m not sure what possessed the Homebrew people from splitting them up like that. Something about “bottles” and “kegs” I don’t fully understand.

I mean, in my install SDL is in “/usr/local/lib” while yours is “/usr/local/opt”. Makes no sense.

One more tool I use is the Activity Monitor. Click the process name then the info button/icon. In the dialog click the “Open Files” tab and you’ll see all the libraries the program is using and where they’re being loaded from. There’s probably a way to do this from the terminal but I don’t know it.

(Andrew Plotkin) #15

It’s particularly annoying that the compiles are done with -L/usr/local/lib and there is a file /usr/local/lib/libSDL-1.2.0.dylib but that’s not what the binary winds up naming.

I will go over the script again, but not tonight.

(Andrew Plotkin) #16

Okay, I think I covered all the gaps this time. Try it again.

eblong.com/zarf/tmp/gargoyle-201 … ch.mac.dmg

(The build script is now thoroughly uglified. If the project winds up adopting it, I am seriously burning it to the ground and rewriting in Python.)

(Dan Fabulich) #17

It started on my El Capitan machine.

(Andrew Plotkin) #18

Yay!

#19

Works on my Sierra too.

#20

Just one more confirmation, macOS Sierra. Thank you for the quick response.

I suppose this means macOS doesn’t check the libraries’ VERSION_MIN entry, only the main executables. Good to know.