Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ld warning: stack subl instruction is too different from dwarf stack size on OS X

recently we started getting this warning on our OS X build.

ld: warning:
could not create compact unwind for __Z10createMenuv: stack subl instruction is too different from dwarf stack size
ld: warning:
could not create compact unwind for __Z10del_modulejb: stack subl instruction is too different from dwarf stack size
could not create compact unwind for __Z14menu_patchbytev: stack subl instruction is too different from dwarf stack size

I could find some discussion of this in the Chromium bug tracker but the suggested "fix" is to disable compact unwind generation. I would like to understand why this warning happens and if it's an issue in our code or in the toolchain.

Our toolchain is from Xcode 7.3.1:

Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
like image 809
Igor Skochinsky Avatar asked Sep 20 '16 15:09

Igor Skochinsky


1 Answers

In doing some research, the best answer I see that there is an issue with the toolchain and not your code specifically.

It is building as 32 bit instead of 64 bit. And to solve this you need to do one of two things:

  1. Use a 64 bit version of the xCode toolchain instead of the 32 bit one.
  2. Provide the proper option during compilation in order to emit x86_64 code

That is why some recommend unwinding but I don't see any option to suppress the warning about compact unwind. There seems to be only an option to enable the warning -warn_compact_unwind.

What you could do is to suppress all linker warnings passing -Wl,-w option to compiler.

Another temporary solution you could try is passing -Wl,-no_compact_unwind to clang. It should instruct the linker not to generate compact unwind information.

Lastly, try compiling for 64 bit architecture. To do so you specify the architecture with -arch compiler option – in your case -arch x86_64. .

I see most users pointing to Xcode 7 and at times Xcode 6 being the problem builds.

In addition, there is one other method to fix this.

In project Build Settings find Build Options and set No in option Enable Bitcode. I hope that it help for you.

like image 192
norcal johnny Avatar answered Sep 21 '22 03:09

norcal johnny