Thread Rating:
  • 3 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  iOS Xcode build stuck
#19
(03-06-2020, 08:30 AM)josemendez Wrote: Apple engineers themselves have confirmed it is a bug in Xcode, first introduced in 11.4, and that they're working on fixing it. They proposed a temporary workaround that sadly, does not work. Obi compiles and runs fine using all previous XCode versions, and all other toolchain/compiler combinations (we have a different IDE/compiler/linker for each platform, which are quite a few. The only one failing is XCode).

See the main thread about this issue: http://obi.virtualmethodstudio.com/forum...p?tid=2124, copy pasting the relevant post here:

-------------
Good news everyone: Apple has confirmed this is a bug in XCode, and suggested a potential workaround:

Their response:

In other words, the culprit is indeed link-time optimization (LTO), which I tried to disable before without success. Since the library contains bitcode files (to be able to deploy to the store), LTO is mandatory. However the linker gets stuck trying to optimize a specific function. The workaround they propose is flagging that function with (optnone), to prevent the linker from attempting to optimize it and getting stuck.

They also mention they're working to fix the linker in an upcoming update. In the meantime, I will try their workaround and see if it actually works.
-------------

See the above link.


When you compile a static library (like Obi), you're generating binaries with a bitcode section at the end (if you enable it), which is then used when compiling and linking another program against the library. According to what Apple explained to me in the original bug report, when linking against bitcode language Clang always uses LTO (link time optimization: http://johanengelen.github.io/ldc/2016/1...n-LDC.html) regardless of whether or not you actually enabled it for the current build target. This is probably what you referred to as "compilation at link time", which is close. However, LTO is hanging in an infinite loop when optimizing one specific function in Obi.

Needless to say, this should never happen: a well behaving linker should either fail to link with an error message, or link successfully. Hanging when linking is always a bug in the linker, regardless of what the library contains. Same for a compiler, or any other part of the toolchain. Their proposed workaround was to temporarily disable optimization for that specific function, marking it with clang's optnone attribute. Turns out, the linker just hangs in the next function Astuto. Disabling optimization for all functions is out of the question, as performance would plummet.

Obi uses C++11 features quite extensively (smart pointers, threads, condition variables, lambdas, atomics, etc), so my guess is that LTO is choking on a particular combination of these. Still there's nothing we can do to fix this ourselves, short of rewriting our entire physics lib (which we are actually doing, see: http://obi.virtualmethodstudio.com/forum...p?tid=1619)



Any news on this ?
Reply


Messages In This Thread
iOS Xcode build stuck - by Gleb Palchin - 26-03-2020, 12:06 PM
RE: iOS Xcode build stuck - by josemendez - 26-03-2020, 12:16 PM
RE: iOS Xcode build stuck - by Gleb Palchin - 26-03-2020, 12:22 PM
RE: iOS Xcode build stuck - by josemendez - 26-03-2020, 01:51 PM
RE: iOS Xcode build stuck - by Gleb Palchin - 26-03-2020, 02:00 PM
RE: iOS Xcode build stuck - by josemendez - 26-03-2020, 04:22 PM
RE: iOS Xcode build stuck - by Gleb Palchin - 26-03-2020, 04:58 PM
RE: iOS Xcode build stuck - by josemendez - 26-03-2020, 05:00 PM
RE: iOS Xcode build stuck - by Gleb Palchin - 27-03-2020, 09:34 AM
RE: iOS Xcode build stuck - by josemendez - 27-03-2020, 09:36 AM
RE: iOS Xcode build stuck - by Bayasgalanl - 27-03-2020, 11:06 AM
RE: iOS Xcode build stuck - by Gleb Palchin - 27-03-2020, 11:13 AM
RE: iOS Xcode build stuck - by josemendez - 27-03-2020, 11:31 AM
RE: iOS Xcode build stuck - by Gleb Palchin - 30-03-2020, 08:52 AM
RE: iOS Xcode build stuck - by josemendez - 30-03-2020, 09:14 AM
RE: iOS Xcode build stuck - by josemendez - 03-04-2020, 09:56 AM
RE: iOS Xcode build stuck - by sdpgames - 02-06-2020, 06:25 PM
RE: iOS Xcode build stuck - by josemendez - 03-06-2020, 08:30 AM
RE: iOS Xcode build stuck - by davidsedrakyan - 04-06-2020, 12:01 AM