problems with linking .tbd frameworks in test suite

Hi all,

Apologies if this is not the right place to ask this.

I built Swift successfully today, but was failing lots of tests because the
linker couldn't find CoreFoundation (or other frameworks, including
libsystem and libobjc). It looks like ld was invoked with the arguments:

-syslibroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk

The MacOSX10.11.sdk/usr/lib directory *did* have the desired
libraries/frameworks in it, but they had the extension .tbd, not .dylib,
and I think that confused the linker. I commented out the following lines
from swift/lib/Driver/ToolChains.cpp:

  if (!context.OI.SDKPath.empty()) {
    Arguments.push_back("-syslibroot");
    Arguments.push_back(context.Args.MakeArgString(context.OI.SDKPath));
  }

(lines 915-918), reran util/build-script -t, and everything started working
(presumably because the linker was now searching in /usr/lib, where the
dylib files are).

I'm curious to understand what was going on here. Should I have been using
a different version of ld? Configured something else differently? I'm in a
little over my head.

Thank you!

-Alex

What version of ld are you using? (ld -v)

If you have .tbd files in your SDK, then the ld that shipped with that version of Xcode should be capable of using them to link. The tools should be using that version of ld by default, but it is possible something is going wrong.

If might help to run the command that is failing with "-v", and include the full command and its errors.

- Daniel

···

On Dec 9, 2015, at 9:10 PM, Alex Lew via swift-dev <swift-dev@swift.org> wrote:

Hi all,

Apologies if this is not the right place to ask this.

I built Swift successfully today, but was failing lots of tests because the linker couldn't find CoreFoundation (or other frameworks, including libsystem and libobjc). It looks like ld was invoked with the arguments:

-syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk

The MacOSX10.11.sdk/usr/lib directory did have the desired libraries/frameworks in it, but they had the extension .tbd, not .dylib, and I think that confused the linker. I commented out the following lines from swift/lib/Driver/ToolChains.cpp:

  if (!context.OI.SDKPath.empty()) {
    Arguments.push_back("-syslibroot");
    Arguments.push_back(context.Args.MakeArgString(context.OI.SDKPath));
  }

(lines 915-918), reran util/build-script -t, and everything started working (presumably because the linker was now searching in /usr/lib, where the dylib files are).

I'm curious to understand what was going on here. Should I have been using a different version of ld? Configured something else differently? I'm in a little over my head.

Thank you!

-Alex
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

Gahh... yep, turns out I was using an old MacPorts version of ld. I thought
I'd cleared out gcc, ld, etc. from /opt/local/bin a while ago, but I guess
not. Should have been my first thought. Thanks! And sorry for bothering!

-Alex

···

On Thu, Dec 10, 2015 at 12:25 AM, Daniel Dunbar <daniel_dunbar@apple.com> wrote:

What version of ld are you using? (ld -v)

If you have .tbd files in your SDK, then the ld that shipped with that
version of Xcode should be capable of using them to link. The tools should
be using that version of ld by default, but it is possible something is
going wrong.

If might help to run the command that is failing with "-v", and include
the full command and its errors.

- Daniel

On Dec 9, 2015, at 9:10 PM, Alex Lew via swift-dev < swift-dev@swift.org> > wrote:

Hi all,

Apologies if this is not the right place to ask this.

I built Swift successfully today, but was failing lots of tests because
the linker couldn't find CoreFoundation (or other frameworks, including
libsystem and libobjc). It looks like ld was invoked with the arguments:

-syslibroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk

The MacOSX10.11.sdk/usr/lib directory *did* have the desired
libraries/frameworks in it, but they had the extension .tbd, not .dylib,
and I think that confused the linker. I commented out the following lines
from swift/lib/Driver/ToolChains.cpp:

  if (!context.OI.SDKPath.empty()) {
    Arguments.push_back("-syslibroot");
    Arguments.push_back(context.Args.MakeArgString(context.OI.SDKPath));
  }

(lines 915-918), reran util/build-script -t, and everything started
working (presumably because the linker was now searching in /usr/lib, where
the dylib files are).

I'm curious to understand what was going on here. Should I have been using
a different version of ld? Configured something else differently? I'm in a
little over my head.

Thank you!

-Alex
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev