Build failing on CMakeTestCCompiler.cmake


(Frederick Kellison-Linn) #1

Hello,

I have been attempting to build Swift, but have been running into issues near the end of the build. Specifically, CMake fails on the step [2112/2254] Performing configure step for 'compiler-rt’, since the compiled clang fails to build a simple C program. The specific issue appears to be at the lines:

ld: unexpected token: !tapi-tbd-v2 file
  '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
  for architecture x86_64

My system settings are as follows:

MacBook Pro (Retina, Mid 2012)
macOS Sierra Version 10.12.2 Beta (16C48b)
Xcode Version 8.1 (8B62)
    >----clang/clang++: Apple LLVM version 8.0.0 (clang-800.0.42.1)

The full text of the failure is below. Any help figuring out how to solve this issue would be greatly appreciated.

[2112/2254] Performing configure step for 'compiler-rt'
-- The C compiler identification is Clang 4.0.0
-- The CXX compiler identification is Clang 4.0.0
-- The ASM compiler identification is Clang
-- Found assembler: /Users/freddy/Development/swift/swift-source/build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64/./bin/clang
-- Check for working C compiler: /Users/freddy/Development/swift/swift-source/build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64/./bin/clang
-- Check for working C compiler: /Users/freddy/Development/swift/swift-source/build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64/./bin/clang -- broken
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.7/Modules/CMakeTestCCompiler.cmake:51 (message):
  The C compiler
  "/Users/freddy/Development/swift/swift-source/build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64/./bin/clang"
  is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: /Users/freddy/Development/swift/swift-source/build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64/tools/clang/runtime/compiler-rt-bins/CMakeFiles/CMakeTmp

  Run Build Command:"/opt/local/bin/ninja" "cmTC_b980a"

  [1/2] Building C object CMakeFiles/cmTC_b980a.dir/testCCompiler.c.o

  [2/2] Linking C executable cmTC_b980a

  FAILED: cmTC_b980a

  : &&
  /Users/freddy/Development/swift/swift-source/build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64/./bin/clang
  -isysroot
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
  -Wl,-search_paths_first -Wl,-headerpad_max_install_names
  CMakeFiles/cmTC_b980a.dir/testCCompiler.c.o -o cmTC_b980a && :

  ld: unexpected token: !tapi-tbd-v2 file
  '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
  for architecture x86_64

  clang-4.0: error: linker command failed with exit code 1 (use -v to see
  invocation)

  ninja: build stopped: subcommand failed.

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:12 (project)

Freddy


(Greg Parker) #2

That error sounds like the build is trying to use an old linker that does not understand the format of the current SDK's files.

Xcode 8.1 (8B62) should be fine. If the problem is an old linker then it is most likely coming from some other install of Xcode on your machine.

What is the output of `xcode-select -p` and `xcodebuild -version`? If those are pointing at some other install of Xcode then you can use `xcode-select -s` to tell the command-line tools which copy of Xcode to use.

You can also re-run the failing clang command by hand and add -### to its arguments. clang will then print the full path to the linker it is running.

···

On Dec 8, 2016, at 7:28 AM, Frederick Kellison-Linn via swift-dev <swift-dev@swift.org> wrote:

Hello,

I have been attempting to build Swift, but have been running into issues near the end of the build. Specifically, CMake fails on the step [2112/2254] Performing configure step for 'compiler-rt’, since the compiled clang fails to build a simple C program. The specific issue appears to be at the lines:

ld: unexpected token: !tapi-tbd-v2 file
  '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
  for architecture x86_64

My system settings are as follows:

MacBook Pro (Retina, Mid 2012)
macOS Sierra Version 10.12.2 Beta (16C48b)
Xcode Version 8.1 (8B62)
    >----clang/clang++: Apple LLVM version 8.0.0 (clang-800.0.42.1)

  /Users/freddy/Development/swift/swift-source/build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64/./bin/clang
  -isysroot
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
  -Wl,-search_paths_first -Wl,-headerpad_max_install_names
  CMakeFiles/cmTC_b980a.dir/testCCompiler.c.o -o cmTC_b980a && :

  ld: unexpected token: !tapi-tbd-v2 file
  '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
  for architecture x86_64

--
Greg Parker gparker@apple.com Runtime Wrangler


(William Dillon) #3

I think Greg is right. I’ve seen this before, and the way I fixed it was by fixing the Xcode configuration, specifically relating to the command-line tools.

- Will

Hello,

I have been attempting to build Swift, but have been running into issues near the end of the build. Specifically, CMake fails on the step [2112/2254] Performing configure step for 'compiler-rt’, since the compiled clang fails to build a simple C program. The specific issue appears to be at the lines:

ld: unexpected token: !tapi-tbd-v2 file
'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
for architecture x86_64

My system settings are as follows:

MacBook Pro (Retina, Mid 2012)
macOS Sierra Version 10.12.2 Beta (16C48b)
Xcode Version 8.1 (8B62)
>----clang/clang++: Apple LLVM version 8.0.0 (clang-800.0.42.1)

/Users/freddy/Development/swift/swift-source/build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64/./bin/clang
-isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
-Wl,-search_paths_first -Wl,-headerpad_max_install_names
CMakeFiles/cmTC_b980a.dir/testCCompiler.c.o -o cmTC_b980a && :

ld: unexpected token: !tapi-tbd-v2 file
'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
for architecture x86_64

That error sounds like the build is trying to use an old linker that does not understand the format of the current SDK's files.

Xcode 8.1 (8B62) should be fine. If the problem is an old linker then it is most likely coming from some other install of Xcode on your machine.

What is the output of `xcode-select -p` and `xcodebuild -version`? If those are pointing at some other install of Xcode then you can use `xcode-select -s` to tell the command-line tools which copy of Xcode to use.

You can also re-run the failing clang command by hand and add -### to its arguments. clang will then print the full path to the linker it is running.

···

On December 8, 2016 at 1:24:59 PM, Greg Parker via swift-dev (swift-dev@swift.org) wrote:
On Dec 8, 2016, at 7:28 AM, Frederick Kellison-Linn via swift-dev <swift-dev@swift.org> wrote:

--
Greg Parker gparker@apple.com Runtime Wrangler

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


(William Dillon) #4

The Apple folks might know better and correct me, but I’m pretty certain you don’t want to be using any toolchains in /opt/local. It all needs to be from the Xcode.app.

- Will

The output of those commands follows:

$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

$ xcodebuild -version
Xcode 8.1
Build version 8B62

Both look fine to me.

It appears that clang is invoking /opt/local/bin/ld, and running /opt/local/bin/ld -v gives:

@(#)PROGRAM:ld PROJECT:ld64-264.3.102
configured to support archs: i386 x86_64 x86_64h armv6 armv7 armv7s armv7m armv7k arm64 (tvOS)
LTO support using: LLVM version 3.8.1

What is wrong with the config here?

Freddy

I think Greg is right. I’ve seen this before, and the way I fixed it was by fixing the Xcode configuration, specifically relating to the command-line tools.

- Will

Hello,

I have been attempting to build Swift, but have been running into issues near the end of the build. Specifically, CMake fails on the step [2112/2254] Performing configure step for 'compiler-rt’, since the compiled clang fails to build a simple C program. The specific issue appears to be at the lines:

ld: unexpected token: !tapi-tbd-v2 file
'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
for architecture x86_64

My system settings are as follows:

MacBook Pro (Retina, Mid 2012)
macOS Sierra Version 10.12.2 Beta (16C48b)
Xcode Version 8.1 (8B62)
>----clang/clang++: Apple LLVM version 8.0.0 (clang-800.0.42.1)

/Users/freddy/Development/swift/swift-source/build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64/./bin/clang
-isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
-Wl,-search_paths_first -Wl,-headerpad_max_install_names
CMakeFiles/cmTC_b980a.dir/testCCompiler.c.o -o cmTC_b980a && :

ld: unexpected token: !tapi-tbd-v2 file
'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
for architecture x86_64

That error sounds like the build is trying to use an old linker that does not understand the format of the current SDK's files.

Xcode 8.1 (8B62) should be fine. If the problem is an old linker then it is most likely coming from some other install of Xcode on your machine.

What is the output of `xcode-select -p` and `xcodebuild -version`? If those are pointing at some other install of Xcode then you can use `xcode-select -s` to tell the command-line tools which copy of Xcode to use.

You can also re-run the failing clang command by hand and add -### to its arguments. clang will then print the full path to the linker it is running.

···

On December 8, 2016 at 2:14:42 PM, Frederick Kellison-Linn via swift-dev (swift-dev@swift.org) wrote:
On Dec 8, 2016, at 4:28 PM, William Dillon <william@housedillon.com> wrote:
On December 8, 2016 at 1:24:59 PM, Greg Parker via swift-dev (swift-dev@swift.org) wrote:
On Dec 8, 2016, at 7:28 AM, Frederick Kellison-Linn via swift-dev <swift-dev@swift.org> wrote:

--
Greg Parker gparker@apple.com Runtime Wrangler

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

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


(Frederick Kellison-Linn) #5

The output of those commands follows:

$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

$ xcodebuild -version
Xcode 8.1
Build version 8B62

Both look fine to me.

It appears that clang is invoking /opt/local/bin/ld, and running /opt/local/bin/ld -v gives:

@(#)PROGRAM:ld PROJECT:ld64-264.3.102
configured to support archs: i386 x86_64 x86_64h armv6 armv7 armv7s armv7m armv7k arm64 (tvOS)
LTO support using: LLVM version 3.8.1

What is wrong with the config here?

Freddy

···

On Dec 8, 2016, at 4:28 PM, William Dillon <william@housedillon.com> wrote:

I think Greg is right. I’ve seen this before, and the way I fixed it was by fixing the Xcode configuration, specifically relating to the command-line tools.

- Will

On December 8, 2016 at 1:24:59 PM, Greg Parker via swift-dev (swift-dev@swift.org <mailto:swift-dev@swift.org>) wrote:

On Dec 8, 2016, at 7:28 AM, Frederick Kellison-Linn via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote:

Hello,

I have been attempting to build Swift, but have been running into issues near the end of the build. Specifically, CMake fails on the step [2112/2254] Performing configure step for 'compiler-rt’, since the compiled clang fails to build a simple C program. The specific issue appears to be at the lines:

ld: unexpected token: !tapi-tbd-v2 file
  '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
  for architecture x86_64

My system settings are as follows:

MacBook Pro (Retina, Mid 2012)
macOS Sierra Version 10.12.2 Beta (16C48b)
Xcode Version 8.1 (8B62)
    >----clang/clang++: Apple LLVM version 8.0.0 (clang-800.0.42.1)

  /Users/freddy/Development/swift/swift-source/build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64/./bin/clang
  -isysroot
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
  -Wl,-search_paths_first -Wl,-headerpad_max_install_names
  CMakeFiles/cmTC_b980a.dir/testCCompiler.c.o -o cmTC_b980a && :

  ld: unexpected token: !tapi-tbd-v2 file
  '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
  for architecture x86_64

That error sounds like the build is trying to use an old linker that does not understand the format of the current SDK's files.

Xcode 8.1 (8B62) should be fine. If the problem is an old linker then it is most likely coming from some other install of Xcode on your machine.

What is the output of `xcode-select -p` and `xcodebuild -version`? If those are pointing at some other install of Xcode then you can use `xcode-select -s` to tell the command-line tools which copy of Xcode to use.

You can also re-run the failing clang command by hand and add -### to its arguments. clang will then print the full path to the linker it is running.

--
Greg Parker gparker@apple.com <mailto:gparker@apple.com> Runtime Wrangler

_______________________________________________
swift-dev mailing list
swift-dev@swift.org <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev


(William Dillon) #6

What if you try:

which ld

And, what’s your PATH?

Yeah that seems wrong to me as well. Do you know how I can change the linker that clang invokes?

Freddy

The Apple folks might know better and correct me, but I’m pretty certain you don’t want to be using any toolchains in /opt/local. It all needs to be from the Xcode.app.

- Will

The output of those commands follows:

$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

$ xcodebuild -version
Xcode 8.1
Build version 8B62

Both look fine to me.

It appears that clang is invoking /opt/local/bin/ld, and running /opt/local/bin/ld -v gives:

@(#)PROGRAM:ld PROJECT:ld64-264.3.102
configured to support archs: i386 x86_64 x86_64h armv6 armv7 armv7s armv7m armv7k arm64 (tvOS)
LTO support using: LLVM version 3.8.1

What is wrong with the config here?

Freddy

I think Greg is right. I’ve seen this before, and the way I fixed it was by fixing the Xcode configuration, specifically relating to the command-line tools.

- Will

Hello,

I have been attempting to build Swift, but have been running into issues near the end of the build. Specifically, CMake fails on the step [2112/2254] Performing configure step for 'compiler-rt’, since the compiled clang fails to build a simple C program. The specific issue appears to be at the lines:

ld: unexpected token: !tapi-tbd-v2 file
'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
for architecture x86_64

My system settings are as follows:

MacBook Pro (Retina, Mid 2012)
macOS Sierra Version 10.12.2 Beta (16C48b)
Xcode Version 8.1 (8B62)
>----clang/clang++: Apple LLVM version 8.0.0 (clang-800.0.42.1)

/Users/freddy/Development/swift/swift-source/build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64/./bin/clang
-isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
-Wl,-search_paths_first -Wl,-headerpad_max_install_names
CMakeFiles/cmTC_b980a.dir/testCCompiler.c.o -o cmTC_b980a && :

ld: unexpected token: !tapi-tbd-v2 file
'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
for architecture x86_64

That error sounds like the build is trying to use an old linker that does not understand the format of the current SDK's files.

Xcode 8.1 (8B62) should be fine. If the problem is an old linker then it is most likely coming from some other install of Xcode on your machine.

What is the output of `xcode-select -p` and `xcodebuild -version`? If those are pointing at some other install of Xcode then you can use `xcode-select -s` to tell the command-line tools which copy of Xcode to use.

You can also re-run the failing clang command by hand and add -### to its arguments. clang will then print the full path to the linker it is running.

···

On December 8, 2016 at 2:19:20 PM, Frederick Kellison-Linn (fred.kl@me.com) wrote:
On Dec 8, 2016, at 5:16 PM, William Dillon <william@housedillon.com> wrote:
On December 8, 2016 at 2:14:42 PM, Frederick Kellison-Linn via swift-dev (swift-dev@swift.org) wrote:
On Dec 8, 2016, at 4:28 PM, William Dillon <william@housedillon.com> wrote:
On December 8, 2016 at 1:24:59 PM, Greg Parker via swift-dev (swift-dev@swift.org) wrote:
On Dec 8, 2016, at 7:28 AM, Frederick Kellison-Linn via swift-dev <swift-dev@swift.org> wrote:

--
Greg Parker gparker@apple.com Runtime Wrangler

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

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


(Frederick Kellison-Linn) #7

Yeah that seems wrong to me as well. Do you know how I can change the linker that clang invokes?

Freddy

···

On Dec 8, 2016, at 5:16 PM, William Dillon <william@housedillon.com> wrote:

The Apple folks might know better and correct me, but I’m pretty certain you don’t want to be using any toolchains in /opt/local. It all needs to be from the Xcode.app.

- Will

On December 8, 2016 at 2:14:42 PM, Frederick Kellison-Linn via swift-dev (swift-dev@swift.org <mailto:swift-dev@swift.org>) wrote:

The output of those commands follows:

$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

$ xcodebuild -version
Xcode 8.1
Build version 8B62

Both look fine to me.

It appears that clang is invoking /opt/local/bin/ld, and running /opt/local/bin/ld -v gives:

@(#)PROGRAM:ld PROJECT:ld64-264.3.102
configured to support archs: i386 x86_64 x86_64h armv6 armv7 armv7s armv7m armv7k arm64 (tvOS)
LTO support using: LLVM version 3.8.1

What is wrong with the config here?

Freddy

On Dec 8, 2016, at 4:28 PM, William Dillon <william@housedillon.com <mailto:william@housedillon.com>> wrote:

I think Greg is right. I’ve seen this before, and the way I fixed it was by fixing the Xcode configuration, specifically relating to the command-line tools.

- Will

On December 8, 2016 at 1:24:59 PM, Greg Parker via swift-dev (swift-dev@swift.org <mailto:swift-dev@swift.org>) wrote:

On Dec 8, 2016, at 7:28 AM, Frederick Kellison-Linn via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote:

Hello,

I have been attempting to build Swift, but have been running into issues near the end of the build. Specifically, CMake fails on the step [2112/2254] Performing configure step for 'compiler-rt’, since the compiled clang fails to build a simple C program. The specific issue appears to be at the lines:

ld: unexpected token: !tapi-tbd-v2 file
  '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
  for architecture x86_64

My system settings are as follows:

MacBook Pro (Retina, Mid 2012)
macOS Sierra Version 10.12.2 Beta (16C48b)
Xcode Version 8.1 (8B62)
    >----clang/clang++: Apple LLVM version 8.0.0 (clang-800.0.42.1)

  /Users/freddy/Development/swift/swift-source/build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64/./bin/clang
  -isysroot
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
  -Wl,-search_paths_first -Wl,-headerpad_max_install_names
  CMakeFiles/cmTC_b980a.dir/testCCompiler.c.o -o cmTC_b980a && :

  ld: unexpected token: !tapi-tbd-v2 file
  '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
  for architecture x86_64

That error sounds like the build is trying to use an old linker that does not understand the format of the current SDK's files.

Xcode 8.1 (8B62) should be fine. If the problem is an old linker then it is most likely coming from some other install of Xcode on your machine.

What is the output of `xcode-select -p` and `xcodebuild -version`? If those are pointing at some other install of Xcode then you can use `xcode-select -s` to tell the command-line tools which copy of Xcode to use.

You can also re-run the failing clang command by hand and add -### to its arguments. clang will then print the full path to the linker it is running.

--
Greg Parker gparker@apple.com <mailto:gparker@apple.com> Runtime Wrangler

_______________________________________________
swift-dev mailing list
swift-dev@swift.org <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev

_______________________________________________
swift-dev mailing list
swift-dev@swift.org <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev


(William Dillon) #8

Try it with a PATH that does not include /opt/local/*

I haven’t build on MacOS in a long time, so I can’t say with any more detail how the tools (clang, ld, etc.) are chosen when building swift ¯\_(ツ)_/¯

Good luck :slight_smile:
- Will

which ld gives the same /opt/local version

My path is

/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Users/freddy/anaconda3/bin:/opt/local/bin:/opt/local/sbin:/Users/freddy/.rvm/gems/ruby-2.1.1/bin:/Users/freddy/.rvm/gems/ruby-2.1.1@global/bin:/Users/freddy/.rvm/rubies/ruby-2.1.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/local/MacGPG2/bin:/Library/TeX/texbin:/Users/freddy/.rvm/bin

Freddy

What if you try:

which ld

And, what’s your PATH?

Yeah that seems wrong to me as well. Do you know how I can change the linker that clang invokes?

Freddy

The Apple folks might know better and correct me, but I’m pretty certain you don’t want to be using any toolchains in /opt/local. It all needs to be from the Xcode.app.

- Will

The output of those commands follows:

$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

$ xcodebuild -version
Xcode 8.1
Build version 8B62

Both look fine to me.

It appears that clang is invoking /opt/local/bin/ld, and running /opt/local/bin/ld -v gives:

@(#)PROGRAM:ld PROJECT:ld64-264.3.102
configured to support archs: i386 x86_64 x86_64h armv6 armv7 armv7s armv7m armv7k arm64 (tvOS)
LTO support using: LLVM version 3.8.1

What is wrong with the config here?

Freddy

I think Greg is right. I’ve seen this before, and the way I fixed it was by fixing the Xcode configuration, specifically relating to the command-line tools.

- Will

Hello,

I have been attempting to build Swift, but have been running into issues near the end of the build. Specifically, CMake fails on the step [2112/2254] Performing configure step for 'compiler-rt’, since the compiled clang fails to build a simple C program. The specific issue appears to be at the lines:

ld: unexpected token: !tapi-tbd-v2 file
'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
for architecture x86_64

My system settings are as follows:

MacBook Pro (Retina, Mid 2012)
macOS Sierra Version 10.12.2 Beta (16C48b)
Xcode Version 8.1 (8B62)
>----clang/clang++: Apple LLVM version 8.0.0 (clang-800.0.42.1)

/Users/freddy/Development/swift/swift-source/build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64/./bin/clang
-isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
-Wl,-search_paths_first -Wl,-headerpad_max_install_names
CMakeFiles/cmTC_b980a.dir/testCCompiler.c.o -o cmTC_b980a && :

ld: unexpected token: !tapi-tbd-v2 file
'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
for architecture x86_64

That error sounds like the build is trying to use an old linker that does not understand the format of the current SDK's files.

Xcode 8.1 (8B62) should be fine. If the problem is an old linker then it is most likely coming from some other install of Xcode on your machine.

What is the output of `xcode-select -p` and `xcodebuild -version`? If those are pointing at some other install of Xcode then you can use `xcode-select -s` to tell the command-line tools which copy of Xcode to use.

You can also re-run the failing clang command by hand and add -### to its arguments. clang will then print the full path to the linker it is running.

···

On December 8, 2016 at 6:05:12 PM, Frederick Kellison-Linn (fred.kl@me.com) wrote:
On Dec 8, 2016, at 5:31 PM, William Dillon <william@housedillon.com> wrote:
On December 8, 2016 at 2:19:20 PM, Frederick Kellison-Linn (fred.kl@me.com) wrote:
On Dec 8, 2016, at 5:16 PM, William Dillon <william@housedillon.com> wrote:
On December 8, 2016 at 2:14:42 PM, Frederick Kellison-Linn via swift-dev (swift-dev@swift.org) wrote:
On Dec 8, 2016, at 4:28 PM, William Dillon <william@housedillon.com> wrote:
On December 8, 2016 at 1:24:59 PM, Greg Parker via swift-dev (swift-dev@swift.org) wrote:
On Dec 8, 2016, at 7:28 AM, Frederick Kellison-Linn via swift-dev <swift-dev@swift.org> wrote:

--
Greg Parker gparker@apple.com Runtime Wrangler

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

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


(Frederick Kellison-Linn) #9

which ld gives the same /opt/local version

My path is

/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Users/freddy/anaconda3/bin:/opt/local/bin:/opt/local/sbin:/Users/freddy/.rvm/gems/ruby-2.1.1/bin:/Users/freddy/.rvm/gems/ruby-2.1.1@global/bin:/Users/freddy/.rvm/rubies/ruby-2.1.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/local/MacGPG2/bin:/Library/TeX/texbin:/Users/freddy/.rvm/bin

Freddy

···

On Dec 8, 2016, at 5:31 PM, William Dillon <william@housedillon.com> wrote:

What if you try:

which ld

And, what’s your PATH?

On December 8, 2016 at 2:19:20 PM, Frederick Kellison-Linn (fred.kl@me.com <mailto:fred.kl@me.com>) wrote:

Yeah that seems wrong to me as well. Do you know how I can change the linker that clang invokes?

Freddy

On Dec 8, 2016, at 5:16 PM, William Dillon <william@housedillon.com <mailto:william@housedillon.com>> wrote:

The Apple folks might know better and correct me, but I’m pretty certain you don’t want to be using any toolchains in /opt/local. It all needs to be from the Xcode.app.

- Will

On December 8, 2016 at 2:14:42 PM, Frederick Kellison-Linn via swift-dev (swift-dev@swift.org <mailto:swift-dev@swift.org>) wrote:

The output of those commands follows:

$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

$ xcodebuild -version
Xcode 8.1
Build version 8B62

Both look fine to me.

It appears that clang is invoking /opt/local/bin/ld, and running /opt/local/bin/ld -v gives:

@(#)PROGRAM:ld PROJECT:ld64-264.3.102
configured to support archs: i386 x86_64 x86_64h armv6 armv7 armv7s armv7m armv7k arm64 (tvOS)
LTO support using: LLVM version 3.8.1

What is wrong with the config here?

Freddy

On Dec 8, 2016, at 4:28 PM, William Dillon <william@housedillon.com <mailto:william@housedillon.com>> wrote:

I think Greg is right. I’ve seen this before, and the way I fixed it was by fixing the Xcode configuration, specifically relating to the command-line tools.

- Will

On December 8, 2016 at 1:24:59 PM, Greg Parker via swift-dev (swift-dev@swift.org <mailto:swift-dev@swift.org>) wrote:

On Dec 8, 2016, at 7:28 AM, Frederick Kellison-Linn via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote:

Hello,

I have been attempting to build Swift, but have been running into issues near the end of the build. Specifically, CMake fails on the step [2112/2254] Performing configure step for 'compiler-rt’, since the compiled clang fails to build a simple C program. The specific issue appears to be at the lines:

ld: unexpected token: !tapi-tbd-v2 file
  '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
  for architecture x86_64

My system settings are as follows:

MacBook Pro (Retina, Mid 2012)
macOS Sierra Version 10.12.2 Beta (16C48b)
Xcode Version 8.1 (8B62)
    >----clang/clang++: Apple LLVM version 8.0.0 (clang-800.0.42.1)

  /Users/freddy/Development/swift/swift-source/build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64/./bin/clang
  -isysroot
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
  -Wl,-search_paths_first -Wl,-headerpad_max_install_names
  CMakeFiles/cmTC_b980a.dir/testCCompiler.c.o -o cmTC_b980a && :

  ld: unexpected token: !tapi-tbd-v2 file
  '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
  for architecture x86_64

That error sounds like the build is trying to use an old linker that does not understand the format of the current SDK's files.

Xcode 8.1 (8B62) should be fine. If the problem is an old linker then it is most likely coming from some other install of Xcode on your machine.

What is the output of `xcode-select -p` and `xcodebuild -version`? If those are pointing at some other install of Xcode then you can use `xcode-select -s` to tell the command-line tools which copy of Xcode to use.

You can also re-run the failing clang command by hand and add -### to its arguments. clang will then print the full path to the linker it is running.

--
Greg Parker gparker@apple.com <mailto:gparker@apple.com> Runtime Wrangler

_______________________________________________
swift-dev mailing list
swift-dev@swift.org <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev

_______________________________________________
swift-dev mailing list
swift-dev@swift.org <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev


(Frederick Kellison-Linn) #10

Good idea.

In the end, I resolved the issue by renaming /opt/local/bin/ld which meant that clang used /usr/bin/ld, which had an appropriate LLVM version. Would be good if the build script utilized the Xcode toolchain instead of relying on system settings.

Freddy

···

On Dec 8, 2016, at 9:09 PM, William Dillon <william@housedillon.com> wrote:

Try it with a PATH that does not include /opt/local/*

I haven’t build on MacOS in a long time, so I can’t say with any more detail how the tools (clang, ld, etc.) are chosen when building swift ¯\_(ツ)_/¯

Good luck :slight_smile:
- Will

On December 8, 2016 at 6:05:12 PM, Frederick Kellison-Linn (fred.kl@me.com) wrote:
which ld gives the same /opt/local version

My path is

/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Users/freddy/anaconda3/bin:/opt/local/bin:/opt/local/sbin:/Users/freddy/.rvm/gems/ruby-2.1.1/bin:/Users/freddy/.rvm/gems/ruby-2.1.1@global/bin:/Users/freddy/.rvm/rubies/ruby-2.1.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/local/MacGPG2/bin:/Library/TeX/texbin:/Users/freddy/.rvm/bin

Freddy

On Dec 8, 2016, at 5:31 PM, William Dillon <william@housedillon.com> wrote:

What if you try:

which ld

And, what’s your PATH?

On December 8, 2016 at 2:19:20 PM, Frederick Kellison-Linn (fred.kl@me.com) wrote:

Yeah that seems wrong to me as well. Do you know how I can change the linker that clang invokes?

Freddy

On Dec 8, 2016, at 5:16 PM, William Dillon <william@housedillon.com> wrote:

The Apple folks might know better and correct me, but I’m pretty certain you don’t want to be using any toolchains in /opt/local. It all needs to be from the Xcode.app.

- Will

On December 8, 2016 at 2:14:42 PM, Frederick Kellison-Linn via swift-dev (swift-dev@swift.org) wrote:

The output of those commands follows:

$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

$ xcodebuild -version
Xcode 8.1
Build version 8B62

Both look fine to me.

It appears that clang is invoking /opt/local/bin/ld, and running /opt/local/bin/ld -v gives:

@(#)PROGRAM:ld PROJECT:ld64-264.3.102
configured to support archs: i386 x86_64 x86_64h armv6 armv7 armv7s armv7m armv7k arm64 (tvOS)
LTO support using: LLVM version 3.8.1

What is wrong with the config here?

Freddy

On Dec 8, 2016, at 4:28 PM, William Dillon <william@housedillon.com> wrote:

I think Greg is right. I’ve seen this before, and the way I fixed it was by fixing the Xcode configuration, specifically relating to the command-line tools.

- Will

On December 8, 2016 at 1:24:59 PM, Greg Parker via swift-dev (swift-dev@swift.org) wrote:

On Dec 8, 2016, at 7:28 AM, Frederick Kellison-Linn via swift-dev <swift-dev@swift.org> wrote:

Hello,

I have been attempting to build Swift, but have been running into issues near the end of the build. Specifically, CMake fails on the step [2112/2254] Performing configure step for 'compiler-rt’, since the compiled clang fails to build a simple C program. The specific issue appears to be at the lines:

ld: unexpected token: !tapi-tbd-v2 file
  '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
  for architecture x86_64

My system settings are as follows:

MacBook Pro (Retina, Mid 2012)
macOS Sierra Version 10.12.2 Beta (16C48b)
Xcode Version 8.1 (8B62)
    >----clang/clang++: Apple LLVM version 8.0.0 (clang-800.0.42.1)

  /Users/freddy/Development/swift/swift-source/build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64/./bin/clang
  -isysroot
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
  -Wl,-search_paths_first -Wl,-headerpad_max_install_names
  CMakeFiles/cmTC_b980a.dir/testCCompiler.c.o -o cmTC_b980a && :

  ld: unexpected token: !tapi-tbd-v2 file
  '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib/libSystem.tbd'
  for architecture x86_64

That error sounds like the build is trying to use an old linker that does not understand the format of the current SDK's files.

Xcode 8.1 (8B62) should be fine. If the problem is an old linker then it is most likely coming from some other install of Xcode on your machine.

What is the output of `xcode-select -p` and `xcodebuild -version`? If those are pointing at some other install of Xcode then you can use `xcode-select -s` to tell the command-line tools which copy of Xcode to use.

You can also re-run the failing clang command by hand and add -### to its arguments. clang will then print the full path to the linker it is running.

--
Greg Parker gparker@apple.com Runtime Wrangler

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

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