[TxMt] Re: Building with a different SDK

Ronald Wampler rdwampler at gmail.com
Sat Feb 3 14:58:41 UTC 2018

On Fri, Feb 2, 2018 at 10:03 PM, Ryan Schmidt <textmate at ryandesign.com> wrote:
> On Feb 2, 2018, at 08:17, Ronald Wampler wrote:
>> On Thu, Feb 1, 2018 at 3:52 PM, Ryan Schmidt wrote:
>>> I'm trying to fix the textmate2 port in MacPorts. It fails to build on OS X 10.10 and earlier, and I think the reason is that the code uses Objective-C lightweight generics, a feature introduced in the 10.11 SDK. So I would like to instruct the build to use the 10.11 SDK, but I can't figure out how to do that. Usually I would set environment variables:
>>> CFLAGS='-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk'
>>> CPPFLAGS='-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk'
>>> CXXFLAGS='-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk'
>>> LDFLAGS='-Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk'
>>> OBJCFLAGS='-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk'
>>> OBJCXXFLAGS='-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk'
>>> But textmate's configure script isn't an autotools one and it doesn't appear to honor these environment variables. So how can I tell the build system I want to use a different SDK? I see that the configure script explicitly passes CC and CXX to bin/gen_build. Do I need to modify the configure script to also explicitly pass the other environment variables or is there an easier way that doesn't involve modifying the build system?
>> You can try passing -isysroot via CC and CXX.
>> CC='xcrun clang -isysroot/path/to/sdk' CXX='xcrun clang++
>> -isysroot/path/to/sdk' ./configure
> I could try that. I thought it was required to use -isysroot at compile time and -Wl,-syslibroot, at link time, hence the need to specify *C*FLAGS and LDFLAGS separately.
> https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html#//apple_ref/doc/uid/20002000-1114311

I think the documentation is out of date wrt to clang. On Apple platforms,
clang will set -syslibroot to -isysroot and will pass that to the linker. I
am not sure when this was supported but you can verify it by running
`clang -isysroot /path/to/sdk -### a.o` and check if -syslibroot is set to
'/path/to/sdk' and passed to the linker.

> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate

More information about the textmate mailing list